File manager - Edit - /home/opticamezl/www/newok/2checkout.tar
Back
.gitignore 0000604 00000000060 15173232343 0006527 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml composer.json 0000604 00000001730 15173232343 0007266 0 ustar 00 { "name": "omnipay/2checkout", "type": "library", "description": "2Checkout driver for the Omnipay payment processing library", "keywords": [ "2checkout", "2co", "gateway", "merchant", "omnipay", "pay", "payment", "twocheckout" ], "homepage": "https://github.com/thephpleague/omnipay-2checkout", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-2checkout/contributors" } ], "autoload": { "psr-4": { "Omnipay\\TwoCheckout\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } README.md 0000604 00000003551 15173232343 0006026 0 ustar 00 # Omnipay: 2Checkout **2Checkout driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-2checkout) [](https://packagist.org/packages/omnipay/2checkout) [](https://packagist.org/packages/omnipay/2checkout) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements 2Checkout 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/2checkout": "~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: * TwoCheckout 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-2checkout/issues), or better yet, fork the library and submit a pull request. CONTRIBUTING.md 0000604 00000001040 15173232343 0006767 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. .travis.yml 0000604 00000000317 15173232343 0006655 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 src/Message/CompletePurchaseResponse.php 0000604 00000000640 15173232343 0014411 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Common\Message\AbstractResponse; /** * 2Checkout Complete Purchase Response */ class CompletePurchaseResponse extends AbstractResponse { public function isSuccessful() { return true; } public function getTransactionReference() { return isset($this->data['order_number']) ? $this->data['order_number'] : null; } } src/Message/PurchaseRequest.php 0000604 00000003654 15173232343 0012562 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Common\Message\AbstractRequest; /** * 2Checkout Purchase Request */ class PurchaseRequest extends AbstractRequest { public function getAccountNumber() { return $this->getParameter('accountNumber'); } public function setAccountNumber($value) { return $this->setParameter('accountNumber', $value); } public function getSecretWord() { return $this->getParameter('secretWord'); } public function setSecretWord($value) { return $this->setParameter('secretWord', $value); } public function getData() { $this->validate('amount', 'returnUrl'); $data = array(); $data['sid'] = $this->getAccountNumber(); $data['cart_order_id'] = $this->getTransactionId(); $data['merchant_order_id'] = $this->getTransactionId(); $data['total'] = $this->getAmount(); $data['tco_currency'] = $this->getCurrency(); $data['fixed'] = 'Y'; $data['skip_landing'] = 1; $data['x_receipt_link_url'] = $this->getReturnUrl(); if ($this->getCard()) { $data['card_holder_name'] = $this->getCard()->getName(); $data['street_address'] = $this->getCard()->getAddress1(); $data['street_address2'] = $this->getCard()->getAddress2(); $data['city'] = $this->getCard()->getCity(); $data['state'] = $this->getCard()->getState(); $data['zip'] = $this->getCard()->getPostcode(); $data['country'] = $this->getCard()->getCountry(); $data['phone'] = $this->getCard()->getPhone(); $data['email'] = $this->getCard()->getEmail(); } if ($this->getTestMode()) { $data['demo'] = 'Y'; } return $data; } public function sendData($data) { return $this->response = new PurchaseResponse($this, $data); } } src/Message/CompletePurchaseRequest.php 0000604 00000001550 15173232343 0014244 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Common\Exception\InvalidResponseException; /** * 2Checkout Complete Purchase Request */ class CompletePurchaseRequest extends PurchaseRequest { public function getData() { $orderNo = $this->httpRequest->request->get('order_number'); // strange exception specified by 2Checkout if ($this->getTestMode()) { $orderNo = '1'; } $key = md5($this->getSecretWord().$this->getAccountNumber().$orderNo.$this->getAmount()); if (strtolower($this->httpRequest->request->get('key')) !== $key) { throw new InvalidResponseException('Invalid key'); } return $this->httpRequest->request->all(); } public function sendData($data) { return $this->response = new CompletePurchaseResponse($this, $data); } } src/Message/PurchaseResponse.php 0000604 00000001354 15173232343 0012723 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RedirectResponseInterface; /** * 2Checkout Purchase Response */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { protected $endpoint = 'https://www.2checkout.com/checkout/purchase'; public function isSuccessful() { return false; } public function isRedirect() { return true; } public function getRedirectUrl() { return $this->endpoint.'?'.http_build_query($this->data); } public function getRedirectMethod() { return 'GET'; } public function getRedirectData() { return null; } } src/Gateway.php 0000604 00000002541 15173232343 0007446 0 ustar 00 <?php namespace Omnipay\TwoCheckout; use Omnipay\Common\AbstractGateway; use Omnipay\TwoCheckout\Message\CompletePurchaseRequest; use Omnipay\TwoCheckout\Message\PurchaseRequest; /** * 2Checkout Gateway * * @link http://www.2checkout.com/documentation/Advanced_User_Guide.pdf */ class Gateway extends AbstractGateway { public function getName() { return '2Checkout'; } public function getDefaultParameters() { return array( 'accountNumber' => '', 'secretWord' => '', 'testMode' => false, ); } public function getAccountNumber() { return $this->getParameter('accountNumber'); } public function setAccountNumber($value) { return $this->setParameter('accountNumber', $value); } public function getSecretWord() { return $this->getParameter('secretWord'); } public function setSecretWord($value) { return $this->setParameter('secretWord', $value); } public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TwoCheckout\Message\PurchaseRequest', $parameters); } public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TwoCheckout\Message\CompletePurchaseRequest', $parameters); } } tests/GatewayTest.php 0000604 00000003767 15173232343 0010674 0 ustar 00 <?php namespace Omnipay\TwoCheckout; use Omnipay\Tests\GatewayTestCase; use Omnipay\Common\CreditCard; class GatewayTest extends GatewayTestCase { public function setUp() { parent::setUp(); $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setAccountNumber('123456'); $this->gateway->setSecretWord('secret'); $this->options = array( 'amount' => '10.00', 'returnUrl' => 'https://www.example.com/return', ); } public function testPurchase() { $source = new CreditCard; $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertNull($response->getMessage()); $this->assertContains('https://www.2checkout.com/checkout/purchase?', $response->getRedirectUrl()); $this->assertSame('GET', $response->getRedirectMethod()); $this->assertNull($response->getRedirectData()); } /** * @expectedException Omnipay\Common\Exception\InvalidResponseException */ public function testCompletePurchaseError() { $this->getHttpRequest()->request->replace(array('order_number' => '5', 'key' => 'ZZZ')); $response = $this->gateway->completePurchase($this->options)->send(); } public function testCompletePurchaseSuccess() { $this->getHttpRequest()->request->replace( array( 'order_number' => '5', 'key' => md5('secret123456510.00'), ) ); $response = $this->gateway->completePurchase($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('5', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } } tests/Message/PurchaseResponseTest.php 0000604 00000001365 15173232343 0014140 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Tests\TestCase; class PurchaseResponseTest extends TestCase { public function testConstruct() { $response = new Purchaseresponse($this->getMockRequest(), array('sid' => '12345', 'total' => '10.00')); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertNull($response->getMessage()); $this->assertSame('https://www.2checkout.com/checkout/purchase?sid=12345&total=10.00', $response->getRedirectUrl()); $this->assertSame('GET', $response->getRedirectMethod()); $this->assertNull($response->getRedirectData()); } } tests/Message/CompletePurchaseResponseTest.php 0000604 00000001015 15173232343 0015621 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Tests\TestCase; class CompletePurchaseResponseTest extends TestCase { public function testConstruct() { $response = new CompletePurchaseresponse($this->getMockRequest(), array('order_number' => 'abc123')); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertSame('abc123', $response->getTransactionReference()); $this->assertNull($response->getMessage()); } } tests/Message/PurchaseRequestTest.php 0000604 00000001636 15173232343 0013773 0 ustar 00 <?php namespace Omnipay\TwoCheckout\Message; use Omnipay\Tests\TestCase; class PurchaseRequestTest extends TestCase { public function testConstruct() { $request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); $request->setAccountNumber('12345'); $request->setSecretWord('secretWord'); $request->setTransactionId('mytransaction1'); $request->setAmount('10.00'); $request->setReturnUrl('http://example.com/return'); $requestData = $request->getData(); $this->assertEquals($requestData['sid'], '12345'); $this->assertEquals($requestData['cart_order_id'], 'mytransaction1'); $this->assertEquals($requestData['merchant_order_id'], 'mytransaction1'); $this->assertEquals($requestData['total'], '10.00'); $this->assertEquals($requestData['x_receipt_link_url'], 'http://example.com/return'); } } phpunit.xml.dist 0000604 00000001512 15173232343 0007715 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> LICENSE 0000604 00000002047 15173232343 0005553 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