From 66428570addbb1a39dd953ae57219c2c5ac7b0fb Mon Sep 17 00:00:00 2001 From: zmonteca Date: Tue, 11 Jul 2017 21:53:24 -0500 Subject: [PATCH 1/7] Update Customer Record This allows execution of updating customer records via the UpdateCustomer method and also via the purchase method using the Sale method. --- src/AbstractGateway.php | 10 ++- src/Message/AbstractRequest.php | 10 +++ src/Message/CreditCard/UpdateCardRequest.php | 7 ++ tests/CreditCardGatewayTest.php | 24 +++++++ .../Mock/UpdateCardResponseSuccess.txt | 11 +++ .../CreditCard/UpdateCardRequestTest.php | 67 +++++++++++++++++++ 6 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 src/Message/CreditCard/UpdateCardRequest.php create mode 100644 tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt create mode 100644 tests/Messages/CreditCard/UpdateCardRequestTest.php diff --git a/src/AbstractGateway.php b/src/AbstractGateway.php index 51256c7..1e8a475 100644 --- a/src/AbstractGateway.php +++ b/src/AbstractGateway.php @@ -28,7 +28,7 @@ public function authorize(array $params = []) $params ); } - + public function createCard(array $params = []) { return $this->createRequest( @@ -37,6 +37,14 @@ public function createCard(array $params = []) ); } + public function updateCard(array $params = []) + { + return $this->createRequest( + '\Omnipay\Paytrace\Message\\' . static::GATEWAY_TYPE . '\UpdateCardRequest', + $params + ); + } + public function capture(array $params = []) { return $this->createRequest('\Omnipay\Paytrace\Message\\' . static::GATEWAY_TYPE . '\CaptureRequest', $params); diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 3c8e188..c7d41be 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -65,6 +65,16 @@ public function setInvoiceId($value) return $this->setParameter('invoiceId', $value); } + public function getCardReference() + { + return $this->getParameter('custid'); + } + + public function setCardReference($value) + { + return $this->setParameter('custid', $value); + } + /** * @return \Omnipay\Common\CreditCard|\Omnipay\Paytrace\Check */ diff --git a/src/Message/CreditCard/UpdateCardRequest.php b/src/Message/CreditCard/UpdateCardRequest.php new file mode 100644 index 0000000..e771191 --- /dev/null +++ b/src/Message/CreditCard/UpdateCardRequest.php @@ -0,0 +1,7 @@ +getMessage() ); } + + public function testUpdateCardSuccess() + { + $customer_id = 14496097; + $this->setMockHttpResponse('UpdateCardResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $request = $this->gateway->updateCard($this->options); + // set our paytrace customer id + $request->setCardReference($customer_id); + + $response = $request->send(); + + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CreateCardResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertSame('161', $response->getCode()); + $this->assertSame('14496097', $response->getCardReference()); + $this->assertSame( + 'The customer profile for 14496097\/John Doe was successfully updated.', + $response->getMessage() + ); + } } diff --git a/tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt b/tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt new file mode 100644 index 0000000..c9483da --- /dev/null +++ b/tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Date: Sat, 16 Feb 2013 04:22:58 GMT +Server: Microsoft-IIS/6.0 +X-Powered-By: ASP.NET +Content-Type: text/html +Content-Length: 350 +Cache-Control: private, must-revalidate, max-age=0 +Expires: Tue, 01 Jan 1980 00:00:00 GMT + +RESPONSE~161. The customer profile for 14496097\/John Doe was successfully updated.|CUSTID~14496097|CUSTOMERID~14496097| diff --git a/tests/Messages/CreditCard/UpdateCardRequestTest.php b/tests/Messages/CreditCard/UpdateCardRequestTest.php new file mode 100644 index 0000000..6c494a9 --- /dev/null +++ b/tests/Messages/CreditCard/UpdateCardRequestTest.php @@ -0,0 +1,67 @@ +request = new UpdateCardRequest($this->getHttpClient(), $this->getHttpRequest()); + } + + public function testGetData() + { + $customer_id = 14496097; + + $expectedData = [ + 'username' => 'tester', + 'password' => 'testpwd', + 'card' => [ + 'firstName' => 'Example', + 'lastName' => 'User', + 'number' => '4111111111111111', + 'expiryMonth' => '07', + 'expiryYear' => '2020', + 'cvv' => '123', + 'billingAddress1' => '123 Billing St', + 'billingAddress2' => 'Billsville', + 'billingCity' => 'Billstown', + 'billingPostcode' => '12345', + 'billingState' => 'CA', + 'billingCountry' => 'US', + 'billingPhone' => '(555) 123-4567', + 'shippingAddress1' => '123 Shipping St', + 'shippingAddress2' => 'Shipsville', + 'shippingCity' => 'Shipstown', + 'shippingPostcode' => '54321', + 'shippingState' => 'NY', + 'shippingCountry' => 'US', + 'shippingPhone' => '(555) 987-6543', + ], + 'testmode' => 1 + ]; + + $this->request->initialize($expectedData); + $this->request->setCardReference($customer_id); + + $data = $this->request->getData(); + + $this->assertSame('4111111111111111', $data['CC']); + $this->assertSame('Example User', $data['BNAME']); + $this->assertSame(substr($expectedData['card']['expiryYear'], -2), $data['EXPYR']); + $this->assertSame($expectedData['card']['expiryMonth'], $data['EXPMNTH']); + $this->assertSame($expectedData['card']['billingCity'], $data['BCITY']); + $this->assertSame($expectedData['card']['shippingCity'], $data['SCITY']); + $this->assertSame($expectedData['username'], $data['UN']); + $this->assertSame($expectedData['password'], $data['PSWD']); + $this->assertSame($customer_id, $data['CUSTID']); + $this->assertSame('UpdateCustomer', $data['METHOD']); + $this->assertSame('Y', $data['TERMS']); + } +} From 33489476aed97181240b3425a2d47d6cd734f4bc Mon Sep 17 00:00:00 2001 From: zmonteca Date: Tue, 11 Jul 2017 22:09:38 -0500 Subject: [PATCH 2/7] Added UpdateCard Request For check too --- src/Message/Check/UpdateCardRequest.php | 8 + tests/.fuse_hidden000089df00000008 | 187 ++++++++++++++++++ .../Mock/.fuse_hidden000089e700000006 | 11 ++ 3 files changed, 206 insertions(+) create mode 100644 src/Message/Check/UpdateCardRequest.php create mode 100644 tests/.fuse_hidden000089df00000008 create mode 100644 tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 diff --git a/src/Message/Check/UpdateCardRequest.php b/src/Message/Check/UpdateCardRequest.php new file mode 100644 index 0000000..56f2de6 --- /dev/null +++ b/src/Message/Check/UpdateCardRequest.php @@ -0,0 +1,8 @@ +gateway = new CreditCardGateway($this->getHttpClient(), $this->getHttpRequest()); + $this->gateway->setPassword('demo123') + ->setUserName('demo123') + ->setTestMode(true); + $this->options = [ + 'amount' => '10.00', + 'card' => $this->getValidCard(), + ]; + } + + public function testAuthorizeSuccess() + { + $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $response = $this->gateway->authorize($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNotEmpty($response->getTransactionReference()); + $this->assertSame('104', $response->getCode()); + $this->assertSame( + 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', + $response->getMessage() + ); + } + + public function testAuthorizeFailure() + { + $this->setMockHttpResponse('ResponseFailed.txt'); + + $this->gateway->setPassword('111'); + $response = $this->gateway->authorize($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); + $this->assertFalse($response->isSuccessful()); + $this->assertSame('998', $response->getCode()); + $this->assertSame('Log in failed.', $response->getMessage()); + } + + public function testPurchaseSuccess() + { + $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $response = $this->gateway->purchase($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNotEmpty($response->getTransactionReference()); + $this->assertSame('104', $response->getCode()); + $this->assertSame( + 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', + $response->getMessage() + ); + } + + public function testPurchaseCreditReferenceSuccess() + { + $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $options = array_merge(array('cardReference' => 1234567890), $this->options); + $response = $this->gateway->purchase($options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNotEmpty($response->getTransactionReference()); + $this->assertSame('104', $response->getCode()); + $this->assertSame( + 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', + $response->getMessage() + ); + } + + public function testPurchaseFailure() + { + $this->setMockHttpResponse('ResponseFailed.txt'); + + $this->gateway->setPassword('111'); + $response = $this->gateway->purchase($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); + $this->assertFalse($response->isSuccessful()); + $this->assertSame('998', $response->getCode()); + $this->assertSame('Log in failed.', $response->getMessage()); + } + + public function testRefundSuccess() + { + $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $response = $this->gateway->refund($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNotEmpty($response->getTransactionReference()); + $this->assertSame('108', $response->getCode()); + $this->assertSame( + 'Your TEST transaction was successfully refunded. HOWEVER, NO FUNDS WILL BE REFUNDED.', + $response->getMessage() + ); + } + + public function testRefundTransactionReferenceSuccess() + { + $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $options = array_merge(array('transactionReference' => 89731989), $this->options); + unset($options['card']); + $response = $this->gateway->refund($options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertSame('89731989', $response->getTransactionReference()); + $this->assertSame('108', $response->getCode()); + $this->assertSame( + 'Your TEST transaction was successfully refunded. HOWEVER, NO FUNDS WILL BE REFUNDED.', + $response->getMessage() + ); + } + + public function testRefundFailure() + { + $this->setMockHttpResponse('ResponseFailed.txt'); + + $this->gateway->setPassword('111'); + $response = $this->gateway->refund($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); + $this->assertFalse($response->isSuccessful()); + $this->assertSame('998', $response->getCode()); + $this->assertSame('Log in failed.', $response->getMessage()); + } + + public function testCreateCardSuccess() + { + $this->setMockHttpResponse('CreateCardResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $response = $this->gateway->createCard($this->options)->send(); + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CreateCardResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertSame('160', $response->getCode()); + $this->assertSame('14496097', $response->getCardReference()); + $this->assertSame( + 'The customer profile for 14496097\/John Doe was successfully created.', + $response->getMessage() + ); + } + + public function testUpdateCardSuccess() + { + $customer_id = 14496097; + $this->setMockHttpResponse('UpdateCardResponseSuccess.txt'); + + $this->gateway->setPassword('demo123'); + $request = $this->gateway->updateCard($this->options); + // set our paytrace customer id + $request->setCardReference($customer_id); + $response = $request->send(); + + $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CreateCardResponse', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertSame('160', $response->getCode()); + $this->assertSame('14496097', $response->getCardReference()); + $this->assertSame( + 'The customer profile for 14496097\/John Doe was successfully updated.', + $response->getMessage() + ); + } +} diff --git a/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 b/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 new file mode 100644 index 0000000..e80a6cb --- /dev/null +++ b/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Date: Sat, 16 Feb 2013 04:22:58 GMT +Server: Microsoft-IIS/6.0 +X-Powered-By: ASP.NET +Content-Type: text/html +Content-Length: 350 +Cache-Control: private, must-revalidate, max-age=0 +Expires: Tue, 01 Jan 1980 00:00:00 GMT + +RESPONSE~160. The customer profile for 14496097\/John Doe was successfully updated.|CUSTID~14496097|CUSTOMERID~14496097| From a20eed72c6fc6c878a0a9b1140cd1039412ecc49 Mon Sep 17 00:00:00 2001 From: zmonteca Date: Tue, 11 Jul 2017 22:12:40 -0500 Subject: [PATCH 3/7] removed junk files --- tests/.fuse_hidden000089df00000008 | 187 ------------------ .../Mock/.fuse_hidden000089e700000006 | 11 -- 2 files changed, 198 deletions(-) delete mode 100644 tests/.fuse_hidden000089df00000008 delete mode 100644 tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 diff --git a/tests/.fuse_hidden000089df00000008 b/tests/.fuse_hidden000089df00000008 deleted file mode 100644 index fdbfaf1..0000000 --- a/tests/.fuse_hidden000089df00000008 +++ /dev/null @@ -1,187 +0,0 @@ -gateway = new CreditCardGateway($this->getHttpClient(), $this->getHttpRequest()); - $this->gateway->setPassword('demo123') - ->setUserName('demo123') - ->setTestMode(true); - $this->options = [ - 'amount' => '10.00', - 'card' => $this->getValidCard(), - ]; - } - - public function testAuthorizeSuccess() - { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $response = $this->gateway->authorize($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNotEmpty($response->getTransactionReference()); - $this->assertSame('104', $response->getCode()); - $this->assertSame( - 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', - $response->getMessage() - ); - } - - public function testAuthorizeFailure() - { - $this->setMockHttpResponse('ResponseFailed.txt'); - - $this->gateway->setPassword('111'); - $response = $this->gateway->authorize($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); - $this->assertFalse($response->isSuccessful()); - $this->assertSame('998', $response->getCode()); - $this->assertSame('Log in failed.', $response->getMessage()); - } - - public function testPurchaseSuccess() - { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $response = $this->gateway->purchase($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNotEmpty($response->getTransactionReference()); - $this->assertSame('104', $response->getCode()); - $this->assertSame( - 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', - $response->getMessage() - ); - } - - public function testPurchaseCreditReferenceSuccess() - { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $options = array_merge(array('cardReference' => 1234567890), $this->options); - $response = $this->gateway->purchase($options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNotEmpty($response->getTransactionReference()); - $this->assertSame('104', $response->getCode()); - $this->assertSame( - 'Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.', - $response->getMessage() - ); - } - - public function testPurchaseFailure() - { - $this->setMockHttpResponse('ResponseFailed.txt'); - - $this->gateway->setPassword('111'); - $response = $this->gateway->purchase($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\AuthorizeResponse', $response); - $this->assertFalse($response->isSuccessful()); - $this->assertSame('998', $response->getCode()); - $this->assertSame('Log in failed.', $response->getMessage()); - } - - public function testRefundSuccess() - { - $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $response = $this->gateway->refund($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNotEmpty($response->getTransactionReference()); - $this->assertSame('108', $response->getCode()); - $this->assertSame( - 'Your TEST transaction was successfully refunded. HOWEVER, NO FUNDS WILL BE REFUNDED.', - $response->getMessage() - ); - } - - public function testRefundTransactionReferenceSuccess() - { - $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $options = array_merge(array('transactionReference' => 89731989), $this->options); - unset($options['card']); - $response = $this->gateway->refund($options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertSame('89731989', $response->getTransactionReference()); - $this->assertSame('108', $response->getCode()); - $this->assertSame( - 'Your TEST transaction was successfully refunded. HOWEVER, NO FUNDS WILL BE REFUNDED.', - $response->getMessage() - ); - } - - public function testRefundFailure() - { - $this->setMockHttpResponse('ResponseFailed.txt'); - - $this->gateway->setPassword('111'); - $response = $this->gateway->refund($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CaptureResponse', $response); - $this->assertFalse($response->isSuccessful()); - $this->assertSame('998', $response->getCode()); - $this->assertSame('Log in failed.', $response->getMessage()); - } - - public function testCreateCardSuccess() - { - $this->setMockHttpResponse('CreateCardResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $response = $this->gateway->createCard($this->options)->send(); - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CreateCardResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNull($response->getTransactionReference()); - $this->assertSame('160', $response->getCode()); - $this->assertSame('14496097', $response->getCardReference()); - $this->assertSame( - 'The customer profile for 14496097\/John Doe was successfully created.', - $response->getMessage() - ); - } - - public function testUpdateCardSuccess() - { - $customer_id = 14496097; - $this->setMockHttpResponse('UpdateCardResponseSuccess.txt'); - - $this->gateway->setPassword('demo123'); - $request = $this->gateway->updateCard($this->options); - // set our paytrace customer id - $request->setCardReference($customer_id); - $response = $request->send(); - - $this->assertInstanceOf('\Omnipay\Paytrace\Message\CreditCard\CreateCardResponse', $response); - $this->assertTrue($response->isSuccessful()); - $this->assertFalse($response->isRedirect()); - $this->assertNull($response->getTransactionReference()); - $this->assertSame('160', $response->getCode()); - $this->assertSame('14496097', $response->getCardReference()); - $this->assertSame( - 'The customer profile for 14496097\/John Doe was successfully updated.', - $response->getMessage() - ); - } -} diff --git a/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 b/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 deleted file mode 100644 index e80a6cb..0000000 --- a/tests/Messages/CreditCard/Mock/.fuse_hidden000089e700000006 +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~160. The customer profile for 14496097\/John Doe was successfully updated.|CUSTID~14496097|CUSTOMERID~14496097| From 5ffd8fc511a9a326993b0a1f8da15b3addd5f708 Mon Sep 17 00:00:00 2001 From: zmonteca Date: Tue, 11 Jul 2017 22:19:58 -0500 Subject: [PATCH 4/7] Typo Left in old class name. --- src/Message/Check/UpdateCardRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Message/Check/UpdateCardRequest.php b/src/Message/Check/UpdateCardRequest.php index 56f2de6..b071cf1 100644 --- a/src/Message/Check/UpdateCardRequest.php +++ b/src/Message/Check/UpdateCardRequest.php @@ -2,7 +2,7 @@ namespace Omnipay\Paytrace\Message\Check; -class CreateCardRequest extends CreateCardRequest +class UpdateCardRequest extends CreateCardRequest { protected $type = 'UpdateCustomer'; } From 2118c56b44cc0c843947d1f0a5842cc26e84936f Mon Sep 17 00:00:00 2001 From: zmonteca Date: Wed, 12 Jul 2017 15:59:18 -0500 Subject: [PATCH 5/7] fixed test and removed duplicitive Mocks --- tests/CheckGatewayTest.php | 22 +++++++++---------- tests/CreditCardGatewayTest.php | 16 +++++++------- .../Check}/Mock/CreateCardResponseSuccess.txt | 0 .../Check/Mock/RefundResponseSuccess.txt} | 0 tests/Mock/Check_ResponseSuccess.txt | 11 ---------- tests/Mock/Credit_AuthorizeResponseFailed.txt | 11 ---------- .../Mock/Credit_AuthorizeResponseSuccess.txt | 11 ---------- tests/Mock/Credit_CaptureResponseSuccess.txt | 11 ---------- tests/Mock/Credit_RefundResponseSuccess.txt | 11 ---------- tests/Mock/Credit_VoidResponseSuccess.txt | 11 ---------- tests/Mock/ResponseFailed.txt | 11 ---------- 11 files changed, 19 insertions(+), 96 deletions(-) rename tests/{ => Messages/Check}/Mock/CreateCardResponseSuccess.txt (100%) rename tests/{Mock/Check_RefundResponseSuccess.txt => Messages/Check/Mock/RefundResponseSuccess.txt} (100%) delete mode 100644 tests/Mock/Check_ResponseSuccess.txt delete mode 100644 tests/Mock/Credit_AuthorizeResponseFailed.txt delete mode 100644 tests/Mock/Credit_AuthorizeResponseSuccess.txt delete mode 100644 tests/Mock/Credit_CaptureResponseSuccess.txt delete mode 100644 tests/Mock/Credit_RefundResponseSuccess.txt delete mode 100644 tests/Mock/Credit_VoidResponseSuccess.txt delete mode 100644 tests/Mock/ResponseFailed.txt diff --git a/tests/CheckGatewayTest.php b/tests/CheckGatewayTest.php index 975685e..b6f9903 100644 --- a/tests/CheckGatewayTest.php +++ b/tests/CheckGatewayTest.php @@ -26,8 +26,8 @@ public function setUp() public function testAuthorizeSuccess() { - $this->setMockHttpResponse('Check_ResponseSuccess.txt'); - + $this->setMockHttpResponse('../Messages/Check/Mock/ResponseSuccess.txt'); + $this->gateway->setPassword('demo123'); $response = $this->gateway->authorize($this->options)->send(); $this->assertInstanceOf('\Omnipay\Paytrace\Message\Check\Response', $response); @@ -43,8 +43,8 @@ public function testAuthorizeSuccess() public function testAuthorizeFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); - + $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); + $this->gateway->setPassword('111'); $response = $this->gateway->authorize($this->options)->send(); $this->assertInstanceOf('\Omnipay\Paytrace\Message\Check\Response', $response); @@ -55,7 +55,7 @@ public function testAuthorizeFailure() public function testPurchaseSuccess() { - $this->setMockHttpResponse('Check_ResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/Check/Mock/ResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->purchase($this->options)->send(); @@ -72,8 +72,8 @@ public function testPurchaseSuccess() public function testPurchaseFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); - + $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); + $this->gateway->setPassword('111'); $response = $this->gateway->purchase($this->options)->send(); $this->assertInstanceOf('\Omnipay\Paytrace\Message\Check\Response', $response); @@ -84,7 +84,7 @@ public function testPurchaseFailure() public function testRefundSuccess() { - $this->setMockHttpResponse('Check_RefundResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/Check/Mock/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->refund($this->options)->send(); @@ -101,7 +101,7 @@ public function testRefundSuccess() public function testRefundTransactionReferenceSuccess() { - $this->setMockHttpResponse('Check_RefundResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/Check/Mock/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('transactionReference' => 89731989), $this->options); @@ -120,7 +120,7 @@ public function testRefundTransactionReferenceSuccess() public function testRefundFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); + $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->refund($this->options)->send(); @@ -132,7 +132,7 @@ public function testRefundFailure() public function testCreateCardSuccess() { - $this->setMockHttpResponse('CreateCardResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/Check/Mock/CreateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->createCard($this->options)->send(); diff --git a/tests/CreditCardGatewayTest.php b/tests/CreditCardGatewayTest.php index dda4945..8e5b23c 100644 --- a/tests/CreditCardGatewayTest.php +++ b/tests/CreditCardGatewayTest.php @@ -22,7 +22,7 @@ public function setUp() public function testAuthorizeSuccess() { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->authorize($this->options)->send(); @@ -51,7 +51,7 @@ public function testAuthorizeFailure() public function testPurchaseSuccess() { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->purchase($this->options)->send(); @@ -68,7 +68,7 @@ public function testPurchaseSuccess() public function testPurchaseCreditReferenceSuccess() { - $this->setMockHttpResponse('Credit_AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('cardReference' => 1234567890), $this->options); @@ -98,7 +98,7 @@ public function testPurchaseFailure() public function testRefundSuccess() { - $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->refund($this->options)->send(); @@ -115,7 +115,7 @@ public function testRefundSuccess() public function testRefundTransactionReferenceSuccess() { - $this->setMockHttpResponse('Credit_RefundResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('transactionReference' => 89731989), $this->options); @@ -134,7 +134,7 @@ public function testRefundTransactionReferenceSuccess() public function testRefundFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->refund($this->options)->send(); @@ -146,7 +146,7 @@ public function testRefundFailure() public function testCreateCardSuccess() { - $this->setMockHttpResponse('CreateCardResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/CreateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->createCard($this->options)->send(); @@ -165,7 +165,7 @@ public function testCreateCardSuccess() public function testUpdateCardSuccess() { $customer_id = 14496097; - $this->setMockHttpResponse('UpdateCardResponseSuccess.txt'); + $this->setMockHttpResponse('../Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $request = $this->gateway->updateCard($this->options); diff --git a/tests/Mock/CreateCardResponseSuccess.txt b/tests/Messages/Check/Mock/CreateCardResponseSuccess.txt similarity index 100% rename from tests/Mock/CreateCardResponseSuccess.txt rename to tests/Messages/Check/Mock/CreateCardResponseSuccess.txt diff --git a/tests/Mock/Check_RefundResponseSuccess.txt b/tests/Messages/Check/Mock/RefundResponseSuccess.txt similarity index 100% rename from tests/Mock/Check_RefundResponseSuccess.txt rename to tests/Messages/Check/Mock/RefundResponseSuccess.txt diff --git a/tests/Mock/Check_ResponseSuccess.txt b/tests/Mock/Check_ResponseSuccess.txt deleted file mode 100644 index f9dfd99..0000000 --- a/tests/Mock/Check_ResponseSuccess.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~121. Your TEST check was successfully processed. HOWEVER, FUNDS WILL NOT BE TRANSFERRED.|CHECKIDENTIFIER~89731989|APPMSG~TEST TRANSACTION|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/Credit_AuthorizeResponseFailed.txt b/tests/Mock/Credit_AuthorizeResponseFailed.txt deleted file mode 100644 index b813bc9..0000000 --- a/tests/Mock/Credit_AuthorizeResponseFailed.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~105. Your TEST transaction was not approved.|TRANSACTIONID~89731989|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/Credit_AuthorizeResponseSuccess.txt b/tests/Mock/Credit_AuthorizeResponseSuccess.txt deleted file mode 100644 index cbde35a..0000000 --- a/tests/Mock/Credit_AuthorizeResponseSuccess.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~104. Your TEST transaction was successfully approved. HOWEVER, A LIVE APPROVAL WAS NOT OBTAINED.|TRANSACTIONID~89731989|APPCODE~123456|APPMSG~TEST TRANSACTION|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/Credit_CaptureResponseSuccess.txt b/tests/Mock/Credit_CaptureResponseSuccess.txt deleted file mode 100644 index 0dcb9c8..0000000 --- a/tests/Mock/Credit_CaptureResponseSuccess.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~114. Your TEST transaction was successfully captured. HOWEVER, NO TRANSACTION WAS ACTUALLY CAPTURED.|TRANSACTIONID~89731989|APPMSG~TEST TRANSACTION|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/Credit_RefundResponseSuccess.txt b/tests/Mock/Credit_RefundResponseSuccess.txt deleted file mode 100644 index 8ab1655..0000000 --- a/tests/Mock/Credit_RefundResponseSuccess.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~108. Your TEST transaction was successfully refunded. HOWEVER, NO FUNDS WILL BE REFUNDED.|TRANSACTIONID~89731989|APPMSG~TEST TRANSACTION|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/Credit_VoidResponseSuccess.txt b/tests/Mock/Credit_VoidResponseSuccess.txt deleted file mode 100644 index 86d0002..0000000 --- a/tests/Mock/Credit_VoidResponseSuccess.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -RESPONSE~111. Your TEST transaction was successfully voided. HOWEVER, NO TRANSACTION WAS ACTUALLY VOIDED.|TRANSACTIONID~89731989|APPMSG~TEST TRANSACTION|AVSRESPONSE~Full Exact Match|CSCRESPONSE~Match| \ No newline at end of file diff --git a/tests/Mock/ResponseFailed.txt b/tests/Mock/ResponseFailed.txt deleted file mode 100644 index 1d54cca..0000000 --- a/tests/Mock/ResponseFailed.txt +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 200 OK -Connection: close -Date: Sat, 16 Feb 2013 04:22:58 GMT -Server: Microsoft-IIS/6.0 -X-Powered-By: ASP.NET -Content-Type: text/html -Content-Length: 350 -Cache-Control: private, must-revalidate, max-age=0 -Expires: Tue, 01 Jan 1980 00:00:00 GMT - -ERROR~998. Log in failed.| \ No newline at end of file From a62904f675eaec6c2bf49fbd37e646efe13278ee Mon Sep 17 00:00:00 2001 From: zmonteca Date: Wed, 12 Jul 2017 17:19:33 -0500 Subject: [PATCH 6/7] fixed mock paths to work with one single mock dir --- tests/CheckGatewayTest.php | 16 +++++++-------- tests/CreditCardGatewayTest.php | 20 +++++++++---------- tests/Messages/Check/Mock/empty | 1 + tests/Messages/Check/ResponseTest.php | 4 ++-- .../CreditCard/AuthorizeResponseTest.php | 4 ++-- .../CreditCard/CaptureResponseTest.php | 4 ++-- .../CreditCard/CreateCardResponseTest.php | 4 ++-- tests/Messages/CreditCard/Mock/empty | 1 + .../Check}/CreateCardResponseSuccess.txt | 0 .../Check}/RefundResponseSuccess.txt | 0 .../Mock => Mock/Check}/ResponseFailed.txt | 0 .../Mock => Mock/Check}/ResponseSuccess.txt | 0 .../CreditCard}/AuthorizeResponseFailed.txt | 0 .../CreditCard}/AuthorizeResponseSuccess.txt | 0 .../CreditCard}/CaptureResponseSuccess.txt | 0 .../CreditCard}/CreateCardResponseSuccess.txt | 0 .../CreditCard}/RefundResponseSuccess.txt | 0 .../CreditCard}/ResponseFailed.txt | 0 .../CreditCard}/UpdateCardResponseSuccess.txt | 0 .../CreditCard}/VoidResponseSuccess.txt | 0 20 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 tests/Messages/Check/Mock/empty create mode 100644 tests/Messages/CreditCard/Mock/empty rename tests/{Messages/Check/Mock => Mock/Check}/CreateCardResponseSuccess.txt (100%) rename tests/{Messages/Check/Mock => Mock/Check}/RefundResponseSuccess.txt (100%) rename tests/{Messages/Check/Mock => Mock/Check}/ResponseFailed.txt (100%) rename tests/{Messages/Check/Mock => Mock/Check}/ResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/AuthorizeResponseFailed.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/AuthorizeResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/CaptureResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/CreateCardResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/RefundResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/ResponseFailed.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/UpdateCardResponseSuccess.txt (100%) rename tests/{Messages/CreditCard/Mock => Mock/CreditCard}/VoidResponseSuccess.txt (100%) diff --git a/tests/CheckGatewayTest.php b/tests/CheckGatewayTest.php index b6f9903..875a506 100644 --- a/tests/CheckGatewayTest.php +++ b/tests/CheckGatewayTest.php @@ -26,7 +26,7 @@ public function setUp() public function testAuthorizeSuccess() { - $this->setMockHttpResponse('../Messages/Check/Mock/ResponseSuccess.txt'); + $this->setMockHttpResponse('Check/ResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->authorize($this->options)->send(); @@ -43,7 +43,7 @@ public function testAuthorizeSuccess() public function testAuthorizeFailure() { - $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); + $this->setMockHttpResponse('Check/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->authorize($this->options)->send(); @@ -55,7 +55,7 @@ public function testAuthorizeFailure() public function testPurchaseSuccess() { - $this->setMockHttpResponse('../Messages/Check/Mock/ResponseSuccess.txt'); + $this->setMockHttpResponse('Check/ResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->purchase($this->options)->send(); @@ -72,7 +72,7 @@ public function testPurchaseSuccess() public function testPurchaseFailure() { - $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); + $this->setMockHttpResponse('Check/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->purchase($this->options)->send(); @@ -84,7 +84,7 @@ public function testPurchaseFailure() public function testRefundSuccess() { - $this->setMockHttpResponse('../Messages/Check/Mock/RefundResponseSuccess.txt'); + $this->setMockHttpResponse('Check/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->refund($this->options)->send(); @@ -101,7 +101,7 @@ public function testRefundSuccess() public function testRefundTransactionReferenceSuccess() { - $this->setMockHttpResponse('../Messages/Check/Mock/RefundResponseSuccess.txt'); + $this->setMockHttpResponse('Check/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('transactionReference' => 89731989), $this->options); @@ -120,7 +120,7 @@ public function testRefundTransactionReferenceSuccess() public function testRefundFailure() { - $this->setMockHttpResponse('../Messages/Check/Mock/ResponseFailed.txt'); + $this->setMockHttpResponse('Check/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->refund($this->options)->send(); @@ -132,7 +132,7 @@ public function testRefundFailure() public function testCreateCardSuccess() { - $this->setMockHttpResponse('../Messages/Check/Mock/CreateCardResponseSuccess.txt'); + $this->setMockHttpResponse('Check/CreateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->createCard($this->options)->send(); diff --git a/tests/CreditCardGatewayTest.php b/tests/CreditCardGatewayTest.php index 8e5b23c..c2ef06a 100644 --- a/tests/CreditCardGatewayTest.php +++ b/tests/CreditCardGatewayTest.php @@ -22,7 +22,7 @@ public function setUp() public function testAuthorizeSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->authorize($this->options)->send(); @@ -39,7 +39,7 @@ public function testAuthorizeSuccess() public function testAuthorizeFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); + $this->setMockHttpResponse('CreditCard/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->authorize($this->options)->send(); @@ -51,7 +51,7 @@ public function testAuthorizeFailure() public function testPurchaseSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->purchase($this->options)->send(); @@ -68,7 +68,7 @@ public function testPurchaseSuccess() public function testPurchaseCreditReferenceSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/AuthorizeResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('cardReference' => 1234567890), $this->options); @@ -86,7 +86,7 @@ public function testPurchaseCreditReferenceSuccess() public function testPurchaseFailure() { - $this->setMockHttpResponse('ResponseFailed.txt'); + $this->setMockHttpResponse('CreditCard/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->purchase($this->options)->send(); @@ -98,7 +98,7 @@ public function testPurchaseFailure() public function testRefundSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/RefundResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->refund($this->options)->send(); @@ -115,7 +115,7 @@ public function testRefundSuccess() public function testRefundTransactionReferenceSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/RefundResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/RefundResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $options = array_merge(array('transactionReference' => 89731989), $this->options); @@ -134,7 +134,7 @@ public function testRefundTransactionReferenceSuccess() public function testRefundFailure() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/ResponseFailed.txt'); + $this->setMockHttpResponse('CreditCard/ResponseFailed.txt'); $this->gateway->setPassword('111'); $response = $this->gateway->refund($this->options)->send(); @@ -146,7 +146,7 @@ public function testRefundFailure() public function testCreateCardSuccess() { - $this->setMockHttpResponse('../Messages/CreditCard/Mock/CreateCardResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/CreateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $response = $this->gateway->createCard($this->options)->send(); @@ -165,7 +165,7 @@ public function testCreateCardSuccess() public function testUpdateCardSuccess() { $customer_id = 14496097; - $this->setMockHttpResponse('../Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt'); + $this->setMockHttpResponse('CreditCard/UpdateCardResponseSuccess.txt'); $this->gateway->setPassword('demo123'); $request = $this->gateway->updateCard($this->options); diff --git a/tests/Messages/Check/Mock/empty b/tests/Messages/Check/Mock/empty new file mode 100644 index 0000000..c6cac69 --- /dev/null +++ b/tests/Messages/Check/Mock/empty @@ -0,0 +1 @@ +empty diff --git a/tests/Messages/Check/ResponseTest.php b/tests/Messages/Check/ResponseTest.php index 9612b95..0c7ec31 100644 --- a/tests/Messages/Check/ResponseTest.php +++ b/tests/Messages/Check/ResponseTest.php @@ -8,7 +8,7 @@ class ResponseTest extends TestCase { public function testSuccess() { - $httpResponse = $this->getMockHttpResponse('ResponseSuccess.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/Check/ResponseSuccess.txt'); $response = new Response($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('121', $response->getCode()); @@ -20,7 +20,7 @@ public function testSuccess() public function testFail() { - $httpResponse = $this->getMockHttpResponse('ResponseFailed.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/Check/ResponseFailed.txt'); $response = new Response($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('998', $response->getCode()); diff --git a/tests/Messages/CreditCard/AuthorizeResponseTest.php b/tests/Messages/CreditCard/AuthorizeResponseTest.php index afb6804..78965e9 100644 --- a/tests/Messages/CreditCard/AuthorizeResponseTest.php +++ b/tests/Messages/CreditCard/AuthorizeResponseTest.php @@ -8,7 +8,7 @@ class AuthorizeResponseTest extends TestCase { public function testSuccess() { - $httpResponse = $this->getMockHttpResponse('AuthorizeResponseSuccess.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/AuthorizeResponseSuccess.txt'); $response = new AuthorizeResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('104', $response->getCode()); @@ -20,7 +20,7 @@ public function testSuccess() public function testFail() { - $httpResponse = $this->getMockHttpResponse('AuthorizeResponseFailed.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/AuthorizeResponseFailed.txt'); $response = new AuthorizeResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('105', $response->getCode()); diff --git a/tests/Messages/CreditCard/CaptureResponseTest.php b/tests/Messages/CreditCard/CaptureResponseTest.php index ef7a682..523e8b7 100644 --- a/tests/Messages/CreditCard/CaptureResponseTest.php +++ b/tests/Messages/CreditCard/CaptureResponseTest.php @@ -8,7 +8,7 @@ class CaptureResponseTest extends TestCase { public function testSuccess() { - $httpResponse = $this->getMockHttpResponse('CaptureResponseSuccess.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/CaptureResponseSuccess.txt'); $response = new CaptureResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('114', $response->getCode()); @@ -20,7 +20,7 @@ public function testSuccess() public function testFail() { - $httpResponse = $this->getMockHttpResponse('ResponseFailed.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/ResponseFailed.txt'); $response = new CaptureResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('998', $response->getCode()); diff --git a/tests/Messages/CreditCard/CreateCardResponseTest.php b/tests/Messages/CreditCard/CreateCardResponseTest.php index d2032d1..e28fed8 100644 --- a/tests/Messages/CreditCard/CreateCardResponseTest.php +++ b/tests/Messages/CreditCard/CreateCardResponseTest.php @@ -8,7 +8,7 @@ class CreateCardResponseTest extends TestCase { public function testSuccess() { - $httpResponse = $this->getMockHttpResponse('CreateCardResponseSuccess.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/CreateCardResponseSuccess.txt'); $response = new CreateCardResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('160', $response->getCode()); @@ -20,7 +20,7 @@ public function testSuccess() public function testFail() { - $httpResponse = $this->getMockHttpResponse('ResponseFailed.txt'); + $httpResponse = $this->getMockHttpResponse('../../../Mock/CreditCard/ResponseFailed.txt'); $response = new CreateCardResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('998', $response->getCode()); diff --git a/tests/Messages/CreditCard/Mock/empty b/tests/Messages/CreditCard/Mock/empty new file mode 100644 index 0000000..c6cac69 --- /dev/null +++ b/tests/Messages/CreditCard/Mock/empty @@ -0,0 +1 @@ +empty diff --git a/tests/Messages/Check/Mock/CreateCardResponseSuccess.txt b/tests/Mock/Check/CreateCardResponseSuccess.txt similarity index 100% rename from tests/Messages/Check/Mock/CreateCardResponseSuccess.txt rename to tests/Mock/Check/CreateCardResponseSuccess.txt diff --git a/tests/Messages/Check/Mock/RefundResponseSuccess.txt b/tests/Mock/Check/RefundResponseSuccess.txt similarity index 100% rename from tests/Messages/Check/Mock/RefundResponseSuccess.txt rename to tests/Mock/Check/RefundResponseSuccess.txt diff --git a/tests/Messages/Check/Mock/ResponseFailed.txt b/tests/Mock/Check/ResponseFailed.txt similarity index 100% rename from tests/Messages/Check/Mock/ResponseFailed.txt rename to tests/Mock/Check/ResponseFailed.txt diff --git a/tests/Messages/Check/Mock/ResponseSuccess.txt b/tests/Mock/Check/ResponseSuccess.txt similarity index 100% rename from tests/Messages/Check/Mock/ResponseSuccess.txt rename to tests/Mock/Check/ResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/AuthorizeResponseFailed.txt b/tests/Mock/CreditCard/AuthorizeResponseFailed.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/AuthorizeResponseFailed.txt rename to tests/Mock/CreditCard/AuthorizeResponseFailed.txt diff --git a/tests/Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt b/tests/Mock/CreditCard/AuthorizeResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/AuthorizeResponseSuccess.txt rename to tests/Mock/CreditCard/AuthorizeResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/CaptureResponseSuccess.txt b/tests/Mock/CreditCard/CaptureResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/CaptureResponseSuccess.txt rename to tests/Mock/CreditCard/CaptureResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/CreateCardResponseSuccess.txt b/tests/Mock/CreditCard/CreateCardResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/CreateCardResponseSuccess.txt rename to tests/Mock/CreditCard/CreateCardResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/RefundResponseSuccess.txt b/tests/Mock/CreditCard/RefundResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/RefundResponseSuccess.txt rename to tests/Mock/CreditCard/RefundResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/ResponseFailed.txt b/tests/Mock/CreditCard/ResponseFailed.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/ResponseFailed.txt rename to tests/Mock/CreditCard/ResponseFailed.txt diff --git a/tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt b/tests/Mock/CreditCard/UpdateCardResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/UpdateCardResponseSuccess.txt rename to tests/Mock/CreditCard/UpdateCardResponseSuccess.txt diff --git a/tests/Messages/CreditCard/Mock/VoidResponseSuccess.txt b/tests/Mock/CreditCard/VoidResponseSuccess.txt similarity index 100% rename from tests/Messages/CreditCard/Mock/VoidResponseSuccess.txt rename to tests/Mock/CreditCard/VoidResponseSuccess.txt From f66c6f2cb8fe88555513811a204725ea2fd4db73 Mon Sep 17 00:00:00 2001 From: zmonteca Date: Thu, 13 Jul 2017 09:43:21 -0500 Subject: [PATCH 7/7] updated card expire years to 2050 --- tests/Messages/CreditCard/AuthorizeRequestTest.php | 2 +- tests/Messages/CreditCard/CreateCardRequestTest.php | 2 +- tests/Messages/CreditCard/PurchaseRequestTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Messages/CreditCard/AuthorizeRequestTest.php b/tests/Messages/CreditCard/AuthorizeRequestTest.php index 7c4d05d..991a749 100644 --- a/tests/Messages/CreditCard/AuthorizeRequestTest.php +++ b/tests/Messages/CreditCard/AuthorizeRequestTest.php @@ -27,7 +27,7 @@ public function testGetData() 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '07', - 'expiryYear' => '2020', + 'expiryYear' => '2050', 'cvv' => '123', 'billingAddress1' => '123 Billing St', 'billingAddress2' => 'Billsville', diff --git a/tests/Messages/CreditCard/CreateCardRequestTest.php b/tests/Messages/CreditCard/CreateCardRequestTest.php index 8bb9035..9c30ddf 100644 --- a/tests/Messages/CreditCard/CreateCardRequestTest.php +++ b/tests/Messages/CreditCard/CreateCardRequestTest.php @@ -25,7 +25,7 @@ public function testGetData() 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '07', - 'expiryYear' => '2020', + 'expiryYear' => '2050', 'cvv' => '123', 'billingAddress1' => '123 Billing St', 'billingAddress2' => 'Billsville', diff --git a/tests/Messages/CreditCard/PurchaseRequestTest.php b/tests/Messages/CreditCard/PurchaseRequestTest.php index dd3b0a2..66aa654 100644 --- a/tests/Messages/CreditCard/PurchaseRequestTest.php +++ b/tests/Messages/CreditCard/PurchaseRequestTest.php @@ -27,7 +27,7 @@ public function testGetData() 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '07', - 'expiryYear' => '2020', + 'expiryYear' => '2050', 'cvv' => '123', 'billingAddress1' => '123 Billing St', 'billingAddress2' => 'Billsville',