File manager - Edit - /home/opticamezl/www/newok/targetpay.tar
Back
phpunit.xml.dist 0000604 00000001512 15174357056 0007727 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 00000000317 15174357056 0006667 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 tests/IdealGatewayTest.php 0000604 00000004302 15174357056 0011627 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\Tests\GatewayTestCase; class IdealGatewayTest extends GatewayTestCase { /** * @var IdealGateway */ protected $gateway; protected function setUp() { parent::setUp(); $this->gateway = new IdealGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setSubAccountId('123456'); } public function testFetchIssuers() { /** @var \Omnipay\TargetPay\Message\FetchIssuersRequest $request */ $request = $this->gateway->fetchIssuers(); $this->assertInstanceOf('Omnipay\TargetPay\Message\FetchIssuersRequest', $request); $this->assertNull($request->getData()); } public function testPurchase() { /** @var \Omnipay\TargetPay\Message\IdealPurchaseRequest $request */ $request = $this->gateway->purchase(array( 'issuer' => '0001', 'amount' => '100.00', 'currency' => 'EUR', 'description' => 'desc', 'language' => 'EN', 'returnUrl' => 'http://localhost/return', 'notifyUrl' => 'http://localhost/notify', )); $this->assertInstanceOf('Omnipay\TargetPay\Message\IdealPurchaseRequest', $request); $this->assertSame('0001', $request->getIssuer()); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('EUR', $request->getCurrency()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('EN', $request->getLanguage()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('http://localhost/notify', $request->getNotifyUrl()); } public function testCompletePurchase() { /** @var \Omnipay\TargetPay\Message\CompletePurchaseRequest $request */ $request = $this->gateway->completePurchase(array( 'transactionId' => '123456', 'exchangeOnce' => true, )); $this->assertInstanceOf('Omnipay\TargetPay\Message\CompletePurchaseRequest', $request); $this->assertSame('123456', $request->getTransactionId()); $this->assertTrue($request->getExchangeOnce()); } } tests/DirectebankingGatewayTest.php 0000604 00000004027 15174357056 0013526 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\Tests\GatewayTestCase; class DirectebankingGatewayTest extends GatewayTestCase { /** * @var DirectebankingGateway */ protected $gateway; protected function setUp() { parent::setUp(); $this->gateway = new DirectebankingGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setSubAccountId('123456'); } public function testPurchase() { /** @var \Omnipay\TargetPay\Message\DirectebankingPurchaseRequest $request */ $request = $this->gateway->purchase(array( 'amount' => '100.00', 'description' => 'desc', 'clientIp' => '127.0.0.1', 'country' => '00', 'language' => 'EN', 'serviceType' => '0', 'returnUrl' => 'http://localhost/return', 'notifyUrl' => 'http://localhost/notify', )); $this->assertInstanceOf('Omnipay\TargetPay\Message\DirectebankingPurchaseRequest', $request); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('127.0.0.1', $request->getClientIp()); $this->assertSame('00', $request->getCountry()); $this->assertSame('EN', $request->getLanguage()); $this->assertSame('0', $request->getServiceType()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('http://localhost/notify', $request->getNotifyUrl()); } public function testCompletePurchase() { /** @var \Omnipay\TargetPay\Message\CompletePurchaseRequest $request */ $request = $this->gateway->completePurchase(array( 'transactionId' => '123456', 'exchangeOnce' => true, )); $this->assertInstanceOf('Omnipay\TargetPay\Message\CompletePurchaseRequest', $request); $this->assertSame('123456', $request->getTransactionId()); $this->assertTrue($request->getExchangeOnce()); } } tests/MrcashGatewayTest.php 0000604 00000010402 15174357056 0012024 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\Tests\GatewayTestCase; class MrcashGatewayTest extends GatewayTestCase { /** * @var MrcashGateway */ protected $gateway; protected function setUp() { parent::setUp(); $this->gateway = new MrcashGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setSubAccountId('123456'); } public function testFetchIssuers() { /** @var \Omnipay\TargetPay\Message\FetchIssuersRequest $request */ /*$request = $this->gateway->fetchIssuers(); $this->assertInstanceOf('Omnipay\TargetPay\Message\FetchIssuersRequest', $request); $this->assertNull($request->getData());*/ } public function testPurchase() { /** @var \Omnipay\TargetPay\Message\MrcashPurchaseRequest $request */ $request = $this->gateway->purchase(array( 'amount' => '100.00', 'description' => 'desc', 'clientIp' => '127.0.0.1', 'language' => 'EN', 'returnUrl' => 'http://localhost/return', 'notifyUrl' => 'http://localhost/notify', )); $this->assertInstanceOf('Omnipay\TargetPay\Message\MrcashPurchaseRequest', $request); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('127.0.0.1', $request->getClientIp()); $this->assertSame('EN', $request->getLanguage()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('http://localhost/notify', $request->getNotifyUrl()); } public function testPurchaseIdeal() { /** @var \Omnipay\TargetPay\Message\IdealPurchaseRequest $request */ /*$request = $this->gateway->purchase(array( 'issuer' => '0001', 'amount' => '100.00', 'currency' => 'EUR', 'description' => 'desc', 'language' => 'EN', 'returnUrl' => 'http://localhost/return', 'notifyUrl' => 'http://localhost/notify', )); $this->assertInstanceOf('Omnipay\TargetPay\Message\IdealPurchaseRequest', $request); $this->assertSame('0001', $request->getIssuer()); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('EUR', $request->getCurrency()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('EN', $request->getLanguage()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('http://localhost/notify', $request->getNotifyUrl());*/ } public function testPurchaseDirectebanking() { /** @var \Omnipay\TargetPay\Message\DirectebankingPurchaseRequest $request */ /*$request = $this->gateway->purchase(array( 'amount' => '100.00', 'description' => 'desc', 'clientIp' => '127.0.0.1', 'country' => '00', 'language' => 'EN', 'serviceType' => '0', 'returnUrl' => 'http://localhost/return', 'notifyUrl' => 'http://localhost/notify', )); $this->assertInstanceOf('Omnipay\TargetPay\Message\DirectebankingPurchaseRequest', $request); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('127.0.0.1', $request->getClientIp()); $this->assertSame('00', $request->getCountry()); $this->assertSame('EN', $request->getLanguage()); $this->assertSame('0', $request->getServiceType()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('http://localhost/notify', $request->getNotifyUrl());*/ } public function testCompletePurchase() { /** @var \Omnipay\TargetPay\Message\CompletePurchaseRequest $request */ $request = $this->gateway->completePurchase(array( 'transactionId' => '123456', 'exchangeOnce' => true, )); $this->assertInstanceOf('Omnipay\TargetPay\Message\CompletePurchaseRequest', $request); $this->assertSame('123456', $request->getTransactionId()); $this->assertTrue($request->getExchangeOnce()); } } tests/Mock/PurchaseSuccess.txt 0000604 00000000534 15174357056 0012456 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 20 Sep 2013 12:57:22 GMT Server: Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Content-Location: start.php Vary: negotiate TCN: choice Content-Length: 73 Content-Type: text/html; charset=ISO-8859-1 X-Pad: avoid browser bug 000000 15983095|https://www.targetpay.com/mrcash/start.php?trxid=15983095 tests/Mock/CompletePurchaseFailure.txt 0000604 00000000463 15174357056 0014127 0 ustar 00 HTTP/1.1 200 OK Date: Mon, 23 Sep 2013 14:50:58 GMT Server: Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Content-Location: check.php Vary: negotiate TCN: choice Content-Length: 32 Content-Type: text/html; charset=ISO-8859-1 X-Pad: avoid browser bug TP0013 Transaction was cancelled tests/Mock/PurchaseFailure.txt 0000604 00000000453 15174357056 0012435 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 20 Sep 2013 09:35:34 GMT Server: Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Content-Location: start.php Vary: negotiate TCN: choice Content-Length: 24 Content-Type: text/html; charset=ISO-8859-1 X-Pad: avoid browser bug TP0016 Account disabled. tests/Mock/FetchIssuersSuccess.txt 0000604 00000000525 15174357056 0013313 0 ustar 00 TTP/1.1 200 OK Date: Tue, 24 Sep 2013 12:38:19 GMT Server: Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c X-Powered-By: PHP/5.2.0-8+etch16 Transfer-Encoding: chunked Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <issuers><issuer id="0001">Sample 1</issuer><issuer id="0002">Sample 2</issuer></issuers> tests/Mock/CompletePurchaseSuccess.txt 0000604 00000000433 15174357056 0014145 0 ustar 00 HTTP/1.1 200 OK Date: Mon, 23 Sep 2013 14:50:39 GMT Server: Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Content-Location: check.php Vary: negotiate TCN: choice Content-Length: 9 Content-Type: text/html; charset=ISO-8859-1 X-Pad: avoid browser bug 000000 OK tests/Message/IdealCompletePurchaseRequestTest.php 0000604 00000001000 15174357056 0016416 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class IdealCompletePurchaseRequestTest extends TestCase { /** * @var IdealCompletePurchaseRequest */ private $request; protected function setUp() { $this->request = new IdealCompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/ideal/check', $this->request->getEndpoint()); } } tests/Message/PurchaseRequestTest.php 0000604 00000002571 15174357056 0014004 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Mockery as m; use Omnipay\Tests\TestCase; class PurchaseRequestTest extends TestCase { /** * @var PurchaseRequest */ private $request; protected function setUp() { $arguments = array($this->getHttpClient(), $this->getHttpRequest()); $this->request = m::mock('Omnipay\TargetPay\Message\PurchaseRequest[getData,getEndpoint]', $arguments); $this->request->shouldReceive('getData')->andReturn(array()); $this->request->shouldReceive('getEndpoint')->andReturn('http://localhost'); } public function testSendSuccess() { $this->setMockHttpResponse('PurchaseSuccess.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertEquals('https://www.targetpay.com/mrcash/start.php?trxid=15983095', $response->getRedirectUrl()); $this->assertEquals('15983095', $response->getTransactionReference()); } public function testSendFailure() { $this->setMockHttpResponse('PurchaseFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Account disabled.', $response->getMessage()); $this->assertEquals('TP0016', $response->getCode()); } } tests/Message/FetchIssuersRequestTest.php 0000604 00000001633 15174357056 0014637 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class FetchIssuersRequestTest extends TestCase { /** * @var FetchIssuersRequest */ private $request; protected function setUp() { $this->request = new FetchIssuersRequest($this->getHttpClient(), $this->getHttpRequest()); } /** * @dataProvider issuersProvider */ public function testSendSuccess($expected) { $this->setMockHttpResponse('FetchIssuersSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals($expected, $response->getIssuers()); } public function issuersProvider() { return array( array( array( '0001' => 'Sample 1', '0002' => 'Sample 2', ), ), ); } } tests/Message/IdealPurchaseRequestTest.php 0000604 00000002303 15174357056 0014734 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class IdealPurchaseRequestTest extends TestCase { /** * @var IdealPurchaseRequest */ private $request; protected function setUp() { $this->request = new IdealPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testData() { $this->request->setIssuer('0001'); $this->request->setAmount('100.00'); $this->request->setDescription('desc'); $this->request->setReturnUrl('http://localhost/return'); $data = $this->request->getData(); $this->assertArrayHasKey('rtlo', $data); $this->assertSame('0001', $data['bank']); $this->assertSame(10000, $data['amount']); $this->assertSame('desc', $data['description']); $this->assertArrayHasKey('language', $data); $this->assertArrayHasKey('currency', $data); $this->assertSame('http://localhost/return', $data['returnurl']); $this->assertArrayHasKey('reporturl', $data); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/ideal/start', $this->request->getEndpoint()); } } tests/Message/DirectebankingPurchaseRequestTest.php 0000604 00000002565 15174357056 0016641 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class DirectebankingPurchaseRequestTest extends TestCase { /** * @var DirectebankingPurchaseRequest */ private $request; protected function setUp() { $this->request = new DirectebankingPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testData() { $this->request->setAmount('100.00'); $this->request->setDescription('desc'); $this->request->setCountry('01'); $this->request->setServiceType('1'); $this->request->setClientIp('127.0.0.1'); $this->request->setReturnUrl('http://localhost/return'); $data = $this->request->getData(); $this->assertArrayHasKey('rtlo', $data); $this->assertSame('desc', $data['description']); $this->assertSame(10000, $data['amount']); $this->assertSame('01', $data['country']); $this->assertArrayHasKey('lang', $data); $this->assertSame('1', $data['type']); $this->assertSame('127.0.0.1', $data['userip']); $this->assertSame('http://localhost/return', $data['returnurl']); $this->assertArrayHasKey('reporturl', $data); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/directebanking/start', $this->request->getEndpoint()); } } tests/Message/CompletePurchaseRequestTest.php 0000604 00000002717 15174357056 0015477 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Mockery as m; use Omnipay\Tests\TestCase; class CompletePurchaseRequestTest extends TestCase { /** * @var CompletePurchaseRequest */ private $request; protected function setUp() { $request = $this->getHttpRequest(); $request->query->set('trxid', '123456'); $arguments = array($this->getHttpClient(), $request); $this->request = m::mock('Omnipay\TargetPay\Message\CompletePurchaseRequest[getEndpoint]', $arguments); $this->request->shouldReceive('getEndpoint')->andReturn('http://localhost'); } public function testData() { $data = $this->request->getData(); $this->assertArrayHasKey('rtlo', $data); $this->assertSame('123456', $data['trxid']); $this->assertArrayHasKey('once', $data); $this->assertArrayHasKey('test', $data); } public function testSendSuccess() { $this->setMockHttpResponse('CompletePurchaseSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); } public function testSendFailure() { $this->setMockHttpResponse('CompletePurchaseFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Transaction was cancelled', $response->getMessage()); $this->assertEquals('TP0013', $response->getCode()); } } tests/Message/MrcashPurchaseRequestTest.php 0000604 00000002234 15174357056 0015136 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class MrcashPurchaseRequestTest extends TestCase { /** * @var MrcashPurchaseRequest */ private $request; protected function setUp() { $this->request = new MrcashPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testData() { $this->request->setAmount('100.00'); $this->request->setDescription('desc'); $this->request->setClientIp('127.0.0.1'); $this->request->setReturnUrl('http://localhost/return'); $data = $this->request->getData(); $this->assertArrayHasKey('rtlo', $data); $this->assertSame(10000, $data['amount']); $this->assertSame('desc', $data['description']); $this->assertArrayHasKey('lang', $data); $this->assertSame('127.0.0.1', $data['userip']); $this->assertSame('http://localhost/return', $data['returnurl']); $this->assertArrayHasKey('reporturl', $data); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/mrcash/start', $this->request->getEndpoint()); } } tests/Message/MrcashCompletePurchaseRequestTest.php 0000604 00000001004 15174357056 0016621 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class MrcashCompletePurchaseRequestTest extends TestCase { /** * @var MrcashCompletePurchaseRequest */ private $request; protected function setUp() { $this->request = new MrcashCompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/mrcash/check', $this->request->getEndpoint()); } } tests/Message/DirectebankingCompletePurchaseRequestTest.php 0000604 00000001044 15174357056 0020321 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Tests\TestCase; class DirectebankingCompletePurchaseRequestTest extends TestCase { /** * @var DirectebankingCompletePurchaseRequest */ private $request; protected function setUp() { $this->request = new DirectebankingCompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testEndpoint() { $this->assertSame('https://www.targetpay.com/directebanking/check', $this->request->getEndpoint()); } } LICENSE 0000604 00000002047 15174357056 0005565 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. .gitignore 0000604 00000000060 15174357056 0006541 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml CONTRIBUTING.md 0000604 00000001040 15174357056 0007001 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. src/DirectebankingGateway.php 0000604 00000001657 15174357056 0012321 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\TargetPay\Message\CompletePurchaseRequest; /** * TargetPay Directebanking gateway. * * @link https://www.targetpay.com/info/directebanking-docu */ class DirectebankingGateway extends AbstractGateway { /** * {@inheritdoc} */ public function getName() { return 'TargetPay Directebanking'; } /** * {@inheritdoc} */ public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\DirectebankingPurchaseRequest', $parameters); } /** * Complete a purchase. * * @param array $parameters An array of options * * @return CompletePurchaseRequest */ public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\DirectebankingCompletePurchaseRequest', $parameters); } } src/Message/AbstractRequest.php 0000604 00000001016 15174357056 0012553 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest; abstract class AbstractRequest extends BaseAbstractRequest { public function getSubAccountId() { return $this->getParameter('subAccountId'); } public function setSubAccountId($value) { return $this->setParameter('subAccountId', $value); } /** * Get the endpoint for the request. * * @return string */ abstract public function getEndpoint(); } src/Message/CompletePurchaseRequest.php 0000604 00000001703 15174357056 0014256 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; abstract class CompletePurchaseRequest extends AbstractRequest { public function getExchangeOnce() { return $this->getParameter('exchangeOnce'); } public function setExchangeOnce($value) { return $this->setParameter('exchangeOnce', $value); } /** * {@inheritdoc} */ public function getData() { return array( 'rtlo' => $this->getSubAccountId(), 'trxid' => $this->httpRequest->query->get('trxid'), 'once' => $this->getExchangeOnce(), 'test' => $this->getTestMode(), ); } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->get( $this->getEndpoint().'?'.http_build_query($data) )->send(); return $this->response = new CompletePurchaseResponse($this, $httpResponse->getBody(true)); } } src/Message/DirectebankingPurchaseRequest.php 0000604 00000002454 15174357056 0015423 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class DirectebankingPurchaseRequest extends PurchaseRequest { public function getCountry() { return $this->getParameter('country'); } public function setCountry($value) { return $this->setParameter('country', $value); } public function getServiceType() { return $this->getParameter('serviceType'); } public function setServiceType($value) { return $this->setParameter('serviceType', $value); } /** * {@inheritdoc} */ public function getData() { $this->validate('amount', 'description', 'country', 'serviceType', 'clientIp', 'returnUrl'); return array( 'rtlo' => $this->getSubAccountId(), 'description' => $this->getDescription(), 'amount' => $this->getAmountInteger(), 'country' => $this->getCountry(), 'lang' => $this->getLanguage(), 'type' => $this->getServiceType(), 'userip' => $this->getClientIp(), 'returnurl' => $this->getReturnUrl(), 'reporturl' => $this->getNotifyUrl(), ); } /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/directebanking/start'; } } src/Message/IdealCompletePurchaseRequest.php 0000604 00000000377 15174357056 0015223 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class IdealCompletePurchaseRequest extends CompletePurchaseRequest { /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/ideal/check'; } } src/Message/AbstractResponse.php 0000604 00000001743 15174357056 0012730 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse; use Omnipay\Common\Message\RequestInterface; abstract class AbstractResponse extends BaseAbstractResponse { /** * @var string */ protected $code; /** * {@inheritdoc} */ public function __construct(RequestInterface $request, $data) { parent::__construct($request, $data); if (false !== preg_match('/^([A-Z0-9]{6})(.*)$/', $this->data, $matches)) { $this->code = trim($matches[1]); $this->data = trim($matches[2]); } } /** * {@inheritdoc} */ public function getMessage() { if (!$this->isSuccessful()) { return $this->data; } return null; } /** * {@inheritdoc} */ public function getCode() { if (!$this->isSuccessful()) { return $this->code; } return null; } } src/Message/FetchIssuersRequest.php 0000604 00000001202 15174357056 0013414 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest; class FetchIssuersRequest extends BaseAbstractRequest { /** * @var string */ protected $endpoint = 'https://www.targetpay.com/ideal/getissuers.php?format=xml'; /** * {@inheritdoc} */ public function getData() { return null; } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->get($this->endpoint)->send(); return $this->response = new FetchIssuersResponse($this, $httpResponse->xml()); } } src/Message/FetchIssuersResponse.php 0000604 00000001125 15174357056 0013566 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse; class FetchIssuersResponse extends BaseAbstractResponse { /** * {@inheritdoc} */ public function isSuccessful() { return true; } /** * Return available issuers as an associative array. * * @return array */ public function getIssuers() { $result = array(); foreach ($this->data as $issuer) { $result[(string) $issuer['id']] = (string) $issuer; } return $result; } } src/Message/MrcashPurchaseRequest.php 0000604 00000001405 15174357056 0013722 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class MrcashPurchaseRequest extends PurchaseRequest { /** * {@inheritdoc} */ public function getData() { $this->validate('amount', 'description', 'clientIp', 'returnUrl'); return array( 'rtlo' => $this->getSubAccountId(), 'amount' => $this->getAmountInteger(), 'description' => $this->getDescription(), 'lang' => $this->getLanguage(), 'userip' => $this->getClientIp(), 'returnurl' => $this->getReturnUrl(), 'reporturl' => $this->getNotifyUrl(), ); } /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/mrcash/start'; } } src/Message/DirectebankingCompletePurchaseRequest.php 0000604 00000000421 15174357056 0017104 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class DirectebankingCompletePurchaseRequest extends CompletePurchaseRequest { /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/directebanking/check'; } } src/Message/PurchaseRequest.php 0000604 00000001146 15174357056 0012566 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; abstract class PurchaseRequest extends AbstractRequest { public function getLanguage() { return $this->getParameter('language'); } public function setLanguage($value) { return $this->setParameter('language', $value); } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->get( $this->getEndpoint().'?'.http_build_query($data) )->send(); return $this->response = new PurchaseResponse($this, $httpResponse->getBody(true)); } } src/Message/CompletePurchaseResponse.php 0000604 00000000346 15174357056 0014426 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class CompletePurchaseResponse extends AbstractResponse { /** * {@inheritdoc} */ public function isSuccessful() { return '000000' === $this->code; } } src/Message/IdealPurchaseRequest.php 0000604 00000001765 15174357056 0013534 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class IdealPurchaseRequest extends PurchaseRequest { public function getIssuer() { return $this->getParameter('issuer'); } public function setIssuer($value) { return $this->setParameter('issuer', $value); } /** * {@inheritdoc} */ public function getData() { $this->validate('issuer', 'amount', 'description', 'returnUrl'); return array( 'rtlo' => $this->getSubAccountId(), 'bank' => $this->getIssuer(), 'amount' => $this->getAmountInteger(), 'description' => $this->getDescription(), 'language' => $this->getLanguage(), 'currency' => $this->getCurrency(), 'returnurl' => $this->getReturnUrl(), 'reporturl' => $this->getNotifyUrl(), ); } /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/ideal/start'; } } src/Message/PurchaseResponse.php 0000604 00000002117 15174357056 0012733 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; use Omnipay\Common\Message\RedirectResponseInterface; class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { /** * {@inheritdoc} */ public function isSuccessful() { return false; } /** * {@inheritdoc} */ public function isRedirect() { return '000000' === $this->code; } /** * {@inheritdoc} */ public function getRedirectUrl() { $parts = explode('|', $this->data); if (2 == count($parts)) { return $parts[1]; } return null; } /** * {@inheritdoc} */ public function getRedirectMethod() { return 'GET'; } /** * {@inheritdoc} */ public function getRedirectData() { return null; } /** * {@inheritdoc} */ public function getTransactionReference() { $parts = explode('|', $this->data); if (2 == count($parts)) { return $parts[0]; } return null; } } src/Message/MrcashCompletePurchaseRequest.php 0000604 00000000401 15174357056 0015406 0 ustar 00 <?php namespace Omnipay\TargetPay\Message; class MrcashCompletePurchaseRequest extends CompletePurchaseRequest { /** * {@inheritdoc} */ public function getEndpoint() { return 'https://www.targetpay.com/mrcash/check'; } } src/MrcashGateway.php 0000604 00000001624 15174357056 0010617 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\TargetPay\Message\CompletePurchaseRequest; /** * TargetPay MrCash gateway. * * @link https://www.targetpay.com/docs/TargetPay_MisterCash_V1.0_nl.pdf */ class MrcashGateway extends AbstractGateway { /** * {@inheritdoc} */ public function getName() { return 'TargetPay MrCash'; } /** * {@inheritdoc} */ public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\MrcashPurchaseRequest', $parameters); } /** * Complete a purchase. * * @param array $parameters An array of options * * @return CompletePurchaseRequest */ public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\MrcashCompletePurchaseRequest', $parameters); } } src/AbstractGateway.php 0000604 00000001102 15174357056 0011134 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\Common\AbstractGateway as BaseAbstractGateway; /** * Abstract TargetPay gateway. */ abstract class AbstractGateway extends BaseAbstractGateway { /** * {@inheritdoc} */ public function getDefaultParameters() { return array( 'subAccountId' => '', ); } public function getSubAccountId() { return $this->getParameter('subAccountId'); } public function setSubAccountId($value) { return $this->setParameter('subAccountId', $value); } } src/IdealGateway.php 0000604 00000002400 15174357056 0010411 0 ustar 00 <?php namespace Omnipay\TargetPay; use Omnipay\TargetPay\Message\CompletePurchaseRequest; use Omnipay\TargetPay\Message\FetchIssuersRequest; /** * TargetPay iDEAL gateway. * * @link https://www.targetpay.com/docs/TargetPay_iDEAL_V1.0_nl.pdf */ class IdealGateway extends AbstractGateway { /** * {@inheritdoc} */ public function getName() { return 'TargetPay iDEAL'; } /** * Retrieve iDEAL issuers. * * @param array $parameters An array of options * * @return FetchIssuersRequest */ public function fetchIssuers(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\FetchIssuersRequest', $parameters); } /** * {@inheritdoc} */ public function purchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\IdealPurchaseRequest', $parameters); } /** * Complete a purchase. * * @param array $parameters An array of options * * @return CompletePurchaseRequest */ public function completePurchase(array $parameters = array()) { return $this->createRequest('\Omnipay\TargetPay\Message\IdealCompletePurchaseRequest', $parameters); } } README.md 0000604 00000003633 15174357056 0006041 0 ustar 00 # Omnipay: TargetPay **TargetPay driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-targetpay) [](https://packagist.org/packages/omnipay/targetpay) [](https://packagist.org/packages/omnipay/targetpay) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements TargetPay 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/targetpay": "~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: * TargetPay_Directebanking * TargetPay_Ideal * TargetPay_Mrcash 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-targetpay/issues), or better yet, fork the library and submit a pull request. composer.json 0000604 00000001660 15174357056 0007302 0 ustar 00 { "name": "omnipay/targetpay", "type": "library", "description": "TargetPay driver for the Omnipay payment processing library", "keywords": [ "gateway", "merchant", "omnipay", "pay", "payment", "targetpay" ], "homepage": "https://github.com/thephpleague/omnipay-targetpay", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-targetpay/contributors" } ], "autoload": { "psr-4": { "Omnipay\\TargetPay\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings