public function testRefundError() { $this->setMockHttpResponse('RefundFailure.txt'); $response = $this->gateway->refund(array('amount' => '500.00', 'transactionReference' => '123456'))->send(); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('Failure', $response->getMessage()); }
public function testRefundSuccessWithAmount() { $result = new \stdClass(); $result->State = 4; $result->Status = 1; $result->Message = 'Approved BankAuth: 826914443 CvvResult: M CVVCodeReason: CVV2 Match'; $result->Technical = ''; $result->TransactionID = 'f0e5b9f4-ec28-4ff2-aaed-195ec71aefcc'; $wrapper = new \stdClass(); $wrapper->PartialRefundResult = $result; $this->mockSoapClient->expects($this->any())->method('PartialRefund')->will($this->returnValue($wrapper)); $this->options = array('transactionReference' => 'f0e5b9f4-ec28-4ff2-aaed-195ec71aefcc', 'amount' => 5.0); $response = $this->gateway->refund($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertEquals('f0e5b9f4-ec28-4ff2-aaed-195ec71aefcc', $response->getTransactionReference()); $this->assertSame('Approved BankAuth: 826914443 CvvResult: M CVVCodeReason: CVV2 Match', $response->getMessage()); }