File manager - Edit - /home/opticamezl/www/newok/authorizenet.tar
Back
.gitignore 0000604 00000000060 15173220405 0006523 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml README.md 0000604 00000003670 15173220405 0006024 0 ustar 00 # Omnipay: Authorize.Net **Authorize.Net driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-authorizenet) [](https://packagist.org/packages/omnipay/authorizenet) [](https://packagist.org/packages/omnipay/authorizenet) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Authorize.Net 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/authorizenet": "~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: * AuthorizeNet_AIM * AuthorizeNet_SIM * AuthorizeNet_DPM 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-authorizenet/issues), or better yet, fork the library and submit a pull request. tests/DPMGatewayTest.php 0000604 00000007170 15173220405 0011221 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; use Omnipay\Tests\GatewayTestCase; //use Omnipay\AuthorizeNet\SIMGatewayTest; class DPMGatewayTest extends GatewayTestCase //SIMGatewayTest { public function setUp() { parent::setUp(); $this->gateway = new DPMGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setApiLoginId('example'); $this->gateway->setTransactionKey('keykey'); $this->gateway->setHashSecret('elpmaxe'); $this->options = array( 'amount' => '10.00', 'transactionId' => '99', 'returnUrl' => 'https://www.example.com/return', ); } public function testAuthorize() { $response = $this->gateway->authorize($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } /** * The MD4 Hash consists of the shared secret, the login ID, the transaction *reference* (as * generated on the remote gateway for the transaction) and the amount. */ public function testCompleteAuthorize() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '10.00'), ) ); $response = $this->gateway->completeAuthorize($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } /** * @expectedException Omnipay\Common\Exception\InvalidRequestException * @expectedExceptionMessage Incorrect amount * * The hash is correct, so the sender knows the shared secret, but the amount * is not what we expected, i.e. what we had requested to be authorized. */ public function testCompleteAuthorizeWrongAmount() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '20.00', 'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '20.00'), ) ); $response = $this->gateway->completeAuthorize($this->options)->send(); } public function testPurchase() { $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } public function testCompletePurchase() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '10.00'), ) ); $response = $this->gateway->completePurchase($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } } tests/SIMGatewayTest.php 0000604 00000005132 15173220405 0011225 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; use Omnipay\Tests\GatewayTestCase; class SIMGatewayTest extends GatewayTestCase { public function setUp() { parent::setUp(); $this->gateway = new SIMGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setApiLoginId('example'); $this->gateway->setHashSecret('elpmaxe'); $this->options = array( 'amount' => '10.00', 'transactionId' => '99', 'returnUrl' => 'https://www.example.com/return', ); } public function testAuthorize() { $response = $this->gateway->authorize($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } public function testCompleteAuthorize() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '10.00'), ) ); $response = $this->gateway->completeAuthorize($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } public function testPurchase() { $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } public function testCompletePurchase() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '10.00'), ) ); $response = $this->gateway->completePurchase($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } } tests/Mock/AIMPurchaseSuccess.txt 0000604 00000001131 15173220405 0012761 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:00:03 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 347 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |1|,|1|,|1|,|This transaction has been approved.|,|JE6JM1|,|Y|,|2184492509|,|12345|,|first purchase|,|1.00|,|CC|,|auth_capture|,||,|fds|,|fds|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|35951A3F0A91940575132EA09CA1DC31|,|P|,|2|,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/AIMVoidFailure.txt 0000604 00000001063 15173220405 0012073 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:00:47 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 309 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |3|,|2|,|33|,|A valid referenced transaction ID is required.|,||,|P|,|0|,||,||,|0.00|,|CC|,|void|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|554B8CA3AE27C6104986860760858E83|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/AIMCaptureFailure.txt 0000604 00000001047 15173220405 0012577 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:58:47 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 297 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |3|,|2|,|16|,|The transaction cannot be found.|,||,|P|,|0|,||,||,|2.00|,|CC|,|prior_auth_capture|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|7432D28FA29C86EFEDBFD80C4767CD8C|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/DPMAuthorizeSuccess.txt 0000604 00000002014 15173220405 0013174 0 ustar 00 HTTP/1.1 200 OK CACHE-CONTROL: no-cache CONNECTION: close PRAGMA: no-cache CONTENT-TYPE: application/x-www-form-urlencoded ACCEPT: */* CONTENT-LENGTH: 877 HOST: example.com x_response_code=1&x_response_reason_code=1&x_response_reason_text=%28TESTMODE%29+This+transaction+has+been+approved%2E&x_avs_code=P&x_auth_code=000000&x_trans_id=2184493132&x_method=CC&x_card_type=Visa&x_account_number=XXXX4242&x_first_name=Joe&x_last_name=Bloggs&x_company=&x_address=88+Address+2&x_city=City&x_state=State&x_zip=412&x_country=GB&x_phone=01234+567+890&x_fax=&x_email=jason%40academe%2Eco%2Euk&x_invoice_num=975077375&x_description=&x_type=auth%5Fonly&x_cust_id=CUST123&x_ship_to_first_name=Joe&x_ship_to_last_name=Bloggs&x_ship_to_company=&x_ship_to_address=99+Address+2S&x_ship_to_city=CityS&x_ship_to_state=StateS&x_ship_to_zip=412S&x_ship_to_country=GB&x_amount=10%2E00&x_tax=0%2E00&x_duty=0%2E00&x_freight=0%2E00&x_tax_exempt=FALSE&x_po_num=&x_MD5_Hash=480AA04BE6E4BF0469B63D9E42BD568A&x_cvv2_resp_code=&x_cavv_response=&x_test_request=true tests/Mock/AIMRefundFailure.txt 0000604 00000001043 15173220405 0012413 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 18 Jan 2015 04:25:47 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 307 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |3|,|1|,|6|,|The credit card number is invalid.|,||,|P|,|0|,||,||,|12.00|,|CC|,|credit|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|A391717AA20018B2BCED3118EB0415C3|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX7898|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,| tests/Mock/AIMAuthorizeSuccess.txt 0000604 00000001134 15173220405 0013164 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: 350 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |1|,|1|,|1|,|This transaction has been approved.|,|GA4OQP|,|Y|,|2184493132|,|12345|,|first purchase|,|2.00|,|CC|,|auth_only|,||,|fjkdsl|,|fdjskl|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|50D842FB596025E1C7779440D0A62496|,|P|,|2|,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/AIMRefundSuccess.txt 0000604 00000001061 15173220405 0012434 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 18 Jan 2015 04:00:47 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 307 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |1|,|1|,|1|,|This transaction has been approved.|,||,|P|,|2184492509|,||,||,|12.00|,|CC|,|credit|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|7ECF5CE3C94D33E55BB9D08EFFACEC21|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,| tests/Mock/AIMAuthorizeFailure.txt 0000604 00000001104 15173220405 0013140 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: 326 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |3|,|1|,|5|,|A valid amount is required.|,||,|P|,|0|,|12345|,|first purchase|,|-0.01|,|CC|,|auth_only|,||,|fjkdsl|,|fdjskl|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|3EB992D927587B9FC7A3D83F651CD7EF|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/AIMPurchaseFailure.txt 0000604 00000001101 15173220405 0012735 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:00:47 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 323 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |3|,|1|,|5|,|A valid amount is required.|,||,|P|,|0|,|12345|,|first purchase|,|-0.01|,|CC|,|auth_capture|,||,|fds|,|fds|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|3EB992D927587B9FC7A3D83F651CD7EF|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/AIMVoidSuccess.txt 0000604 00000001061 15173220405 0012112 0 ustar 00 HTTP/1.1 200 OK Connection: close Date: Sat, 16 Feb 2013 04:00:03 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/html Content-Length: 307 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |1|,|1|,|310|,|This transaction has already been voided.|,||,|P|,|0|,||,||,|0.00|,|CC|,|void|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|554B8CA3AE27C6104986860760858E83|,|P|,|2|,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Mock/DPMAuthorizeFailure.txt 0000604 00000001571 15173220405 0013162 0 ustar 00 HTTP/1.1 200 OK CACHE-CONTROL: no-cache CONNECTION: close PRAGMA: no-cache CONTENT-TYPE: application/x-www-form-urlencoded ACCEPT: */* CONTENT-LENGTH: 739 HOST: example.com x_response_code=3&x_response_reason_code=98&x_response_reason_text=%28TESTMODE%29+This+transaction+cannot+be+accepted%2E&x_avs_code=P&x_auth_code=000000&x_trans_id=0&x_method=CC&x_card_type=&x_account_number=&x_first_name=&x_last_name=&x_company=&x_address=&x_city=&x_state=&x_zip=&x_country=&x_phone=&x_fax=&x_email=&x_invoice_num=&x_description=&x_type=auth%5Fonly&x_cust_id=&x_ship_to_first_name=&x_ship_to_last_name=&x_ship_to_company=&x_ship_to_address=&x_ship_to_city=&x_ship_to_state=&x_ship_to_zip=&x_ship_to_country=&x_amount=10%2E00&x_tax=0%2E00&x_duty=0%2E00&x_freight=0%2E00&x_tax_exempt=FALSE&x_po_num=&x_MD5_Hash=480AA04BE6E4BF0469B63D9E42BD568A&x_cvv2_resp_code=&x_cavv_response=&x_test_request=true tests/Mock/AIMCaptureSuccess.txt 0000604 00000001104 15173220405 0012612 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: 326 Cache-Control: private, must-revalidate, max-age=0 Expires: Tue, 01 Jan 1980 00:00:00 GMT |1|,|1|,|1|,|This transaction has been approved.|,|F51OYG|,|P|,|2184494531|,||,||,|2.00|,|CC|,|prior_auth_capture|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|7B7038AB4FA82268A512E6B2F571853A|,||,||,||,||,||,||,||,||,||,||,||,||,|XXXX1111|,|Visa|,||,||,||,||,||,||,||,||,||,||,||,||,||,||,||,|| tests/Message/DPMAuthorizeRequestTest.php 0000604 00000005142 15173220405 0014524 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class DPMAuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new DPMAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'clientIp' => '10.0.0.1', 'amount' => '12.00', 'returnUrl' => 'https://www.example.com/return', 'liveEndpoint' => 'https://secure.authorize.net/gateway/transact.dll', 'developerEndpoint' => 'https://test.authorize.net/gateway/transact.dll', ) ); } public function testGetData() { $data = $this->request->getData(); $this->assertSame('AUTH_ONLY', $data['x_type']); $this->assertArrayNotHasKey('x_show_form', $data); $this->assertArrayNotHasKey('x_test_request', $data); } public function testGetDataTestMode() { $this->request->setTestMode(true); $data = $this->request->getData(); $this->assertSame('TRUE', $data['x_test_request']); } public function testGetHash() { $this->request->setApiLoginId('user'); $this->request->setTransactionKey('key'); $data = array( 'x_fp_sequence' => 'a', 'x_fp_timestamp' => 'b', 'x_amount' => 'c', ); $expected = hash_hmac('md5', 'user^a^b^c^', 'key'); $this->assertSame($expected, $this->request->getHash($data)); } public function testSend() { $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $this->assertSame('POST', $response->getRedirectMethod()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } // Issue #16 Support notifyUrl public function testSendNotifyUrl() { $this->request->setReturnUrl(null); $this->request->setNotifyUrl('https://www.example.com/return'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $this->assertSame('POST', $response->getRedirectMethod()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } } tests/Message/DPMCompleteRequestTest.php 0000604 00000006520 15173220405 0014323 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * The CompleteRequest object is invoked in the callback handler. */ use Omnipay\Tests\TestCase; class DPMCompleteAuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new DPMCompleteRequest($this->getHttpClient(), $this->getHttpRequest()); } /** * @expectedException \Omnipay\Common\Exception\InvalidRequestException * @expectedExceptionMessage Incorrect hash */ public function testGetDataInvalid() { $this->getHttpRequest()->request->replace(array('x_MD5_Hash' => 'invalid')); $this->request->getData(); } public function testGetHash() { $this->assertSame(md5(''), $this->request->getHash('', '')); $this->request->setHashSecret('hashsec'); $this->request->setApiLoginId('apilogin'); $this->assertSame(md5('hashsec' . 'apilogin' . 'trnid' . '10.00'), $this->request->getHash('trnid', '10.00')); } public function testSend() { // The hash contains no data supplied by the merchant site, apart // from the secret. This is the first point at which we see the transaction // reference (x_trans_id), and this hash is to validate that the reference and // the amount have not be tampered with en-route. $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => strtolower(md5('shhh' . 'user' . '12345' . '10.00')), 'omnipay_transaction_id' => '99', ) ); $this->request->setApiLoginId('user'); $this->request->setHashSecret('shhh'); $this->request->setAmount('10.00'); $this->request->setReturnUrl('http://example.com/'); // Issue #22 Transaction ID in request is picked up from custom field. $this->assertSame('99', $this->request->getTransactionId()); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertSame(true, $response->isRedirect()); // CHECKME: does it matter what letter case the method is? $this->assertSame('GET', $response->getRedirectMethod()); $this->assertSame('http://example.com/', $response->getRedirectUrl()); $this->assertNull($response->getMessage()); } /** * @expectedException \Omnipay\Common\Exception\InvalidRequestException * @expectedExceptionMessage Incorrect amount */ public function testSendWrongAmount() { $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => '12345', 'x_amount' => '10.00', 'x_MD5_Hash' => strtolower(md5('shhh' . 'user' . '12345' . '10.00')), ) ); $this->request->setApiLoginId('user'); $this->request->setHashSecret('shhh'); // In the notify, the merchant application sets the amount that // was expected to be authorised. We expected 20.00 but are being // told it was 10.00. $this->request->setAmount('20.00'); $response = $this->request->send(); } } tests/Message/SIMCompleteAuthorizeResponseTest.php 0000604 00000001565 15173220405 0016400 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class SIMCompleteAuthorizeResponseTest extends TestCase { public function testSuccess() { $response = new SIMCompleteAuthorizeResponse($this->getMockRequest(), array('x_response_code' => '1', 'x_trans_id' => '12345')); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } public function testFailure() { $response = new SIMCompleteAuthorizeResponse($this->getMockRequest(), array('x_response_code' => '0', 'x_response_reason_text' => 'Declined')); $this->assertFalse($response->isSuccessful()); $this->assertNull($response->getTransactionReference()); $this->assertSame('Declined', $response->getMessage()); } } tests/Message/SIMAuthorizeRequestTest.php 0000604 00000005150 15173220405 0014533 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class SIMAuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new SIMAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'clientIp' => '10.0.0.1', 'amount' => '12.00', 'returnUrl' => 'https://www.example.com/return', 'liveEndpoint' => 'https://secure.authorize.net/gateway/transact.dll', 'developerEndpoint' => 'https://test.authorize.net/gateway/transact.dll', ) ); } public function testGetData() { $data = $this->request->getData(); $this->assertSame('AUTH_ONLY', $data['x_type']); $this->assertSame('PAYMENT_FORM', $data['x_show_form']); $this->assertArrayNotHasKey('x_test_request', $data); } public function testGetDataTestMode() { $this->request->setTestMode(true); $data = $this->request->getData(); $this->assertSame('TRUE', $data['x_test_request']); } public function testGetHash() { $this->request->setApiLoginId('user'); $this->request->setTransactionKey('key'); $data = array( 'x_fp_sequence' => 'a', 'x_fp_timestamp' => 'b', 'x_amount' => 'c', ); $expected = hash_hmac('md5', 'user^a^b^c^', 'key'); $this->assertSame($expected, $this->request->getHash($data)); } public function testSend() { $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $this->assertSame('POST', $response->getRedirectMethod()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } // Issue #16 Support notifyUrl. public function testSendNoifyUrl() { $this->request->setReturnUrl(null); $this->request->setNotifyUrl('https://www.example.com/return'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $this->assertSame('POST', $response->getRedirectMethod()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } } tests/Message/DPMPurchaseRequestTest.php 0000604 00000005151 15173220405 0014324 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class DPMPurchaseRequestTest extends TestCase { public function setUp() { // The card for DPM will always start out blank, so remove the card details. $validCard = array_merge( $this->getValidCard(), array( 'number' => '', 'expiryMonth' => '', 'expiryYear' => '', 'cvv' => '', ) ); $this->request = new DPMPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'clientIp' => '10.0.0.1', 'amount' => '12.00', 'customerId' => 'cust-id', 'card' => $validCard, 'returnUrl' => 'https://www.example.com/return', 'liveEndpoint' => 'https://secure.authorize.net/gateway/transact.dll', 'developerEndpoint' => 'https://test.authorize.net/gateway/transact.dll', ) ); } public function testGetData() { $data = $this->request->getData(); $this->assertSame('AUTH_CAPTURE', $data['x_type']); $this->assertSame('10.0.0.1', $data['x_customer_ip']); $this->assertSame('cust-id', $data['x_cust_id']); $this->assertSame('', $data['x_card_num']); $this->assertSame('', $data['x_exp_date']); $this->assertSame('', $data['x_card_code']); $this->assertArrayNotHasKey('x_test_request', $data); } public function testGetDataTestMode() { $this->request->setTestMode(true); $data = $this->request->getData(); $this->assertSame('TRUE', $data['x_test_request']); } public function testGetHash() { $this->request->setApiLoginId('user'); $this->request->setTransactionKey('key'); $data = array( 'x_fp_sequence' => 'a', 'x_fp_timestamp' => 'b', 'x_amount' => 'c', ); $expected = hash_hmac('md5', 'user^a^b^c^', 'key'); $this->assertSame($expected, $this->request->getHash($data)); } public function testSend() { $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $this->assertSame('POST', $response->getRedirectMethod()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']); } } tests/Message/AIMRefundRequestTest.php 0000604 00000002541 15173220405 0013763 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class AIMRefundRequestTest extends TestCase { public function setUp() { $this->request = new AIMRefundRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'amount' => '12.00', 'transactionReference' => '60O2UZ', 'currency' => 'USD', 'card' => $this->getValidCard(), ) ); } public function testGetData() { $data = $this->request->getData(); $card = $this->getValidCard(); $this->assertSame('CREDIT', $data['x_type']); $this->assertSame('60O2UZ', $data['x_trans_id']); $this->assertSame($card['number'], $data['x_card_num']); $this->assertSame('12.00', $data['x_amount']); $this->assertArrayHasKey('x_exp_date', $data); } public function testRefundWithSimplifiedCard() { $simplifiedCard = array( 'firstName' => 'Example', 'lastName' => 'User', 'number' => '1111', ); $this->request->setCard($simplifiedCard); $data = $this->request->getData(); $this->assertSame($simplifiedCard['number'], $data['x_card_num']); $this->assertArrayNotHasKey('x_exp_date', $data); } } tests/Message/AIMAuthorizeRequestTest.php 0000604 00000002034 15173220405 0014507 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class AIMAuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new AIMAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'clientIp' => '10.0.0.1', 'amount' => '12.00', 'customerId' => 'cust-id', 'card' => $this->getValidCard(), ) ); } public function testGetData() { $data = $this->request->getData(); $this->assertSame('AUTH_ONLY', $data['x_type']); $this->assertSame('10.0.0.1', $data['x_customer_ip']); $this->assertSame('cust-id', $data['x_cust_id']); $this->assertArrayNotHasKey('x_test_request', $data); } public function testGetDataTestMode() { $this->request->setTestMode(true); $data = $this->request->getData(); $this->assertSame('TRUE', $data['x_test_request']); } } tests/Message/AIMResponseTest.php 0000604 00000013071 15173220405 0012765 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class AIMResponseTest extends TestCase { /** * @expectedException Omnipay\Common\Exception\InvalidResponseException */ public function testConstructEmpty() { $response = new AIMResponse($this->getMockRequest(), ''); } public function testAuthorizeSuccess() { $httpResponse = $this->getMockHttpResponse('AIMAuthorizeSuccess.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184493132', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); $this->assertSame('1', $response->getCode()); $this->assertSame('1', $response->getReasonCode()); $this->assertSame('GA4OQP', $response->getAuthorizationCode()); $this->assertSame('Y', $response->getAVSCode()); } public function testAuthorizeFailure() { $httpResponse = $this->getMockHttpResponse('AIMAuthorizeFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); $this->assertSame('3', $response->getCode()); $this->assertSame('5', $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); } public function testCaptureSuccess() { $httpResponse = $this->getMockHttpResponse('AIMCaptureSuccess.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184494531', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); $this->assertSame('1', $response->getCode()); $this->assertSame('1', $response->getReasonCode()); $this->assertSame('F51OYG', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); } public function testCaptureFailure() { $httpResponse = $this->getMockHttpResponse('AIMCaptureFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('The transaction cannot be found.', $response->getMessage()); $this->assertSame('3', $response->getCode()); $this->assertSame('16', $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); } public function testPurchaseSuccess() { $httpResponse = $this->getMockHttpResponse('AIMPurchaseSuccess.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184492509', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); $this->assertSame('1', $response->getCode()); $this->assertSame('1', $response->getReasonCode()); $this->assertSame('JE6JM1', $response->getAuthorizationCode()); $this->assertSame('Y', $response->getAVSCode()); } public function testPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('AIMPurchaseFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); $this->assertSame('3', $response->getCode()); $this->assertSame('5', $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); } public function testRefundSuccess() { $httpResponse = $this->getMockHttpResponse('AIMRefundSuccess.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184492509', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); $this->assertSame('1', $response->getCode()); $this->assertSame('1', $response->getReasonCode()); $this->assertSame('P', $response->getAVSCode()); } public function testRefundFailure() { $httpResponse = $this->getMockHttpResponse('AIMRefundFailure.txt'); $response = new AIMResponse($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('The credit card number is invalid.', $response->getMessage()); $this->assertSame('3', $response->getCode()); $this->assertSame('6', $response->getReasonCode()); $this->assertSame('', $response->getAuthorizationCode()); $this->assertSame('P', $response->getAVSCode()); } } tests/Message/SIMCompleteAuthorizeRequestTest.php 0000604 00000004452 15173220405 0016230 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class SIMCompleteAuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new SIMCompleteAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest()); } /** * @expectedException \Omnipay\Common\Exception\InvalidRequestException * @expectedExceptionMessage Incorrect hash */ public function testGetDataInvalid() { $this->getHttpRequest()->request->replace(array('x_MD5_Hash' => 'invalid')); $this->request->getData(); } public function testGetHash() { $this->assertSame(md5(''), $this->request->getHash('', '')); $this->request->setHashSecret('hashsec'); $this->request->setApiLoginId('apilogin'); $this->assertSame(md5('hashsec' . 'apilogin' . 'trnref ' . '10.00'), $this->request->getHash('trnref ', '10.00')); } public function testSend() { $posted_trans_id = '12345'; // transactionReference in POST. $posted_amount = '10.00'; // amount authothorised in POST. $this->getHttpRequest()->request->replace( array( 'x_response_code' => '1', 'x_trans_id' => $posted_trans_id, 'x_amount' => $posted_amount, 'x_MD5_Hash' => md5('shhh' . 'user' . $posted_trans_id . $posted_amount), 'omnipay_transaction_id' => '99', ) ); $this->request->setApiLoginId('user'); $this->request->setHashSecret('shhh'); $this->request->setAmount('10.00'); $this->request->setReturnUrl('http://example.com/'); // Issue #22 Transaction ID in request is picked up from custom field. $this->assertSame('99', $this->request->getTransactionId()); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame($posted_trans_id, $response->getTransactionReference()); $this->assertSame(true, $response->isRedirect()); // CHECKME: does it matter what letter case the method is? $this->assertSame('GET', $response->getRedirectMethod()); $this->assertSame('http://example.com/', $response->getRedirectUrl()); $this->assertNull($response->getMessage()); } } tests/Message/AIMPurchaseRequestTest.php 0000604 00000001522 15173220405 0014310 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class AIMPurchaseRequestTest extends TestCase { public function setUp() { $this->request = new AIMPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'clientIp' => '10.0.0.1', 'amount' => '12.00', 'customerId' => 'cust-id', 'card' => $this->getValidCard(), ) ); } public function testGetData() { $data = $this->request->getData(); $this->assertSame('AUTH_CAPTURE', $data['x_type']); $this->assertSame('10.0.0.1', $data['x_customer_ip']); $this->assertSame('cust-id', $data['x_cust_id']); $this->assertArrayNotHasKey('x_test_request', $data); } } tests/Message/DPMCompleteResponseTest.php 0000604 00000001531 15173220405 0014466 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Tests\TestCase; class DPMompleteResponseTest extends TestCase { public function testSuccess() { $response = new DPMCompleteResponse($this->getMockRequest(), array('x_response_code' => '1', 'x_trans_id' => '12345')); $this->assertTrue($response->isSuccessful()); $this->assertSame('12345', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } public function testFailure() { $response = new DPMCompleteResponse($this->getMockRequest(), array('x_response_code' => '0', 'x_response_reason_text' => 'Declined')); $this->assertFalse($response->isSuccessful()); $this->assertNull($response->getTransactionReference()); $this->assertSame('Declined', $response->getMessage()); } } tests/AIMGatewayTest.php 0000604 00000007566 15173220405 0011220 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; use Omnipay\Tests\GatewayTestCase; class AIMGatewayTest extends GatewayTestCase { protected $voidOptions; public function setUp() { parent::setUp(); $this->gateway = new AIMGateway($this->getHttpClient(), $this->getHttpRequest()); $this->purchaseOptions = array( 'amount' => '10.00', 'card' => $this->getValidCard(), ); $this->captureOptions = array( 'amount' => '10.00', 'transactionReference' => '12345', ); $this->voidOptions = array( 'transactionReference' => '12345', ); } public function testAuthorizeSuccess() { $this->setMockHttpResponse('AIMAuthorizeSuccess.txt'); $response = $this->gateway->authorize($this->purchaseOptions)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184493132', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); } public function testAuthorizeFailure() { $this->setMockHttpResponse('AIMAuthorizeFailure.txt'); $response = $this->gateway->authorize($this->purchaseOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); } public function testCaptureSuccess() { $this->setMockHttpResponse('AIMCaptureSuccess.txt'); $response = $this->gateway->capture($this->captureOptions)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184494531', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); } public function testCaptureFailure() { $this->setMockHttpResponse('AIMCaptureFailure.txt'); $response = $this->gateway->capture($this->captureOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('The transaction cannot be found.', $response->getMessage()); } public function testPurchaseSuccess() { $this->setMockHttpResponse('AIMPurchaseSuccess.txt'); $response = $this->gateway->purchase($this->purchaseOptions)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('2184492509', $response->getTransactionReference()); $this->assertSame('This transaction has been approved.', $response->getMessage()); } public function testPurchaseFailure() { $this->setMockHttpResponse('AIMPurchaseFailure.txt'); $response = $this->gateway->purchase($this->purchaseOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid amount is required.', $response->getMessage()); } public function testVoidSuccess() { $this->setMockHttpResponse('AIMVoidSuccess.txt'); $response = $this->gateway->void($this->voidOptions)->send(); $this->assertTrue($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('This transaction has already been voided.', $response->getMessage()); } public function testVoidFailure() { $this->setMockHttpResponse('AIMVoidFailure.txt'); $response = $this->gateway->void($this->voidOptions)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('0', $response->getTransactionReference()); $this->assertSame('A valid referenced transaction ID is required.', $response->getMessage()); } } src/SIMGateway.php 0000604 00000002350 15173220405 0010011 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; /** * Authorize.Net SIM Class */ class SIMGateway extends AIMGateway { public function getName() { return 'Authorize.Net SIM'; } public function getDefaultParameters() { $parameters = parent::getDefaultParameters(); $parameters['hashSecret'] = ''; return $parameters; } public function getHashSecret() { return $this->getParameter('hashSecret'); } public function setHashSecret($value) { return $this->setParameter('hashSecret', $value); } public function authorize(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\SIMAuthorizeRequest', $parameters); } public function completeAuthorize(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\SIMCompleteAuthorizeRequest', $parameters); } public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\SIMPurchaseRequest', $parameters); } public function completePurchase(array $parameters = array()) { return $this->completeAuthorize($parameters); } } src/DPMGateway.php 0000604 00000002346 15173220405 0010006 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; /** * Authorize.Net DPM (Direct Post Method) Class */ class DPMGateway extends SIMGateway { public function getName() { return 'Authorize.Net DPM'; } /** * Helper to generate the authorize direct-post form. */ public function authorize(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\DPMAuthorizeRequest', $parameters); } /** * Get, validate, interpret and respond to the Authorize.Net callback. */ public function completeAuthorize(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\DPMCompleteRequest', $parameters); } /** * Helper to generate the purchase direct-post form. */ public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\DPMPurchaseRequest', $parameters); } /** * Get, validate, interpret and respond to the Authorize.Net callback. */ public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\DPMCompleteRequest', $parameters); } } src/Message/SIMPurchaseRequest.php 0000604 00000000277 15173220405 0013125 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net SIM Purchase Request */ class SIMPurchaseRequest extends SIMAuthorizeRequest { protected $action = 'AUTH_CAPTURE'; } src/Message/CaptureRequest.php 0000604 00000000714 15173220405 0012401 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net Capture Request */ class CaptureRequest extends AbstractRequest { protected $action = 'PRIOR_AUTH_CAPTURE'; public function getData() { $this->validate('amount', 'transactionReference'); $data = $this->getBaseData(); $data['x_amount'] = $this->getAmount(); $data['x_trans_id'] = $this->getTransactionReference(); return $data; } } src/Message/DPMResponse.php 0000604 00000007176 15173220405 0011575 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Message\RedirectResponseInterface; /** * Authorize.Net DPM Authorize and Purchase Response * We want the application to present a POST form to the user. This object will * provide the helper methods for doing so. */ class DPMResponse extends AbstractResponse implements RedirectResponseInterface { protected $postUrl; /** * These will be hidden fields in the direct-post form. * Not all are required */ protected $hiddenFields = array( // Merchant 'x_login', // Fingerprint 'x_fp_hash', 'x_fp_sequence', 'x_fp_timestamp', // Transaction 'x_type', 'x_version', 'x_method', // Payment 'x_amount', 'x_currency_code', 'x_tax', 'x_freight', 'x_duty', 'x_tax_exempt', // Relay response 'x_relay_response', 'x_relay_url', 'x_relay_always', 'x_cancel_url', // AFDS 'x_customer_ip', // Testing 'x_test_request', 'x_invoice_num', 'x_description', 'x_cust_id', 'x_email_customer', 'x_delim_data', // Custom omnipay field. 'omnipay_transaction_id', ); /** * Maps OmniPay field names to Authorize.Net field names. */ protected $fieldMapping = array( ); public function __construct(RequestInterface $request, $data, $postUrl) { $this->request = $request; $this->data = $data; $this->postUrl = $postUrl; } /** * Return false to indicate that more action is needed to complete * the transaction, a transparent redirect form in this case. */ public function isSuccessful() { return false; } /** * This is a transparent redirect transaction type, where a local form * will POST direct to the remote gateway. */ public function isTransparentRedirect() { return true; } public function isRedirect() { return true; } // Helpers to build the form. /** * The URL the form will POST to. */ public function getRedirectUrl() { return $this->postUrl; } public function getRedirectMethod() { return 'POST'; } /** * Data that must be included as hidden fields. */ public function getRedirectData() { return array_intersect_key($this->getData(), array_flip($this->hiddenFields)); } /** * Move a field to the list of hidden form fields. * The hidden fields are those we don't want to show the user, but * must still be posted. */ public function hideField($field_name) { if (!in_array($field_name, $this->hiddenFields)) { $this->hiddenFields[] = $field_name; } } /** * Remove a field from the list of hidden fields. */ public function unhideField($field_name) { if (($key = array_search($field_name, $this->hiddenFields)) !== false) { unset($this->hiddenFields[$key]); } } /** * Data not in the hidden fields list. * These are not all mandatory, so you do not have to present all these * to the user. You may also have custom fields you want to post, such * as the merchant transactionId (if not using invoiceId for this purpose). */ public function getVisibleData() { return array_diff_key($this->getData(), array_flip($this->hiddenFields)); } } src/Message/AbstractRequest.php 0000604 00000011373 15173220405 0012544 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net Abstract Request */ use Omnipay\Common\Message\AbstractRequest as CommonAbstractRequest; abstract class AbstractRequest extends CommonAbstractRequest { /** * Custom field name to send the transaction ID to the notify handler. */ const TRANSACTION_ID_PARAM = 'omnipay_transaction_id'; public function getApiLoginId() { return $this->getParameter('apiLoginId'); } public function setApiLoginId($value) { return $this->setParameter('apiLoginId', $value); } public function getTransactionKey() { return $this->getParameter('transactionKey'); } public function setTransactionKey($value) { return $this->setParameter('transactionKey', $value); } public function getDeveloperMode() { return $this->getParameter('developerMode'); } public function setDeveloperMode($value) { return $this->setParameter('developerMode', $value); } public function getCustomerId() { return $this->getParameter('customerId'); } public function setCustomerId($value) { return $this->setParameter('customerId', $value); } public function getHashSecret() { return $this->getParameter('hashSecret'); } public function setHashSecret($value) { return $this->setParameter('hashSecret', $value); } public function getLiveEndpoint() { return $this->getParameter('liveEndpoint'); } public function setLiveEndpoint($value) { return $this->setParameter('liveEndpoint', $value); } public function setDeveloperEndpoint($value) { return $this->setParameter('developerEndpoint', $value); } public function getDeveloperEndpoint() { return $this->getParameter('developerEndpoint'); } /** * Base data used only for the AIM API. */ protected function getBaseData() { $data = array(); $data['x_login'] = $this->getApiLoginId(); $data['x_tran_key'] = $this->getTransactionKey(); $data['x_type'] = $this->action; $data['x_version'] = '3.1'; $data['x_delim_data'] = 'TRUE'; $data['x_delim_char'] = ','; $data['x_encap_char'] = '|'; $data['x_relay_response'] = 'FALSE'; return $data; } protected function getBillingData() { $data = array(); $data['x_amount'] = $this->getAmount(); // This is deprecated. The invoice number field is reserved for the invoice number. $data['x_invoice_num'] = $this->getTransactionId(); // A custom field can be used to pass over the merchant site transaction ID. $data[static::TRANSACTION_ID_PARAM] = $this->getTransactionId(); $data['x_description'] = $this->getDescription(); if ($card = $this->getCard()) { // customer billing details $data['x_first_name'] = $card->getBillingFirstName(); $data['x_last_name'] = $card->getBillingLastName(); $data['x_company'] = $card->getBillingCompany(); $data['x_address'] = trim( $card->getBillingAddress1()." \n". $card->getBillingAddress2() ); $data['x_city'] = $card->getBillingCity(); $data['x_state'] = $card->getBillingState(); $data['x_zip'] = $card->getBillingPostcode(); $data['x_country'] = $card->getBillingCountry(); $data['x_phone'] = $card->getBillingPhone(); $data['x_email'] = $card->getEmail(); // customer shipping details $data['x_ship_to_first_name'] = $card->getShippingFirstName(); $data['x_ship_to_last_name'] = $card->getShippingLastName(); $data['x_ship_to_company'] = $card->getShippingCompany(); $data['x_ship_to_address'] = trim( $card->getShippingAddress1()." \n". $card->getShippingAddress2() ); $data['x_ship_to_city'] = $card->getShippingCity(); $data['x_ship_to_state'] = $card->getShippingState(); $data['x_ship_to_zip'] = $card->getShippingPostcode(); $data['x_ship_to_country'] = $card->getShippingCountry(); } return $data; } public function sendData($data) { $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send(); return $this->response = new AIMResponse($this, $httpResponse->getBody()); } public function getEndpoint() { if ($this->getDeveloperMode()) { return $this->getParameter('developerEndpoint'); } else { return $this->getParameter('liveEndpoint'); } } } src/Message/DPMCompleteRequest.php 0000604 00000000530 15173220405 0013103 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Exception\InvalidRequestException; /** * Authorize.Net DPM Complete Authorize Request */ class DPMCompleteRequest extends SIMCompleteAuthorizeRequest { public function sendData($data) { return $this->response = new DPMCompleteResponse($this, $data); } } src/Message/DPMPurchaseRequest.php 0000604 00000000335 15173220405 0013110 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net DPM Purchase Request (aka "Authorize and Capture") */ class DPMPurchaseRequest extends DPMAuthorizeRequest { protected $action = 'AUTH_CAPTURE'; } src/Message/AIMRefundRequest.php 0000604 00000001306 15173220405 0012546 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net Refund Request */ class AIMRefundRequest extends AbstractRequest { protected $action = 'CREDIT'; public function getData() { $data = $this->getBaseData('RefundTransaction'); $this->validate('amount', 'transactionReference'); $data['x_trans_id'] = $this->getTransactionReference(); $data['x_card_num'] = $this->getCard()->getNumber(); $expiryMonth = $this->getCard()->getExpiryMonth(); if (!empty($expiryMonth)) { $data['x_exp_date'] = $this->getCard()->getExpiryDate('my'); } $data['x_amount'] = $this->getAmount(); return $data; } } src/Message/AIMResponse.php 0000604 00000002146 15173220405 0011553 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Exception\InvalidResponseException; /** * Authorize.Net AIM Response */ class AIMResponse extends AbstractResponse { public function __construct(RequestInterface $request, $data) { $this->request = $request; $this->data = explode('|,|', substr($data, 1, -1)); if (count($this->data) < 10) { throw new InvalidResponseException(); } } public function isSuccessful() { return '1' === $this->getCode(); } public function getCode() { return $this->data[0]; } public function getReasonCode() { return $this->data[2]; } public function getMessage() { return $this->data[3]; } public function getAuthorizationCode() { return $this->data[4]; } public function getAVSCode() { return $this->data[5]; } public function getTransactionReference() { return $this->data[6]; } } src/Message/AIMVoidRequest.php 0000604 00000000605 15173220405 0012225 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net AIM Void Request */ class AIMVoidRequest extends AbstractRequest { protected $action = 'VOID'; public function getData() { $this->validate('transactionReference'); $data = $this->getBaseData(); $data['x_trans_id'] = $this->getTransactionReference(); return $data; } } src/Message/DPMAuthorizeRequest.php 0000604 00000003753 15173220405 0013317 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net DPM Authorize Request. * Takes the data that will be used to create the direct-post form. */ class DPMAuthorizeRequest extends SIMAuthorizeRequest { protected $action = 'AUTH_ONLY'; public function getData() { $data = parent::getData(); // If x_show_form is set, then the form will be displayed on the Authorize.Net // gateway, in a similar way to the SIM gateway. The DPM documentation does NOT // make this clear at all. // Since x_show_form is set in the SIM gateway, make sure we unset it here. unset($data['x_show_form']); // Must be set for DPM. // This directs all errors to the relay response. $data['x_relay_always'] = 'TRUE'; // The card details are optional. // They will most likely only be used for development and testing. // The card fields are still needed in the direct-post form regardless. if ($this->getCard()) { $data['x_card_num'] = $this->getCard()->getNumber(); // Workaround for https://github.com/thephpleague/omnipay-common/issues/29 $expiry_date = $this->getCard()->getExpiryDate('my'); $data['x_exp_date'] = ($expiry_date === '1299' ? '' : $expiry_date); $data['x_card_code'] = $this->getCard()->getCvv(); } else { $data['x_card_num'] = ''; $data['x_exp_date'] = ''; $data['x_card_code'] = ''; } return $data; } /** * Given the DPM data, we want to turn it into a form for the user to submit to Authorize.net * The form may have most of the fields hidden, or may allow the user to change some details - * that depends on the use-case. * So this method will provide us with an object used to build the form. */ public function sendData($data) { return $this->response = new DPMResponse($this, $data, $this->getEndpoint()); } } src/Message/SIMAuthorizeResponse.php 0000604 00000001660 15173220405 0013470 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Message\RedirectResponseInterface; /** * Authorize.Net SIM Authorize Response */ class SIMAuthorizeResponse extends AbstractResponse implements RedirectResponseInterface { protected $redirectUrl; public function __construct(RequestInterface $request, $data, $redirectUrl) { $this->request = $request; $this->data = $data; $this->redirectUrl = $redirectUrl; } public function isSuccessful() { return false; } public function isRedirect() { return true; } public function getRedirectUrl() { return $this->redirectUrl; } public function getRedirectMethod() { return 'POST'; } public function getRedirectData() { return $this->getData(); } } src/Message/AIMPurchaseRequest.php 0000604 00000000277 15173220405 0013103 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net AIM Purchase Request */ class AIMPurchaseRequest extends AIMAuthorizeRequest { protected $action = 'AUTH_CAPTURE'; } src/Message/DPMCompleteResponse.php 0000604 00000000306 15173220405 0013252 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * SIM and DPM both have identical needs when handling the notify request. */ class DPMCompleteResponse extends SIMCompleteAuthorizeResponse { } src/Message/SIMAuthorizeRequest.php 0000604 00000005412 15173220405 0013321 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net SIM Authorize Request */ class SIMAuthorizeRequest extends AbstractRequest { protected $action = 'AUTH_ONLY'; public function getData() { $this->validate('amount'); // Either the nodifyUrl or the returnUrl can be provided. // The returnUrl is deprecated, as strictly this is a notifyUrl. if (!$this->getNotifyUrl()) { $this->validate('returnUrl'); } $data = array(); $data['x_login'] = $this->getApiLoginId(); $data['x_type'] = $this->action; $data['x_version'] = '3.1'; $data['x_method'] = 'CC'; $data['x_fp_sequence'] = mt_rand(); $data['x_fp_timestamp'] = time(); $data['x_delim_data'] = 'FALSE'; $data['x_show_form'] = 'PAYMENT_FORM'; $data['x_relay_response'] = 'TRUE'; if ($this->getClientIp()) { $data['x_customer_ip'] = $this->getClientIp(); } // The returnUrl MUST be whitelisted in Authorize.net admin panel under // "Response/Receipt URLs". // Use the notifyUrl if available, as that is strictly what this is. // Fall back to returnUrl for BC support. $data['x_relay_url'] = $this->getNotifyUrl() ?: $this->getReturnUrl(); $data['x_cancel_url'] = $this->getCancelUrl(); if ($this->getCustomerId() !== null) { $data['x_cust_id'] = $this->getCustomerId(); } if ($this->getCurrency() !== null) { $data['x_currency_code'] = $this->getCurrency(); } if ($this->getTestMode()) { $data['x_test_request'] = 'TRUE'; } $data = array_merge($data, $this->getBillingData()); $data['x_fp_hash'] = $this->getHash($data); return $data; } /** * This hash is put into the form to confirm the amount has not been * modified en-route. * It uses the TransactionKey, which is a shared secret between the merchant * and Authorize.Net The sequence and timestamp provide additional salt. */ public function getHash($data) { $fingerprint = implode( '^', array( $this->getApiLoginId(), $data['x_fp_sequence'], $data['x_fp_timestamp'], $data['x_amount'] ) ).'^'; // If x_currency_code is specified, then it must follow the final trailing carat. if ($this->getCurrency()) { $fingerprint .= $this->getCurrency(); } return hash_hmac('md5', $fingerprint, $this->getTransactionKey()); } public function sendData($data) { return $this->response = new SIMAuthorizeResponse($this, $data, $this->getEndpoint()); } } src/Message/SIMCompleteAuthorizeRequest.php 0000604 00000006072 15173220405 0015015 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Exception\InvalidRequestException; /** * Authorize.Net SIM Complete Authorize Request */ class SIMCompleteAuthorizeRequest extends AbstractRequest { /** * Get the transaction ID passed in through the custom field. * This is used to look up the transaction in storage. */ public function getTransactionId() { return $this->httpRequest->request->get(static::TRANSACTION_ID_PARAM); } public function getData() { // The hash sent in the callback from the Authorize.Net gateway. $hash_posted = strtolower($this->httpRequest->request->get('x_MD5_Hash')); // The transaction reference generated by the Authorize.Net gateway and sent in the callback. $posted_transaction_reference = $this->httpRequest->request->get('x_trans_id'); // The amount that the callback has authorized. $posted_amount = $this->httpRequest->request->get('x_amount'); // Calculate the hash locally, using the shared "hash secret" and login ID. $hash_calculated = $this->getHash($posted_transaction_reference, $posted_amount); if ($hash_posted !== $hash_calculated) { // If the hash is incorrect, then we can't trust the source nor anything sent. // Throwing exceptions here is probably a bad idea. We are trying to get the data, // and if it is invalid, then we need to be able to log that data for analysis. // Except we can't, baceuse the exception means we can't get to the data. // For now, this is consistent with other OmniPay gateway drivers. throw new InvalidRequestException('Incorrect hash'); } // The hashes have passed, but the amount should also be validated against the // amount in the stored and retrieved transaction. If the application has the // ability to retrieve the transaction (using the transaction_id sent as a custom // form field, or perhaps in an otherwise unused field such as x_invoice_id. $amount = $this->getAmount(); if (isset($amount) && $amount != $posted_amount) { // The amounts don't match. Someone may have been playing with the // transaction references. throw new InvalidRequestException('Incorrect amount'); } return $this->httpRequest->request->all(); } /** * CHECKME: should this be the transactionReference in the hash, not the transactionId? * The transaction reference and the amount are both sent by the remote gateway (x_trans_id * and x_amount) and it is those that should be checked against. */ public function getHash($transaction_reference, $amount) { $key = array( $this->getHashSecret(), $this->getApiLoginId(), $transaction_reference, $amount, ); return md5(implode('', $key)); } public function sendData($data) { return $this->response = new SIMCompleteAuthorizeResponse($this, $data); } } src/Message/SIMCompleteAuthorizeResponse.php 0000604 00000006370 15173220405 0015164 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RedirectResponseInterface; use Symfony\Component\HttpFoundation\Response as HttpResponse; /** * Authorize.Net SIM Complete Authorize Response */ class SIMCompleteAuthorizeResponse extends AbstractResponse implements RedirectResponseInterface { // Response codes returned by Authorize.Net const RESPONSE_CODE_APPROVED = '1'; const RESPONSE_CODE_DECLINED = '2'; const RESPONSE_CODE_ERROR = '3'; const RESPONSE_CODE_REVIEW = '4'; public function isSuccessful() { return static::RESPONSE_CODE_APPROVED === $this->getCode(); } /** * If there is an error in the form, then the user should be able to go back * to the form and give it another shot. */ public function isError() { return static::RESPONSE_CODE_ERROR === $this->getCode(); } public function getTransactionReference() { return isset($this->data['x_trans_id']) ? $this->data['x_trans_id'] : null; } public function getMessage() { return isset($this->data['x_response_reason_text']) ? $this->data['x_response_reason_text'] : null; } public function getReasonCode() { return isset($this->data['x_response_reason_code']) ? $this->data['x_response_reason_code'] : null; } public function getCode() { return isset($this->data['x_response_code']) ? $this->data['x_response_code'] : null; } /** * This message is handled in a notify, where a HTML redirect must be performed. */ public function isRedirect() { return true; } /** * The merchant site notify handler needs to set the returnUrl in the complete request. */ public function getRedirectUrl() { return $this->request->getReturnUrl(); } public function getRedirectMethod() { return 'GET'; } /** * There is no redirect data to send; the aim is just to get the user to a URL * by delivering a HTML page. */ public function getRedirectData() { return array(); } /** * Authorize.Net requires a redirect in a HTML page. * The OmniPay redirect helper will only provide a HTML page for the POST method * and then implements that through a self-submitting form, which will generate * browser warnings if returning to a non-SSL page. This JavScript and meta refresh * page avoids the security warning. No data is sent in this redirect, as that will * have all been saved with the transaction in storage. */ public function getRedirectResponse() { $output = <<<ENDHTML <!DOCTYPE html> <html> <head> <title>Redirecting...</title> <meta http-equiv="refresh" content="0;url=%1\$s" /> </head> <body> <p>Redirecting to <a href="%1\$s">payment complete page</a>...</p> <script type="text/javascript" charset="utf-8"> window.location="%1\$s"; </script> </body> </html> ENDHTML; $output = sprintf( $output, htmlentities($this->getRedirectUrl(), ENT_QUOTES, 'UTF-8', false) ); return HttpResponse::create($output); } } src/Message/AIMAuthorizeRequest.php 0000604 00000001440 15173220405 0013274 0 ustar 00 <?php namespace Omnipay\AuthorizeNet\Message; /** * Authorize.Net AIM Authorize Request */ class AIMAuthorizeRequest extends AbstractRequest { protected $action = 'AUTH_ONLY'; public function getData() { $this->validate('amount', 'card'); $this->getCard()->validate(); $data = $this->getBaseData(); $data['x_customer_ip'] = $this->getClientIp(); $data['x_card_num'] = $this->getCard()->getNumber(); $data['x_exp_date'] = $this->getCard()->getExpiryDate('my'); $data['x_card_code'] = $this->getCard()->getCvv(); $data['x_cust_id'] = $this->getCustomerId(); if ($this->getTestMode()) { $data['x_test_request'] = 'TRUE'; } return array_merge($data, $this->getBillingData()); } } src/AIMGateway.php 0000604 00000005430 15173220405 0007771 0 ustar 00 <?php namespace Omnipay\AuthorizeNet; use Omnipay\Common\AbstractGateway; /** * Authorize.Net AIM Class */ class AIMGateway extends AbstractGateway { public function getName() { return 'Authorize.Net AIM'; } public function getDefaultParameters() { return array( 'apiLoginId' => '', 'transactionKey' => '', 'testMode' => false, 'developerMode' => false, 'liveEndpoint' => 'https://secure2.authorize.net/gateway/transact.dll', 'developerEndpoint' => 'https://test.authorize.net/gateway/transact.dll', ); } public function getApiLoginId() { return $this->getParameter('apiLoginId'); } public function setApiLoginId($value) { return $this->setParameter('apiLoginId', $value); } public function getTransactionKey() { return $this->getParameter('transactionKey'); } public function setTransactionKey($value) { return $this->setParameter('transactionKey', $value); } public function getDeveloperMode() { return $this->getParameter('developerMode'); } public function setDeveloperMode($value) { return $this->setParameter('developerMode', $value); } public function setEndpoints($endpoints) { $this->setParameter('liveEndpoint', $endpoints['live']); return $this->setParameter('developerEndpoint', $endpoints['developer']); } public function getLiveEndpoint() { return $this->getParameter('liveEndpoint'); } public function setLiveEndpoint($value) { return $this->setParameter('liveEndpoint', $value); } public function getDeveloperEndpoint() { return $this->getParameter('developerEndpoint'); } public function setDeveloperEndpoint($value) { return $this->setParameter('developerEndpoint', $value); } public function authorize(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMAuthorizeRequest', $parameters); } public function capture(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\CaptureRequest', $parameters); } public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMPurchaseRequest', $parameters); } public function void(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMVoidRequest', $parameters); } public function refund(array $parameters = array()) { return $this->createRequest('\Omnipay\AuthorizeNet\Message\AIMRefundRequest', $parameters); } } LICENSE 0000604 00000002047 15173220405 0005547 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. composer.json 0000604 00000001763 15173220405 0007270 0 ustar 00 { "name": "omnipay/authorizenet", "type": "library", "description": "Authorize.Net gateway for the Omnipay payment processing library", "keywords": [ "authorize net", "authorize", "authorize.net", "gateway", "merchant", "omnipay", "pay", "payment" ], "homepage": "https://github.com/thephpleague/omnipay-authorizenet", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-authorizenet/contributors" } ], "autoload": { "psr-4": { "Omnipay\\AuthorizeNet\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } CONTRIBUTING.md 0000604 00000001040 15173220405 0006763 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 15173220405 0007711 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> .travis.yml 0000604 00000000372 15173220405 0006652 0 ustar 00 language: php php: - 5.3 - 5.4 - 5.5 - 5.6 - hhvm matrix: allow_failures: - php: hhvm before_script: - composer install -n --dev --prefer-source script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings