| @@ 75-93 (lines=19) @@ | ||
| 72 | ]; |
|
| 73 | } |
|
| 74 | ||
| 75 | public function testPaymentCharge(): void |
|
| 76 | { |
|
| 77 | $this->transport->expects($this->once()) |
|
| 78 | ->method('request') |
|
| 79 | ->with( |
|
| 80 | PaytureOperation::CHARGE(), |
|
| 81 | 'apim', |
|
| 82 | [ |
|
| 83 | 'Key' => 'MerchantKey', |
|
| 84 | 'OrderId' => 'Order-123', |
|
| 85 | 'Amount' => 10000, |
|
| 86 | 'Password' => 'MerchantPassword', |
|
| 87 | ] |
|
| 88 | )->willReturn('<Charge Success="True" Amount="10000"/>'); |
|
| 89 | ||
| 90 | $response = $this->terminal->charge('Order-123', 10000); |
|
| 91 | ||
| 92 | self::assertTrue($response->isSuccess()); |
|
| 93 | } |
|
| 94 | ||
| 95 | public function testPaymentUnblock(): void |
|
| 96 | { |
|
| @@ 95-113 (lines=19) @@ | ||
| 92 | self::assertTrue($response->isSuccess()); |
|
| 93 | } |
|
| 94 | ||
| 95 | public function testPaymentUnblock(): void |
|
| 96 | { |
|
| 97 | $this->transport->expects($this->once()) |
|
| 98 | ->method('request') |
|
| 99 | ->with( |
|
| 100 | PaytureOperation::UNBLOCK(), |
|
| 101 | 'apim', |
|
| 102 | [ |
|
| 103 | 'Key' => 'MerchantKey', |
|
| 104 | 'OrderId' => 'Order-123', |
|
| 105 | 'Amount' => 10000, |
|
| 106 | 'Password' => 'MerchantPassword', |
|
| 107 | ] |
|
| 108 | )->willReturn('<Unblock Success="True"/>'); |
|
| 109 | ||
| 110 | $response = $this->terminal->unblock('Order-123', 10000); |
|
| 111 | ||
| 112 | self::assertTrue($response->isSuccess()); |
|
| 113 | } |
|
| 114 | ||
| 115 | public function testPaymentRefund(): void |
|
| 116 | { |
|
| @@ 115-134 (lines=20) @@ | ||
| 112 | self::assertTrue($response->isSuccess()); |
|
| 113 | } |
|
| 114 | ||
| 115 | public function testPaymentRefund(): void |
|
| 116 | { |
|
| 117 | $this->transport->expects($this->once()) |
|
| 118 | ->method('request') |
|
| 119 | ->with( |
|
| 120 | PaytureOperation::REFUND(), |
|
| 121 | 'apim', |
|
| 122 | [ |
|
| 123 | 'Key' => 'MerchantKey', |
|
| 124 | 'OrderId' => 'Order-123', |
|
| 125 | 'Amount' => 6000, |
|
| 126 | 'Password' => 'MerchantPassword', |
|
| 127 | ] |
|
| 128 | )->willReturn('<Refund Success="True" NewAmount="4000"/>'); |
|
| 129 | ||
| 130 | $response = $this->terminal->refund('Order-123', 6000); |
|
| 131 | ||
| 132 | self::assertTrue($response->isSuccess()); |
|
| 133 | self::assertEquals(4000, $response->getAmount()); |
|
| 134 | } |
|
| 135 | ||
| 136 | public function testPaymentStatus(): void |
|
| 137 | { |
|