File manager - Edit - /home/opticamezl/www/newok/netbanx.tar
Back
tests/GatewayTest.php 0000604 00000027213 15175450163 0010670 0 ustar 00 <?php namespace Omnipay\NetBanx; use Omnipay\Common\CreditCard; use Omnipay\Tests\GatewayTestCase; class GatewayTest extends GatewayTestCase { public function setUp() { parent::setUp(); $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); $card = new CreditCard($this->getValidCard()); $card->setBillingAddress1('Wall street'); $card->setBillingAddress2('Wall street 2'); $card->setBillingCity('San Luis Obispo'); $card->setBillingCountry('US'); $card->setBillingPostcode('93401'); $card->setBillingPhone('1234567'); $card->setBillingState('CA'); $card->setShippingAddress1('Shipping Wall street'); $card->setShippingAddress2('Shipping Wall street 2'); $card->setShippingCity('San Luis Obispo'); $card->setShippingCountry('US'); $card->setShippingPostcode('93401'); $card->setShippingPhone('1234567'); $card->setShippingState('CA'); $card->setCompany('Test Business name'); $card->setEmail('test@example.com'); $this->purchaseOptions = array( 'amount' => '95.63', 'card' => $card, 'customerId' => '9966441', ); $this->captureOptions = array( 'amount' => '10.00', 'transactionReference' => '9988775', ); $this->voidOptions = array( 'accountNumber' => '12345678', 'storeId' => 'test', 'storePassword' => 'test', 'transactionReference' => '115147689', ); $this->storedDataOptions = array( 'amount' => '95.63', 'customerId' => '9966441', 'transactionReference' => '244530120', ); } public function testAuthorizeSuccess() { $this->setMockHttpResponse('AuthorizeSuccess.txt'); $request = $this->gateway->authorize($this->purchaseOptions); $requestData = $request->getData(); /** @var $card CreditCard */ $card = $request->getCard(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccAuthorize', $requestData['txnMode']); $this->assertSame('93401', (string) $sxml->billingDetails->zip); $this->assertSame('VI', (string) $sxml->card->cardType); $this->assertTrue(isset($sxml->billingDetails)); $this->assertTrue(isset($sxml->shippingDetails)); $this->assertSame('95.63', (string) $sxml->amount); $this->assertSame('9966441', (string) $sxml->merchantRefNum); $this->assertSame('93401', $card->getPostcode()); $this->assertSame('test@example.com', $card->getEmail()); $this->assertTrue($response->isSuccessful()); $this->assertSame('244350540', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testAuthorizeFailure() { $this->setMockHttpResponse('AuthorizeFailure.txt'); $response = $this->gateway->authorize($this->purchaseOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('-1', $response->getTransactionReference()); $this->assertSame('Invalid txnMode: ccccAuthorize', $response->getMessage()); } public function testStoredDataAuthorizeSuccess() { $this->setMockHttpResponse('StoredDataAuthorizeSuccess.txt'); $request = $this->gateway->authorize($this->storedDataOptions); $requestData = $request->getData(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccStoredDataAuthorize', $requestData['txnMode']); $this->assertSame('244530120', (string) $sxml->confirmationNumber); $this->assertSame('95.63', (string) $sxml->amount); $this->assertSame('9966441', (string) $sxml->merchantRefNum); $this->assertTrue($response->isSuccessful()); $this->assertSame('244530120', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testStoredDataAuthorizeFailure() { $this->setMockHttpResponse('StoredDataAuthorizeFailure.txt'); $response = $this->gateway->authorize($this->storedDataOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame( 'You submitted an invalid XML request. Please verify your request and retry the transaction.', $response->getMessage() ); } public function testCaptureSuccess() { $this->setMockHttpResponse('CaptureSuccess.txt'); $request = $this->gateway->capture($this->captureOptions); $requestData = $request->getData(); $response = $request->send(); $this->assertSame('ccSettlement', $requestData['txnMode']); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('9988775', (string) $sxml->confirmationNumber); $this->assertTrue($response->isSuccessful()); $this->assertSame('9988775', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testCaptureFailure() { $this->setMockHttpResponse('CaptureFailure.txt'); $request = $this->gateway->capture($this->captureOptions); $requestData = $request->getData(); $response = $request->send(); $this->assertSame('ccSettlement', $requestData['txnMode']); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('9988775', (string) $sxml->confirmationNumber); $this->assertFalse($response->isSuccessful()); $this->assertSame('9988775', $response->getTransactionReference()); $this->assertSame('The authorization is either fully settled or cancelled.', $response->getMessage()); } public function testPurchaseSuccess() { $this->setMockHttpResponse('PurchaseSuccess.txt'); $request = $this->gateway->purchase($this->purchaseOptions); $requestData = $request->getData(); /** @var $card CreditCard */ $card = $request->getCard(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccPurchase', $requestData['txnMode']); $this->assertSame('93401', (string) $sxml->billingDetails->zip); $this->assertSame('93401', $card->getPostcode()); $this->assertSame('test@example.com', $card->getEmail()); $this->assertTrue($response->isSuccessful()); $this->assertSame('244356120', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testPurchaseFailure() { $this->setMockHttpResponse('PurchaseFailure.txt'); $request = $this->gateway->purchase($this->purchaseOptions); $requestData = $request->getData(); /** @var $card CreditCard */ $card = $request->getCard(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccPurchase', $requestData['txnMode']); $this->assertSame('93401', (string) $sxml->billingDetails->zip); $this->assertSame('93401', $card->getPostcode()); $this->assertSame('test@example.com', $card->getEmail()); $this->assertFalse($response->isSuccessful()); $this->assertSame('244356120', $response->getTransactionReference()); $this->assertSame('You submitted an unsupported card type with your request.', $response->getMessage()); } public function testStoredDataPurchaseSuccess() { $this->setMockHttpResponse('StoredDataPurchaseSuccess.txt'); $request = $this->gateway->purchase($this->storedDataOptions); $requestData = $request->getData(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccStoredDataPurchase', $requestData['txnMode']); $this->assertSame('244530120', (string) $sxml->confirmationNumber); $this->assertTrue($response->isSuccessful()); $this->assertSame('244679250', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testStoredDataPurchaseFailure() { $this->setMockHttpResponse('StoredDataPurchaseFailure.txt'); $response = $this->gateway->purchase($this->storedDataOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame( 'You submitted an invalid XML request. Please verify your request and retry the transaction.', $response->getMessage() ); } public function testVoidSuccess() { $this->setMockHttpResponse('VoidSuccess.txt'); $request = $this->gateway->void($this->voidOptions); $requestData = $request->getData(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccAuthorizeReversal', $requestData['txnMode']); $this->assertSame('12345678', (string) $sxml->merchantAccount->accountNum); $this->assertSame('test', (string) $sxml->merchantAccount->storeID); $this->assertSame('test', (string) $sxml->merchantAccount->storePwd); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345678', $response->getTransactionReference()); $this->assertSame('No Error', $response->getMessage()); } public function testVoidFailure() { $this->setMockHttpResponse('VoidFailure.txt'); $request = $this->gateway->void($this->voidOptions); $requestData = $request->getData(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccAuthorizeReversal', $requestData['txnMode']); $this->assertSame('12345678', (string) $sxml->merchantAccount->accountNum); $this->assertSame('test', (string) $sxml->merchantAccount->storeID); $this->assertSame('test', (string) $sxml->merchantAccount->storePwd); $this->assertFalse($response->isSuccessful()); $this->assertSame('12345678', $response->getTransactionReference()); $this->assertSame('The confirmation number included in this request could not be found.', $response->getMessage()); } public function testCreateCard() { $this->setMockHttpResponse('CreateCard.txt'); $request = $this->gateway->createCard($this->purchaseOptions); $requestData = $request->getData(); /** @var $card CreditCard */ $card = $request->getCard(); $response = $request->send(); $sxml = new \SimpleXMLElement($requestData['txnRequest']); $this->assertSame('ccAuthorize', $requestData['txnMode']); $this->assertSame('93401', (string) $sxml->billingDetails->zip); $this->assertSame('VI', (string) $sxml->card->cardType); $this->assertTrue(isset($sxml->billingDetails)); $this->assertTrue(isset($sxml->shippingDetails)); $this->assertSame('1.00', (string) $sxml->amount); $this->assertSame('9966441', (string) $sxml->merchantRefNum); $this->assertSame('93401', $card->getPostcode()); $this->assertSame('test@example.com', $card->getEmail()); $this->assertTrue($response->isSuccessful()); $this->assertSame('244350540', $response->getCardReference()); $this->assertSame('No Error', $response->getMessage()); } } tests/Mock/PurchaseSuccess.txt 0000604 00000001574 15175450163 0012455 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:56:28 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244356120</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <authCode>246413</authCode> <avsResponse>X</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-17T08:18:43.646-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/CaptureFailure.txt 0000604 00000001665 15175450164 0012267 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:23:27 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 697 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>9988775</confirmationNumber> <decision>ERROR</decision> <code>3203</code> <actionCode>M</actionCode> <description>The authorization is either fully settled or cancelled.</description> <detail> <tag>InternalResponseCode</tag> <value>204</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>Authorization is either fully settled or canceled.</value> </detail> <txnTime>2013-04-17T08:02:48.092-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/VoidSuccess.txt 0000604 00000001476 15175450164 0011606 0 ustar 00 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: 683 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>12345678</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-17T08:39:38.347-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/StoredDataAuthorizeSuccess.txt 0000604 00000001574 15175450164 0014631 0 ustar 00 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: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244530120</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <authCode>107401</authCode> <avsResponse>X</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-22T05:27:48.472-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/AuthorizeFailure.txt 0000604 00000001702 15175450164 0012626 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:23:27 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 683 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.payments.com/creditcard/xmlschema/v1"> <confirmationNumber>-1</confirmationNumber> <decision>ERROR</decision> <code>1000</code> <description>Invalid txnMode: ccccAuthorize</description> <authCode>R</authCode> <avsResponse>U</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>14</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>invalid operation mode</value> </detail> <txnTime>2013-02-15T14:17:07.423-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/StoredDataPurchaseSuccess.txt 0000604 00000001574 15175450164 0014431 0 ustar 00 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: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244679250</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <authCode>117480</authCode> <avsResponse>S</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-25T06:52:55.757-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/AuthorizeSuccess.txt 0000604 00000001574 15175450164 0012656 0 ustar 00 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: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244350540</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <authCode>245904</authCode> <avsResponse>X</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-17T06:27:04.373-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/StoredDataPurchaseFailure.txt 0000604 00000001652 15175450164 0014405 0 ustar 00 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: 684 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>-1</confirmationNumber> <decision>ERROR</decision> <code>5023</code> <actionCode>M</actionCode> <description>You submitted an invalid XML request. Please verify your request and retry the transaction.</description> <detail> <tag>InternalResponseCode</tag> <value>24</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>xml error</value> </detail> <txnTime>2013-04-25T06:25:35.722-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/CreateCard.txt 0000604 00000001574 15175450164 0011350 0 ustar 00 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: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244350540</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <authCode>245904</authCode> <avsResponse>X</avsResponse> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-17T06:27:04.373-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/VoidFailure.txt 0000604 00000001702 15175450164 0011555 0 ustar 00 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: 683 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>12345678</confirmationNumber> <decision>ERROR</decision> <code>3500</code> <actionCode>M</actionCode> <description>The confirmation number included in this request could not be found.</description> <detail> <tag>InternalResponseCode</tag> <value>250</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>Authorization transaction not found for reversal.</value> </detail> <txnTime>2013-04-17T08:35:42.302-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/PurchaseFailure.txt 0000604 00000001624 15175450164 0012431 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:56:28 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 638 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244356120</confirmationNumber> <decision>ERROR</decision> <code>3001</code> <actionCode>C</actionCode> <description>You submitted an unsupported card type with your request.</description> <detail> <tag>InternalResponseCode</tag> <value>115</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>invalid brand</value> </detail> <txnTime>2013-04-17T08:23:22.009-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/CaptureSuccess.txt 0000604 00000001475 15175450164 0012307 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:56:28 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 577 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>9988775</confirmationNumber> <decision>ACCEPTED</decision> <code>0</code> <description>No Error</description> <detail> <tag>InternalResponseCode</tag> <value>0</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>no_error</value> </detail> <txnTime>2013-04-17T08:03:29.538-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> tests/Mock/StoredDataAuthorizeFailure.txt 0000604 00000003521 15175450164 0014602 0 ustar 00 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: 1618 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT <ccTxnResponseV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"> <confirmationNumber>244678250</confirmationNumber> <decision>ERROR</decision> <code>5023</code> <actionCode>M</actionCode> <description>You submitted an invalid XML request. Please verify your request and retry the transaction.</description> <detail> <tag>InternalResponseCode</tag> <value>24</value> </detail> <detail> <tag>SubErrorCode</tag> <value>0</value> </detail> <detail> <tag>InternalResponseDescription</tag> <value>xml error</value> </detail> <detail> <tag>ErrorDetail</tag> <value>Errors: Node: confirmationNumber, Detail: Expected element \'merchantRefNum@http://www.optimalpayments.com/creditcard/xmlschema/v1\' instead of \'confirmationNumber@http://www.optimalpayments.com/creditcard/xmlschema/v1\' here in element ccStoredDataRequestV1@http://www.optimalpayments.com/creditcard/xmlschema/v1 Node: amount, Detail: Expected element \'confirmationNumber@http://www.optimalpayments.com/creditcard/xmlschema/v1\' instead of \'amount@http://www.optimalpayments.com/creditcard/xmlschema/v1\' here in element ccStoredDataRequestV1@http://www.optimalpayments.com/creditcard/xmlschema/v1 Node: ccStoredDataRequestV1, Detail: Expected element \'confirmationNumber@http://www.optimalpayments.com/creditcard/xmlschema/v1\' before the end of the content in element ccStoredDataRequestV1@http://www.optimalpayments.com/creditcard/xmlschema/v1</value> </detail> <txnTime>2013-04-25T06:11:51.284-04:00</txnTime> <duplicateFound>false</duplicateFound> </ccTxnResponseV1> .gitignore 0000604 00000000060 15175450164 0006534 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml src/Message/CaptureRequest.php 0000604 00000003000 15175450164 0012401 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; /** * NetBanx Capture Request */ class CaptureRequest extends AbstractRequest { /** * Method * * @var string */ protected $txnMode = 'ccSettlement'; /** * Get data * * @return array */ public function getData() { $this->validate('amount', 'transactionReference'); $data = $this->getBaseData(); $data['txnRequest'] = $this->getXmlString(); return $data; } /** * Get XML string * * @return string */ protected function getXmlString() { $xml = '<?xml version="1.0" encoding="UTF-8"?> <ccPostAuthRequestV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.optimalpayments.com/creditcard/xmlschema/v1" />'; $sxml = new \SimpleXMLElement($xml); $merchantAccount = $sxml->addChild('merchantAccount'); $merchantAccount->addChild('accountNum', $this->getAccountNumber()); $merchantAccount->addChild('storeID', $this->getStoreId()); $merchantAccount->addChild('storePwd', $this->getStorePassword()); $sxml->addChild('confirmationNumber', $this->getTransactionReference()); $sxml->addChild('merchantRefNum', $this->getCustomerId()); $sxml->addChild('amount', $this->getAmount()); return $sxml->asXML(); } } src/Message/AbstractRequest.php 0000604 00000010023 15175450164 0012544 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; use Omnipay\Common\CreditCard; /** * NetBanx Abstract Request */ abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest { /** * Live EndPoint * * @var string */ protected $liveEndpoint = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'; /** * Developer EndPoint * * @var string */ protected $developerEndpoint = 'https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1'; /** * Setter for Account Number * * @param string $value * @return $this */ public function setAccountNumber($value) { return $this->setParameter('accountNumber', $value); } /** * Getter for Account Number * * @return string */ public function getAccountNumber() { return $this->getParameter('accountNumber'); } /** * Setter for Store ID * * @param string $value * @return $this */ public function setStoreId($value) { return $this->setParameter('storeId', $value); } /** * Getter for Store ID * * @return string */ public function getStoreId() { return $this->getParameter('storeId'); } /** * Setter for Store Password * * @param string $value * @return $this */ public function setStorePassword($value) { return $this->setParameter('storePassword', $value); } /** * Getter for Store Password * * @return string */ public function getStorePassword() { return $this->getParameter('storePassword'); } /** * Getter for customer ID * * @return string */ public function getCustomerId() { return $this->getParameter('customerId'); } /** * Setter for customr ID * * @param string $value * @return $this */ public function setCustomerId($value) { return $this->setParameter('customerId', $value); } /** * Send request * * @return \Omnipay\Common\Message\ResponseInterface|void */ public function sendData($data) { $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send(); return $this->response = new Response($this, $httpResponse->getBody()); } /** * Get End Point * * Depends on Test or Live environment * * @return string */ public function getEndpoint() { return $this->getTestMode() ? $this->developerEndpoint : $this->liveEndpoint; } /** * Get base data * * @return array */ protected function getBaseData() { $data = array(); $data['txnMode'] = $this->txnMode; return $data; } /** * Translate card type to internal NetBanx format * * @param string $brand * @return string */ protected function translateCardType($brand) { switch ($brand) { case CreditCard::BRAND_VISA: $cardType = 'VI'; break; case CreditCard::BRAND_AMEX: $cardType = 'AM'; break; case CreditCard::BRAND_DISCOVER: $cardType = 'DI'; break; case CreditCard::BRAND_MASTERCARD: $cardType = 'MC'; break; case CreditCard::BRAND_MAESTRO: $cardType = 'MD'; break; case CreditCard::BRAND_LASER: $cardType = 'LA'; break; case CreditCard::BRAND_SOLO: $cardType = 'SO'; break; case CreditCard::BRAND_JCB: $cardType = 'JC'; break; case CreditCard::BRAND_DINERS_CLUB: $cardType = 'DC'; break; default: $cardType = 'VI'; } return $cardType; } } src/Message/AuthorizeRequest.php 0000604 00000011643 15175450164 0012764 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; use Omnipay\Common\CreditCard; /** * NetBanx Authorize Request */ class AuthorizeRequest extends AbstractRequest { const MODE_AUTH = 'ccAuthorize'; const MODE_STORED_DATA_AUTH = 'ccStoredDataAuthorize'; /** * Method * * @var string */ protected $txnMode; /** * Get data * * @return array */ public function getData() { if ($this->getTransactionReference() || $this->getCardReference()) { $this->txnMode = $this->getStoredDataMode(); $this->validate('amount'); } else { $this->txnMode = $this->getBasicMode(); $this->validate('amount', 'card'); $this->getCard()->validate(); } $data = $this->getBaseData(); $data['txnRequest'] = $this->getXmlString(); return $data; } /** * Get XML string * * @return string */ protected function getXmlString() { if ($this->getTransactionReference() || $this->getCardReference()) { $xmlRoot = 'ccStoredDataRequestV1'; } else { $xmlRoot = 'ccAuthRequestV1'; } $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <{$xmlRoot} xmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\" />"; $sxml = new \SimpleXMLElement($xml); $merchantAccount = $sxml->addChild('merchantAccount'); $merchantAccount->addChild('accountNum', $this->getAccountNumber()); $merchantAccount->addChild('storeID', $this->getStoreId()); $merchantAccount->addChild('storePwd', $this->getStorePassword()); $sxml->addChild('merchantRefNum', $this->getCustomerId() ?: 'ref-num - ' . time()); if ($this->getTransactionReference() || $this->getCardReference()) { $sxml->addChild('confirmationNumber', $this->getTransactionReference() ?: $this->getCardReference()); $sxml->addChild('amount', $this->getAmount()); } else { /** @var $card CreditCard */ $card = $this->getCard(); $sxml->addChild('amount', $this->getAmount()); $cardChild = $sxml->addChild('card'); $cardChild->addChild('cardNum', $card->getNumber()); $cardExpiry = $cardChild->addChild('cardExpiry'); $cardExpiry->addChild('month', $card->getExpiryDate('m')); $cardExpiry->addChild('year', $card->getExpiryDate('Y')); $cardChild->addChild('cardType', $this->translateCardType($card->getBrand())); $cardChild->addChild('cvdIndicator', '1'); $cardChild->addChild('cvd', $card->getCvv()); $billingDetails = $sxml->addChild('billingDetails'); $billingDetails->addChild('cardPayMethod', 'WEB'); $billingDetails->addChild('firstName', $card->getBillingFirstName()); $billingDetails->addChild('lastName', $card->getBillingLastName()); $billingDetails->addChild('street', $card->getBillingAddress1()); $billingDetails->addChild('street2', $card->getBillingAddress2()); $billingDetails->addChild('city', $card->getBillingCity()); $billingDetails->addChild('state', $card->getBillingState()); $billingDetails->addChild('country', $card->getBillingCountry()); $billingDetails->addChild('zip', $card->getBillingPostcode()); $billingDetails->addChild('phone', $card->getBillingPhone()); $billingDetails->addChild('email', $card->getEmail()); $shippingDetails = $sxml->addChild('shippingDetails'); $shippingDetails->addChild('firstName', $card->getShippingFirstName()); $shippingDetails->addChild('lastName', $card->getShippingLastName()); $shippingDetails->addChild('street', $card->getShippingAddress1()); $shippingDetails->addChild('street2', $card->getShippingAddress2()); $shippingDetails->addChild('city', $card->getShippingCity()); $shippingDetails->addChild('state', $card->getShippingState()); $shippingDetails->addChild('country', $card->getShippingCountry()); $shippingDetails->addChild('zip', $card->getShippingPostcode()); $shippingDetails->addChild('phone', $card->getShippingPhone()); $shippingDetails->addChild('email', $card->getEmail()); } return $sxml->asXML(); } /** * Get Stored Data Mode * * @return string */ protected function getStoredDataMode() { return self::MODE_STORED_DATA_AUTH; } /** * Get Stored Data Mode * * @return string */ protected function getBasicMode() { return self::MODE_AUTH; } } src/Message/Response.php 0000604 00000003125 15175450164 0011233 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; use Omnipay\NetBanx\Gateway; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Exception\InvalidResponseException; /** * NetBanx Response */ class Response extends AbstractResponse { /** * Constructor * * @param RequestInterface $request * @param string $data * @throws InvalidResponseException */ public function __construct(RequestInterface $request, $data) { $this->request = $request; try { $this->data = new \SimpleXMLElement($data); } catch (\Exception $e) { throw new InvalidResponseException(); } } /** * Whether or not response is successful * * @return bool */ public function isSuccessful() { $decisionOk = Gateway::DECISION_ACCEPTED === (string) $this->data->decision; $codeOk = Gateway::CODE_OK === (string) $this->data->code; return $decisionOk && $codeOk; } /** * Get transaction reference * * @return string */ public function getTransactionReference() { return (string) $this->data->confirmationNumber; } /** * Get card reference * * @return string */ public function getCardReference() { return (string) $this->data->confirmationNumber; } /** * Get message from responce * * @return string */ public function getMessage() { return (string) $this->data->description; } } src/Message/VoidRequest.php 0000604 00000003004 15175450164 0011703 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; /** * NetBanx Void Request */ class VoidRequest extends AbstractRequest { /** * Method * * @var string */ protected $txnMode = 'ccAuthorizeReversal'; /** * Get data * * @return array */ public function getData() { $this->validate('transactionReference'); $data = $this->getBaseData(); $data['txnRequest'] = $this->getXmlString(); return $data; } /** * Get XML string * * @return string */ protected function getXmlString() { $xml = '<?xml version="1.0" encoding="UTF-8"?> <ccAuthReversalRequestV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.optimalpayments.com/creditcard/xmlschema/v1" />'; $sxml = new \SimpleXMLElement($xml); $merchantAccount = $sxml->addChild('merchantAccount'); $merchantAccount->addChild('accountNum', $this->getAccountNumber()); $merchantAccount->addChild('storeID', $this->getStoreId()); $merchantAccount->addChild('storePwd', $this->getStorePassword()); $sxml->addChild('confirmationNumber', $this->getTransactionReference()); $sxml->addChild('merchantRefNum', $this->getCustomerId()); $sxml->addChild('reversalAmount', $this->getAmount()); return $sxml->asXML(); } } src/Message/PurchaseRequest.php 0000604 00000000755 15175450164 0012566 0 ustar 00 <?php namespace Omnipay\NetBanx\Message; /** * NetBanx Purchase Request */ class PurchaseRequest extends AuthorizeRequest { const MODE_PURCHASE = 'ccPurchase'; const MODE_STORED_DATA_PURCHASE = 'ccStoredDataPurchase'; /** * @inheritdoc */ protected function getStoredDataMode() { return self::MODE_STORED_DATA_PURCHASE; } /** * @inheritdoc */ protected function getBasicMode() { return self::MODE_PURCHASE; } } src/Gateway.php 0000604 00000006573 15175450164 0007464 0 ustar 00 <?php namespace Omnipay\NetBanx; use Omnipay\Common\AbstractGateway; /** * NetBanx Class */ class Gateway extends AbstractGateway { const DECISION_ACCEPTED = 'ACCEPTED'; const CREATE_CARD_AMOUNT = '1.00'; const CODE_OK = '0'; /** * Get name of the gateway * * @return string */ public function getName() { return 'NetBanx'; } /** * Get default parameters * * @return array */ public function getDefaultParameters() { return array( 'accountNumber' => '', 'storeId' => '', 'storePassword' => '', 'testMode' => false, ); } /** * Authorize a new amount * * @param array $parameters * @return mixed */ public function authorize(array $parameters = array()) { return $this->createRequest('\Omnipay\NetBanx\Message\AuthorizeRequest', $parameters); } /** * Capture authorized amount * * @param array $parameters An array of options * @return \Omnipay\ResponseInterface */ public function capture(array $parameters = array()) { return $this->createRequest('\Omnipay\NetBanx\Message\CaptureRequest', $parameters); } /** * Create a new charge (combined authorize + capture). * * @param array An array of options * @return \Omnipay\ResponseInterface */ public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\NetBanx\Message\PurchaseRequest', $parameters); } /** * Void transaction * * @param array $parameters An array of options * @return \Omnipay\ResponseInterface */ public function void(array $parameters = array()) { return $this->createRequest('\Omnipay\NetBanx\Message\VoidRequest', $parameters); } /** * Create card * * @param array $parameters * @return mixed */ public function createCard(array $parameters = array()) { $parameters['amount'] = self::CREATE_CARD_AMOUNT; return $this->createRequest('\Omnipay\NetBanx\Message\AuthorizeRequest', $parameters); } /** * Setter for Account Number * * @param string $value * @return $this */ public function setAccountNumber($value) { return $this->setParameter('accountNumber', $value); } /** * Getter for Account Number * * @return string */ public function getAccountNumber() { return $this->getParameter('accountNumber'); } /** * Setter for Store ID * * @param string $value * @return $this */ public function setStoreId($value) { return $this->setParameter('storeId', $value); } /** * Getter for Store ID * * @return string */ public function getStoreId() { return $this->getParameter('storeId'); } /** * Setter for Store Password * * @param string $value * @return $this */ public function setStorePassword($value) { return $this->setParameter('storePassword', $value); } /** * Getter for Store Password * * @return string */ public function getStorePassword() { return $this->getParameter('storePassword'); } } .travis.yml 0000604 00000000317 15175450164 0006662 0 ustar 00 language: php php: - 5.3 - 5.4 - 5.5 - 5.6 - hhvm before_script: - composer install -n --dev --prefer-source script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text README.md 0000604 00000003517 15175450164 0006035 0 ustar 00 # Omnipay: NetBanx **NetBanx driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-netbanx) [](https://packagist.org/packages/omnipay/netbanx) [](https://packagist.org/packages/omnipay/netbanx) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements NetBanx support for Omnipay. ## Installation Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file: ```json { "require": { "omnipay/netbanx": "~2.0" } } ``` And run composer to update your dependencies: $ curl -s http://getcomposer.org/installer | php $ php composer.phar update ## Basic Usage The following gateways are provided by this package: * NetBanx For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository. ## Support If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found. If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to. If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/thephpleague/omnipay-netbanx/issues), or better yet, fork the library and submit a pull request. CONTRIBUTING.md 0000604 00000001040 15175450164 0006774 0 ustar 00 # Contributing Guidelines * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit just the modifications, do not mess with the composer.json or CHANGELOG.md files. * Ensure your code is nicely formatted in the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) style and that all tests pass. * Send the pull request. * Check that the Travis CI build passed. If not, rinse and repeat. phpunit.xml.dist 0000604 00000001512 15175450164 0007722 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false"> <testsuites> <testsuite name="Omnipay Test Suite"> <directory>./tests/</directory> </testsuite> </testsuites> <listeners> <listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" /> </listeners> <filter> <whitelist> <directory>./src</directory> </whitelist> </filter> </phpunit> composer.json 0000604 00000001644 15175450164 0007277 0 ustar 00 { "name": "omnipay/netbanx", "type": "library", "description": "NetBanx driver for the Omnipay payment processing library", "keywords": [ "gateway", "merchant", "netbanx", "omnipay", "pay", "payment" ], "homepage": "https://github.com/thephpleague/omnipay-netbanx", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-netbanx/contributors" } ], "autoload": { "psr-4": { "Omnipay\\NetBanx\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } LICENSE 0000604 00000002047 15175450164 0005560 0 ustar 00 Copyright (c) 2012-2013 Adrian Macneil Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings