File manager - Edit - /home/opticamezl/www/newok/worldpay.tar
Back
CONTRIBUTING.md 0000604 00000001040 15173232037 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. LICENSE 0000604 00000002047 15173232037 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. composer.json 0000604 00000001652 15173232037 0007271 0 ustar 00 { "name": "omnipay/worldpay", "type": "library", "description": "WorldPay driver for the Omnipay payment processing library", "keywords": [ "gateway", "merchant", "omnipay", "pay", "payment", "worldpay" ], "homepage": "https://github.com/thephpleague/omnipay-worldpay", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-worldpay/contributors" } ], "autoload": { "psr-4": { "Omnipay\\WorldPay\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } .gitignore 0000604 00000000060 15173232037 0006527 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml phpunit.xml.dist 0000604 00000001512 15173232037 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> tests/Message/CompletePurchaseResponseTest.php 0000604 00000004450 15173232037 0015627 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Tests\TestCase; class CompletePurchaseResponseTest extends TestCase { public function testCompletePurchaseSuccess() { $response = new CompletePurchaseresponse( $this->getMockRequest(), array( 'transStatus' => 'Y', 'transId' => 'abc123', 'rawAuthMessage' => 'Success Message' ) ); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isCancelled()); $this->assertFalse($response->isRedirect()); $this->assertSame('abc123', $response->getTransactionReference()); $this->assertSame('Success Message', $response->getMessage()); } public function testCompletePurchaseCancel() { $response = new CompletePurchaseresponse( $this->getMockRequest(), array( 'transStatus' => 'C', 'transId' => null, 'rawAuthMessage' => 'Declined' ) ); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isCancelled()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertSame('Declined', $response->getMessage()); } public function testCompletePurchaseFailure() { $response = new CompletePurchaseresponse( $this->getMockRequest(), array( 'transStatus' => 'N', 'transId' => null, 'rawAuthMessage' => 'Declined' ) ); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isCancelled()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertSame('Declined', $response->getMessage()); } public function testCompletePurchaseInvalid() { $response = new CompletePurchaseresponse($this->getMockRequest(), array()); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertNull($response->getMessage()); } } tests/Message/PurchaseResponseTest.php 0000604 00000001733 15173232037 0014137 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Tests\TestCase; class PurchaseResponseTest extends TestCase { public function testPurchaseSuccess() { $response = new PurchaseResponse($this->getMockRequest(), array( 'amount' => 1000, 'returnUrl' => 'https://www.example.com/return', )); $this->getMockRequest()->shouldReceive('getEndpoint')->once()->andReturn('https://secure.worldpay.com/wcc/purchase'); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertNull($response->getMessage()); $this->assertSame('https://secure.worldpay.com/wcc/purchase?amount=1000&returnUrl=https%3A%2F%2Fwww.example.com%2Freturn', $response->getRedirectUrl()); $this->assertSame('GET', $response->getRedirectMethod()); $this->assertNull($response->getRedirectData()); } } tests/Message/PurchaseRequestTest.php 0000604 00000002777 15173232037 0014002 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Tests\TestCase; class PurchaseRequestTest extends TestCase { public function setUp() { $this->request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); $this->request->initialize( array( 'amount' => '10.00', 'returnUrl' => 'https://example.com/return', ) ); } public function testGetData() { $this->request->initialize( array( 'installationId' => 'id1', 'accountId' => 'id2', 'transactionId' => 'id3', 'description' => 'food', 'amount' => '12.00', 'currency' => 'GBP', 'returnUrl' => 'https://example.com/return', ) ); $data = $this->request->getData(); $this->assertSame('id1', $data['instId']); $this->assertSame('id2', $data['accId1']); $this->assertSame('id3', $data['cartId']); $this->assertSame('food', $data['desc']); $this->assertSame('12.00', $data['amount']); $this->assertSame('GBP', $data['currency']); $this->assertSame(0, $data['testMode']); $this->assertSame('https://example.com/return', $data['MC_callback']); } public function testGetDataTestMode() { $this->request->setTestMode(true); $data = $this->request->getData(); $this->assertSame(100, $data['testMode']); } } tests/GatewayTest.php 0000604 00000004676 15173232037 0010674 0 ustar 00 <?php namespace Omnipay\WorldPay; use Omnipay\Tests\GatewayTestCase; class GatewayTest extends GatewayTestCase { public function setUp() { parent::setUp(); $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setCallbackPassword('bar123'); $this->options = array( 'amount' => '10.00', 'returnUrl' => 'https://www.example.com/return', ); } public function testPurchase() { $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertContains('https://secure.worldpay.com/wcc/purchase?', $response->getRedirectUrl()); } public function testCompletePurchaseSuccess() { $this->getHttpRequest()->request->replace( array( 'callbackPW' => 'bar123', 'transStatus' => 'Y', 'transId' => 'abc123', 'rawAuthMessage' => 'hello', ) ); $response = $this->gateway->completePurchase($this->options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertEquals('abc123', $response->getTransactionReference()); $this->assertSame('hello', $response->getMessage()); } /** * @expectedException \Omnipay\Common\Exception\InvalidResponseException */ public function testCompletePurchaseInvalidCallbackPassword() { $this->getHttpRequest()->request->replace( array( 'callbackPW' => 'fake', ) ); $response = $this->gateway->completePurchase($this->options)->send(); } public function testCompletePurchaseError() { $this->getHttpRequest()->request->replace( array( 'callbackPW' => 'bar123', 'transStatus' => 'N', 'rawAuthMessage' => 'Declined', ) ); $response = $this->gateway->completePurchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertSame('Declined', $response->getMessage()); } } src/Message/PurchaseRequest.php 0000604 00000006160 15173232037 0012555 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Common\Message\AbstractRequest; /** * WorldPay Purchase Request */ class PurchaseRequest extends AbstractRequest { protected $liveEndpoint = 'https://secure.worldpay.com/wcc/purchase'; protected $testEndpoint = 'https://secure-test.worldpay.com/wcc/purchase'; public function getInstallationId() { return $this->getParameter('installationId'); } public function setInstallationId($value) { return $this->setParameter('installationId', $value); } public function getAccountId() { return $this->getParameter('accountId'); } public function setAccountId($value) { return $this->setParameter('accountId', $value); } public function getSecretWord() { return $this->getParameter('secretWord'); } public function setSecretWord($value) { return $this->setParameter('secretWord', $value); } public function getCallbackPassword() { return $this->getParameter('callbackPassword'); } public function setCallbackPassword($value) { return $this->setParameter('callbackPassword', $value); } 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['instId'] = $this->getInstallationId(); $data['accId1'] = $this->getAccountId(); $data['cartId'] = $this->getTransactionId(); $data['desc'] = $this->getDescription(); $data['amount'] = $this->getAmount(); $data['currency'] = $this->getCurrency(); $data['testMode'] = $this->getTestMode() ? 100 : 0; $data['MC_callback'] = $this->getNotifyUrl() ?: $this->getReturnUrl(); if ($this->getCard()) { $data['name'] = $this->getCard()->getName(); $data['address1'] = $this->getCard()->getAddress1(); $data['address2'] = $this->getCard()->getAddress2(); $data['town'] = $this->getCard()->getCity(); $data['region'] = $this->getCard()->getState(); $data['postcode'] = $this->getCard()->getPostcode(); $data['country'] = $this->getCard()->getCountry(); $data['tel'] = $this->getCard()->getPhone(); $data['email'] = $this->getCard()->getEmail(); } if ($this->getSecretWord()) { $data['signatureFields'] = 'instId:amount:currency:cartId'; $signature_data = array($this->getSecretWord(), $data['instId'], $data['amount'], $data['currency'], $data['cartId']); $data['signature'] = md5(implode(':', $signature_data)); } return $data; } public function sendData($data) { return $this->response = new PurchaseResponse($this, $data); } public function getEndpoint() { return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; } } src/Message/PurchaseResponse.php 0000604 00000001261 15173232037 0012720 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RedirectResponseInterface; /** * WorldPay Purchase Response */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { public function isSuccessful() { return false; } public function isRedirect() { return true; } public function getRedirectUrl() { return $this->getRequest()->getEndpoint().'?'.http_build_query($this->data); } public function getRedirectMethod() { return 'GET'; } public function getRedirectData() { return null; } } src/Message/CompletePurchaseRequest.php 0000604 00000001212 15173232037 0014237 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Common\Exception\InvalidResponseException; /** * WorldPay Complete Purchase Request */ class CompletePurchaseRequest extends PurchaseRequest { public function getData() { $callbackPW = (string) $this->httpRequest->request->get('callbackPW'); if ($callbackPW !== $this->getCallbackPassword()) { throw new InvalidResponseException("Invalid callback password"); } return $this->httpRequest->request->all(); } public function sendData($data) { return $this->response = new CompletePurchaseResponse($this, $data); } } src/Message/CompletePurchaseResponse.php 0000604 00000003076 15173232037 0014417 0 ustar 00 <?php namespace Omnipay\WorldPay\Message; use Omnipay\Common\Message\AbstractResponse; /** * WorldPay Complete Purchase Response */ class CompletePurchaseResponse extends AbstractResponse { public function isSuccessful() { return isset($this->data['transStatus']) && 'Y' === $this->data['transStatus']; } public function isCancelled() { return isset($this->data['transStatus']) && 'C' === $this->data['transStatus']; } public function getTransactionReference() { return isset($this->data['transId']) ? $this->data['transId'] : null; } public function getMessage() { return isset($this->data['rawAuthMessage']) ? $this->data['rawAuthMessage'] : null; } /** * Optional step: Redirect the customer back to your own domain. * * This is achieved by returning a HTML string containing a meta-redirect which is displayed by WorldPay * to the customer. This is far from ideal, but apparently (according to their support) this is the only * method currently available. * * @param string $returnUrl The URL to forward the customer to. * @param string|null $message Optional message to display to the customer before they are redirected. */ public function confirm($returnUrl, $message = null) { if (empty($message)) { $message = 'Thank you, your transaction has been processed. You are being redirected...'; } echo '<meta http-equiv="refresh" content="2;url='.$returnUrl.'" /><p>'.$message.'</p>'; exit; } } src/Gateway.php 0000604 00000003525 15173232037 0007451 0 ustar 00 <?php namespace Omnipay\WorldPay; use Omnipay\Common\AbstractGateway; use Omnipay\WorldPay\Message\CompletePurchaseRequest; use Omnipay\WorldPay\Message\PurchaseRequest; /** * WorldPay Gateway * * @link http://www.worldpay.com/support/kb/bg/htmlredirect/rhtml.html */ class Gateway extends AbstractGateway { public function getName() { return 'WorldPay'; } public function getDefaultParameters() { return array( 'installationId' => '', 'accountId' => '', 'secretWord' => '', 'callbackPassword' => '', 'testMode' => false, ); } public function getInstallationId() { return $this->getParameter('installationId'); } public function setInstallationId($value) { return $this->setParameter('installationId', $value); } public function getAccountId() { return $this->getParameter('accountId'); } public function setAccountId($value) { return $this->setParameter('accountId', $value); } public function getSecretWord() { return $this->getParameter('secretWord'); } public function setSecretWord($value) { return $this->setParameter('secretWord', $value); } public function getCallbackPassword() { return $this->getParameter('callbackPassword'); } public function setCallbackPassword($value) { return $this->setParameter('callbackPassword', $value); } public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\WorldPay\Message\PurchaseRequest', $parameters); } public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\WorldPay\Message\CompletePurchaseRequest', $parameters); } } .travis.yml 0000604 00000000317 15173232037 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 README.md 0000604 00000003533 15173232037 0006026 0 ustar 00 # Omnipay: WorldPay **WorldPay driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-worldpay) [](https://packagist.org/packages/omnipay/worldpay) [](https://packagist.org/packages/omnipay/worldpay) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements WorldPay 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/worldpay": "~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: * WorldPay 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-worldpay/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