File manager - Edit - /home/opticamezl/www/newok/payflow.tar
Back
composer.json 0000604 00000001644 15174771107 0007301 0 ustar 00 { "name": "omnipay/payflow", "type": "library", "description": "Payflow driver for the Omnipay payment processing library", "keywords": [ "gateway", "merchant", "omnipay", "pay", "payflow", "payment" ], "homepage": "https://github.com/thephpleague/omnipay-payflow", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-payflow/contributors" } ], "autoload": { "psr-4": { "Omnipay\\Payflow\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } LICENSE 0000604 00000002047 15174771107 0005562 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. tests/ProGatewayTest.php 0000604 00000006217 15174771107 0011355 0 ustar 00 <?php namespace Omnipay\Payflow; use Omnipay\Common\CreditCard; use Omnipay\Tests\GatewayTestCase; class ProGatewayTest extends GatewayTestCase { public function setUp() { parent::setUp(); $this->gateway = new ProGateway($this->getHttpClient(), $this->getHttpRequest()); $this->options = array( 'amount' => '10.00', 'card' => new CreditCard(array( 'firstName' => 'Example', 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => '12', 'expiryYear' => '2016', 'cvv' => '123', )), ); } public function testAuthorizeSuccess() { $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->gateway->authorize($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); } public function testAuthorizeError() { $this->setMockHttpResponse('PurchaseFailure.txt'); $response = $this->gateway->authorize($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('User authentication failed', $response->getMessage()); } public function testCapture() { $options = array( 'amount' => '10.00', 'transactionReference' => 'abc123', ); $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->gateway->capture($options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); } public function testPurchaseSuccess() { $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->gateway->purchase($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); } public function testPurchaseError() { $this->setMockHttpResponse('PurchaseFailure.txt'); $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('User authentication failed', $response->getMessage()); } public function testRefund() { $options = array( 'amount' => '10.00', 'transactionReference' => 'abc123', ); $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->gateway->refund($options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); } public function testVoid() { $options = array( 'transactionReference' => 'abc123', ); $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->gateway->void($options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); } } tests/Mock/PurchaseFailure.txt 0000604 00000000267 15174771107 0012435 0 ustar 00 HTTP/1.1 200 OK Connection: close Server: VPS-3.033.00 Date: Sat, 23 Feb 2013 05:17:32 GMT Content-type: text/namevalue Content-length: 43 RESULT=1&RESPMSG=User authentication failed tests/Mock/PurchaseSuccess.txt 0000604 00000000633 15174771107 0012453 0 ustar 00 HTTP/1.1 200 OK Connection: close Server: VPS-3.033.00 Date: Tue, 11 Feb 2014 02:34:58 GMT Content-type: text/namevalue Content-length: 269 RESULT=0&PNREF=A10A6AE7042E&RESPMSG=Approved&AUTHCODE=331PNI&AVSADDR=X&AVSZIP=X&CVV2MATCH=Y&HOSTCODE=A&PROCAVS=U&PROCCVV2=M&VISACARDLEVEL=12&TRANSTIME=2014-02-10 18:34:58&BILLTOFIRSTNAME=Adrian&BILLTOLASTNAME[5]=& Foo&AMT=362.45&ACCT=1111&EXPDATE=0316&CARDTYPE=0&IAVS=X tests/Message/ResponseTest.php 0000604 00000004175 15174771107 0012456 0 ustar 00 <?php namespace Omnipay\Payflow\Message; use Omnipay\Tests\TestCase; class ResponseTest extends TestCase { /** * @expectedException Omnipay\Common\Exception\InvalidResponseException */ public function testConstructEmpty() { $response = new Response($this->getMockRequest(), ''); } public function testDecodeData() { $response = new Response($this->getMockRequest(), 'x=y'); $data = 'BILLTOFIRSTNAME=Adrian&BILLTOLASTNAME[6]=&= Foo&TEST=Hi'; $expected = array( 'BILLTOFIRSTNAME' => 'Adrian', 'BILLTOLASTNAME' => '&= Foo', 'TEST' => 'Hi', ); $this->assertSame($expected, $response->decodeData($data)); } public function testDecodeDataSimple() { $response = new Response($this->getMockRequest(), 'x=y'); $data = 'foo=bar'; $expected = array('foo' => 'bar'); $this->assertSame($expected, $response->decodeData($data)); } public function testDecodeDataEmpty() { $response = new Response($this->getMockRequest(), 'x=y'); $data = ''; $expected = array(); $this->assertSame($expected, $response->decodeData($data)); } public function testPurchaseSuccess() { $httpResponse = $this->getMockHttpResponse('PurchaseSuccess.txt'); $response = new Response($this->getMockRequest(), $httpResponse->getBody()); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertEquals('A10A6AE7042E', $response->getTransactionReference()); $this->assertEquals('Approved', $response->getMessage()); } public function testPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('PurchaseFailure.txt'); $response = new Response($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertSame('User authentication failed', $response->getMessage()); } } tests/Message/AuthorizeRequestTest.php 0000604 00000003540 15174771107 0014176 0 ustar 00 <?php namespace Omnipay\Payflow\Message; use Omnipay\Tests\TestCase; class AuthorizeRequestTest extends TestCase { public function setUp() { $this->request = new AuthorizeRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'amount' => '12.00', 'card' => $this->getValidCard(), ) ); } public function testComment1() { // comment1 is alias for description $this->assertSame($this->request, $this->request->setComment1('foo')); $this->assertSame('foo', $this->request->getComment1()); $this->assertSame('foo', $this->request->getDescription()); } public function testComment2() { $this->assertSame($this->request, $this->request->setComment2('bar')); $this->assertSame('bar', $this->request->getComment2()); } public function testGetData() { $card = $this->getValidCard(); $this->request->initialize( array( 'amount' => '12.00', 'description' => 'things', 'comment2' => 'more things', 'card' => $card, 'transactionId' => '123', ) ); $data = $this->request->getData(); $this->assertSame('C', $data['TENDER']); $this->assertSame('12.00', $data['AMT']); $this->assertSame('things', $data['COMMENT1']); $this->assertSame('more things', $data['COMMENT2']); $this->assertSame('123', $data['ORDERID']); } public function testEncodeData() { $data = array( 'foo' => 'bar', 'key' => 'value &= reference', ); $expected = 'foo[3]=bar&key[18]=value &= reference'; $this->assertSame($expected, $this->request->encodeData($data)); } } src/ProGateway.php 0000604 00000004423 15174771107 0010137 0 ustar 00 <?php namespace Omnipay\Payflow; use Omnipay\Common\AbstractGateway; use Omnipay\Payflow\Message\AuthorizeRequest; use Omnipay\Payflow\Message\CaptureRequest; use Omnipay\Payflow\Message\PurchaseRequest; use Omnipay\Payflow\Message\RefundRequest; /** * Payflow Pro Class * * @link https://www.x.com/sites/default/files/payflowgateway_guide.pdf */ class ProGateway extends AbstractGateway { public function getName() { return 'Payflow'; } public function getDefaultParameters() { return array( 'username' => '', 'password' => '', 'vendor' => '', 'partner' => '', 'testMode' => false, ); } public function getUsername() { return $this->getParameter('username'); } public function setUsername($value) { return $this->setParameter('username', $value); } public function getPassword() { return $this->getParameter('password'); } public function setPassword($value) { return $this->setParameter('password', $value); } public function getVendor() { return $this->getParameter('vendor'); } public function setVendor($value) { return $this->setParameter('vendor', $value); } public function getPartner() { return $this->getParameter('partner'); } public function setPartner($value) { return $this->setParameter('partner', $value); } public function authorize(array $parameters = array()) { return $this->createRequest('\Omnipay\Payflow\Message\AuthorizeRequest', $parameters); } public function capture(array $parameters = array()) { return $this->createRequest('\Omnipay\Payflow\Message\CaptureRequest', $parameters); } public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\Payflow\Message\PurchaseRequest', $parameters); } public function refund(array $parameters = array()) { return $this->createRequest('\Omnipay\Payflow\Message\RefundRequest', $parameters); } public function void(array $parameters = array()) { return $this->createRequest('\Omnipay\Payflow\Message\VoidRequest', $parameters); } } src/Message/VoidRequest.php 0000604 00000001101 15174771107 0011701 0 ustar 00 <?php namespace Omnipay\Payflow\Message; /** * Payflow Void Request */ class VoidRequest extends AuthorizeRequest { protected $action = 'V'; /** * Void prevents transactions from being settled. * * @return array ... the data Payflow needs to void a transaction * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { $this->validate('transactionReference'); $data = $this->getBaseData(); $data['ORIGID'] = $this->getTransactionReference(); return $data; } } src/Message/AuthorizeRequest.php 0000604 00000007033 15174771107 0012764 0 ustar 00 <?php namespace Omnipay\Payflow\Message; use Omnipay\Common\Message\AbstractRequest; /** * Payflow Authorize Request */ class AuthorizeRequest extends AbstractRequest { protected $liveEndpoint = 'https://payflowpro.paypal.com'; protected $testEndpoint = 'https://pilot-payflowpro.paypal.com'; protected $action = 'A'; public function getUsername() { return $this->getParameter('username'); } public function setUsername($value) { return $this->setParameter('username', $value); } public function getPassword() { return $this->getParameter('password'); } public function setPassword($value) { return $this->setParameter('password', $value); } public function getVendor() { return $this->getParameter('vendor'); } public function setVendor($value) { return $this->setParameter('vendor', $value); } public function getPartner() { return $this->getParameter('partner'); } public function setPartner($value) { return $this->setParameter('partner', $value); } public function getComment1() { return $this->getDescription(); } public function setComment1($value) { return $this->setDescription($value); } public function getComment2() { return $this->getParameter('comment2'); } public function setComment2($value) { return $this->setParameter('comment2', $value); } protected function getBaseData() { $data = array(); $data['TRXTYPE'] = $this->action; $data['USER'] = $this->getUsername(); $data['PWD'] = $this->getPassword(); $data['VENDOR'] = $this->getVendor(); $data['PARTNER'] = $this->getPartner(); return $data; } public function getData() { $this->validate('amount', 'card'); $this->getCard()->validate(); $data = $this->getBaseData(); $data['TENDER'] = 'C'; $data['AMT'] = $this->getAmount(); $data['COMMENT1'] = $this->getDescription(); $data['COMMENT2'] = $this->getComment2(); $data['ORDERID'] = $this->getTransactionId(); $data['ACCT'] = $this->getCard()->getNumber(); $data['EXPDATE'] = $this->getCard()->getExpiryDate('my'); $data['CVV2'] = $this->getCard()->getCvv(); $data['BILLTOFIRSTNAME'] = $this->getCard()->getFirstName(); $data['BILLTOLASTNAME'] = $this->getCard()->getLastName(); $data['BILLTOSTREET'] = $this->getCard()->getAddress1(); $data['BILLTOCITY'] = $this->getCard()->getCity(); $data['BILLTOSTATE'] = $this->getCard()->getState(); $data['BILLTOZIP'] = $this->getCard()->getPostcode(); $data['BILLTOCOUNTRY'] = $this->getCard()->getCountry(); return $data; } public function sendData($data) { $httpResponse = $this->httpClient->post( $this->getEndpoint(), null, $this->encodeData($data) )->send(); return $this->response = new Response($this, $httpResponse->getBody()); } /** * Encode absurd name value pair format */ public function encodeData(array $data) { $output = array(); foreach ($data as $key => $value) { $output[] = $key.'['.strlen($value).']='.$value; } return implode('&', $output); } protected function getEndpoint() { return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; } } src/Message/CaptureRequest.php 0000604 00000000650 15174771107 0012413 0 ustar 00 <?php namespace Omnipay\Payflow\Message; /** * Payflow Capture Request */ class CaptureRequest extends AuthorizeRequest { protected $action = 'D'; public function getData() { $this->validate('transactionReference', 'amount'); $data = $this->getBaseData(); $data['AMT'] = $this->getAmount(); $data['ORIGID'] = $this->getTransactionReference(); return $data; } } src/Message/PurchaseRequest.php 0000604 00000000237 15174771107 0012563 0 ustar 00 <?php namespace Omnipay\Payflow\Message; /** * Payflow Purchase Request */ class PurchaseRequest extends AuthorizeRequest { protected $action = 'S'; } src/Message/Response.php 0000604 00000003075 15174771107 0011241 0 ustar 00 <?php namespace Omnipay\Payflow\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Exception\InvalidResponseException; /** * Payflow Response */ class Response extends AbstractResponse { public function __construct(RequestInterface $request, $data) { $this->request = $request; if (empty($data)) { throw new InvalidResponseException; } $this->data = $this->decodeData($data); } /** * Decode absurd name value pair format */ public function decodeData($data) { $output = array(); while (strlen($data) > 0) { preg_match('/(\w+)(\[(\d+)\])?=/', $data, $matches); $key = $matches[1]; $data = substr($data, strlen($matches[0])); if (isset($matches[3])) { $value = substr($data, 0, $matches[3]); } else { $next = strpos($data, '&'); $value = $next === false ? $data : substr($data, 0, $next); } $data = substr($data, strlen($value) + 1); $output[$key] = $value; } return $output; } public function isSuccessful() { return isset($this->data['RESULT']) && '0' === $this->data['RESULT']; } public function getTransactionReference() { return isset($this->data['PNREF']) ? $this->data['PNREF'] : null; } public function getMessage() { return isset($this->data['RESPMSG']) ? $this->data['RESPMSG'] : null; } } src/Message/RefundRequest.php 0000604 00000000231 15174771107 0012226 0 ustar 00 <?php namespace Omnipay\Payflow\Message; /** * Payflow Refund Request */ class RefundRequest extends CaptureRequest { protected $action = 'C'; } .travis.yml 0000604 00000000317 15174771107 0006664 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 .gitignore 0000604 00000000060 15174771107 0006536 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml CONTRIBUTING.md 0000604 00000001040 15174771107 0006776 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 15174771107 0007724 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> README.md 0000604 00000003523 15174771107 0006034 0 ustar 00 # Omnipay: Payflow **Payflow driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-payflow) [](https://packagist.org/packages/omnipay/payflow) [](https://packagist.org/packages/omnipay/payflow) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Payflow 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/payflow": "~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: * Payflow_Pro 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-payflow/issues), or better yet, fork the library and submit a pull request.
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings