File manager - Edit - /home/opticamezl/www/newok/multisafepay.tar
Back
tests/Mock/RestFetchIssuersSuccess.txt 0000604 00000001124 15173312062 0014130 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 09:18:54 GMT Server: Apache Vary: Accept-Encoding Content-Length: 214 Content-Type: application/json; charset=UTF-8; {"success":true,"data":[{"code":"0031","description":"ABN AMRO"},{"code":"0751","description":"SNS Bank"},{"code":"0721","description":"ING"},{"code":"0021","description":"Rabobank"},{"code":"0761","description":"ASN Bank"},{"code":"0771","description":"Regio Bank"},{"code":"0511","description":"Triodos Bank"},{"code":"0161","description":"Van Lanschot Bankiers"},{"code":"0801","description":"Knab"},{"code":4371,"description":"Bunq"}]} tests/Mock/RestFetchPaymentMethodsSuccess.txt 0000604 00000000663 15173312062 0015443 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 10:25:42 GMT Server: Apache Vary: Accept-Encoding Content-Length: 52 Content-Type: application/json; charset=UTF-8; {"success":true,"data":[{"id":"BANKTRANS","description":"Wire Transfer"},{"id":"MAESTRO","description":"Maestro"},{"id":"VISA","description":"Visa"},{"id":"WALLET","description":"MultiSafepay"},{"id":"IDEAL","description":"iDEAL"},{"id":"MASTERCARD","description":"MasterCard"}]} tests/Mock/RestPurchaseSuccess.txt 0000604 00000000440 15173312062 0013273 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 09:18:54 GMT Server: Apache Vary: Accept-Encoding Content-Length: 131 Content-Type: application/json; charset=UTF-8; {"success":true,"data":{"order_id":"TEST-TRANS-1","payment_url":"https:\/\/testpay.multisafepay.com\/pay\/?order_id=TEST-TRANS-1"}} tests/Mock/XmlFetchIssuersSuccess.txt 0000604 00000001743 15173312062 0013762 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 13:21:39 GMT Server: Apache/2.2.16 (Debian) X-Powered-By: PHP/5.3.3-7+squeeze14 Vary: Accept-Encoding Content-Length: 810 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <idealissuers result="ok"><issuers><issuer><code>0031</code><description>ABN AMRO</description></issuer><issuer><code>0751</code><description>SNS Bank</description></issuer><issuer><code>0721</code><description>ING</description></issuer><issuer><code>0021</code><description>Rabobank</description></issuer><issuer><code>0091</code><description>Friesland Bank</description></issuer><issuer><code>0761</code><description>ASN Bank</description></issuer><issuer><code>0771</code><description>SNS Regio Bank</description></issuer><issuer><code>0511</code><description>Triodos Bank</description></issuer><issuer><code>0161</code><description>Van Lanschot Bankiers</description></issuer><issuer><code>0801</code><description>Knab</description></issuer></issuers></idealissuers> tests/Mock/XmlCompletePurchaseSuccess.txt 0000604 00000002107 15173312062 0014611 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 10:34:48 GMT Server: Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2 Content-Length: 931 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <status result="ok"><ewallet><id>2087325</id><status>completed</status><fastcheckout>NO</fastcheckout><created>20130711123308</created><modified>20130711123317</modified><reasoncode/><reason/></ewallet><customer><amount>10000</amount><currency>EUR</currency><account/><locale>en_US</locale><firstname/><lastname/><address1/><address2/><housenumber/><zipcode/><city/><state/><country/><countryname/><phone1/><phone2/><email>tester@example.com</email></customer><customer-delivery/><transaction><id>123456</id><currency>EUR</currency><amount>10000</amount><description>desc</description><var1/><var2/><var3/><items/></transaction><paymentdetails><type>IDEAL</type><accountid>213698412</accountid><accountholdername>Hr E G H Küppers en/of Mw M J Küppers an nog een lange consumername</accountholdername><externaltransactionid>0050000075107095</externaltransactionid></paymentdetails></status> tests/Mock/XmlPurchaseSuccess.txt 0000604 00000000644 15173312062 0013124 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 09:52:27 GMT Server: Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2 Content-Length: 256 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <redirecttransaction result="ok"><transaction><id>123456</id><payment_url>https://testpay.multisafepay.com/pay/?transaction=1373536347Hz4sFtg7WgMulO5q123456&lang=</payment_url></transaction></redirecttransaction> tests/Mock/XmlFetchPaymentMethodsSuccess.txt 0000604 00000001204 15173312062 0015256 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 12:31:26 GMT Server: Apache/2.2.16 (Debian) X-Powered-By: PHP/5.3.3-7+squeeze14 Vary: Accept-Encoding Content-Length: 459 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <gateways result="ok"><gateways><gateway><id>VISA</id><description>Visa CreditCards</description></gateway><gateway><id>WALLET</id><description>MultiSafepay</description></gateway><gateway><id>IDEAL</id><description>iDEAL</description></gateway><gateway><id>BANKTRANS</id><description>Bank Transfer</description></gateway><gateway><id>MASTERCARD</id><description>MasterCard</description></gateway></gateways></gateways> tests/Mock/RestInvalidApiKeyFailure.txt 0000604 00000000350 15173312062 0014171 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 10:11:02 GMT Server: Apache Vary: Accept-Encoding Content-Length: 95 Content-Type: application/json; charset=UTF-8; {"success":false,"data":{},"error_code":1032,"error_info":"Invalid API key"} tests/Mock/XmlFetchPaymentMethodsFailure.txt 0000604 00000000536 15173312062 0015244 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 12:32:27 GMT Server: Apache/2.2.16 (Debian) X-Powered-By: PHP/5.3.3-7+squeeze14 Vary: Accept-Encoding Content-Length: 165 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <gateways result="error"><error><code>1005</code><description>Invalid merchant security code</description></error></gateways> tests/Mock/XmlPurchaseFailure.txt 0000604 00000000571 15173312062 0013102 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 10:06:38 GMT Server: Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2 Content-Length: 213 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <redirecttransaction result="error"><error><code>1001</code><description>Invalid amount</description></error><transaction><id>123456</id></transaction></redirecttransaction> tests/Mock/RestPurchaseInvalidAmount.txt 0000604 00000000347 15173312062 0014443 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 10:11:02 GMT Server: Apache Vary: Accept-Encoding Content-Length: 75 Content-Type: application/json; charset=UTF-8; {"success":false,"data":{},"error_code":1001,"error_info":"Invalid amount"} tests/Mock/XmlCompletePurchaseFailure.txt 0000604 00000000475 15173312062 0014576 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 10:36:27 GMT Server: Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2 Content-Length: 153 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <status result="error"><error><code>1016</code><description>Back-end: missing data</description></error></status> tests/Mock/RestFetchIssuersFailure.txt 0000604 00000000341 15173312062 0014107 0 ustar 00 HTTP/1.1 200 OK Date: Fri, 05 Feb 2016 10:11:02 GMT Server: Apache Vary: Accept-Encoding Content-Length: 88 Content-Type: application/json; charset=UTF-8; {"success":false,"data":{},"error_code":404,"error_info":"Not found"} tests/Mock/XmlFetchIssuersFailure.txt 0000604 00000000546 15173312062 0013741 0 ustar 00 HTTP/1.1 200 OK Date: Thu, 11 Jul 2013 13:22:17 GMT Server: Apache/2.2.16 (Debian) X-Powered-By: PHP/5.3.3-7+squeeze14 Vary: Accept-Encoding Content-Length: 173 Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <idealissuers result="error"><error><code>1005</code><description>Invalid merchant security code</description></error></idealissuers> tests/RestGatewayTest.php 0000604 00000003076 15173312062 0011520 0 ustar 00 <?php namespace Omnipay\MultiSafepay; use Omnipay\Tests\GatewayTestCase; class RestGatewayTest extends GatewayTestCase { /** * @var Gateway */ protected $gateway; /** * @{inheritdoc} */ protected function setUp() { parent::setUp(); $this->gateway = new RestGateway( $this->getHttpClient(), $this->getHttpRequest() ); $this->gateway->setApiKey('123456789'); } public function testFetchPaymentMethodsRequest() { $request = $this->gateway->fetchPaymentMethods( array('country' => 'NL') ); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestFetchPaymentMethodsRequest', $request); $this->assertEquals('NL', $request->getCountry()); } public function testFetchIssuersRequest() { $request = $this->gateway->fetchIssuers(); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestFetchIssuersRequest', $request); } public function testPurchaseRequest() { $request = $this->gateway->purchase(array('amount' => 10.00)); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestPurchaseRequest', $request); $this->assertEquals($request->getAmount(), 10.00); } public function testCompletePurchaseRequest() { $request = $this->gateway->completePurchase(array('amount' => 10.00)); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestCompletePurchaseRequest', $request); $this->assertEquals($request->getAmount(), 10.00); } } tests/Message/RestPurchaseRequestTest.php 0000604 00000006502 15173312062 0014623 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class RestPurchaseRequestTest extends TestCase { /** * @var PurchaseRequest */ private $request; protected function setUp() { $this->request = new RestPurchaseRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize( array( 'apiKey' => '123456789', 'amount' => 10.00, 'currency' => 'eur', 'description' => 'Test transaction', 'cancel_url' => 'http://localhost/cancel', 'notify_url' => 'http://localhost/notify', 'return_url' => 'http://localhost/return', 'close_window' => false, 'days_active' => 3, 'send_mail' => true, 'gateway' => 'IDEAL', 'google_analytics_code' => '123456789', 'manual' => false, 'transactionId' => 'TEST-TRANS-1', 'type' => 'redirect', 'var1' => 'extra data 1', 'var2' => 'extra data 2', 'var3' => 'extra data 3', ) ); } public function testSendSuccess() { $this->setMockHttpResponse('RestPurchaseSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertEquals( 'https://testpay.multisafepay.com/pay/?order_id=TEST-TRANS-1', $response->getRedirectUrl() ); $this->assertEquals('TEST-TRANS-1', $response->getTransactionId()); } public function testInvalidAmount() { $this->setMockHttpResponse('RestPurchaseInvalidAmount.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Invalid amount', $response->getMessage()); $this->assertEquals(1001, $response->getCode()); } public function testDataIntegrity() { $this->assertEquals('123456789', $this->request->getGoogleAnalyticsCode()); $this->assertEquals('EUR', $this->request->getCurrency()); $this->assertEquals('extra data 1', $this->request->getVar1()); $this->assertEquals('extra data 2', $this->request->getVar2()); $this->assertEquals('extra data 3', $this->request->getVar3()); $this->assertEquals('http://localhost/cancel', $this->request->getCancelUrl()); $this->assertEquals('http://localhost/notify', $this->request->getNotifyUrl()); $this->assertEquals('http://localhost/return', $this->request->getReturnUrl()); $this->assertEquals('IDEAL', $this->request->getGateway()); $this->assertEquals('redirect', $this->request->getType()); $this->assertEquals('Test transaction', $this->request->getDescription()); $this->assertEquals('TEST-TRANS-1', $this->request->getTransactionId()); $this->assertEquals(10.00, $this->request->getAmount()); $this->assertEquals(3, $this->request->getDaysActive()); $this->assertFalse($this->request->getCloseWindow()); $this->assertFalse($this->request->getManual()); $this->assertTrue($this->request->getSendMail()); } } tests/Message/XmlFetchPaymentMethodsRequestTest.php 0000604 00000004747 15173312062 0016620 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class XmlFetchPaymentMethodsRequestTest extends TestCase { /** * @var FetchPaymentMethodsRequest */ private $request; protected function setUp() { $this->request = new FetchPaymentMethodsRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize(array( 'accountId' => '111111', 'siteId' => '222222', 'siteCode' => '333333', 'country' => 'NL', )); } /** * @dataProvider paymentMethodsProvider */ public function testSendSuccess($expected) { $this->setMockHttpResponse('XmlFetchPaymentMethodsSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals($expected, $response->getPaymentMethods()); } public function testSendFailure() { $this->setMockHttpResponse('XmlFetchPaymentMethodsFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Invalid merchant security code', $response->getMessage()); $this->assertEquals(1005, $response->getCode()); } /** * @dataProvider dataProvider */ public function testGetData($xml) { $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } public function paymentMethodsProvider() { return array( array( array( 'VISA' => 'Visa CreditCards', 'WALLET' => 'MultiSafepay', 'IDEAL' => 'iDEAL', 'BANKTRANS' => 'Bank Transfer', 'MASTERCARD' => 'MasterCard', ), ), ); } public function dataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <gateways ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> </merchant> <customer> <country>NL</country> </customer> </gateways> EOF; return array( array($xml), ); } } tests/Message/XmlCompletePurchaseRequestTest.php 0000604 00000005764 15173312062 0016150 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class XmlCompletePurchaseRequestTest extends TestCase { /** * @var CompletePurchaseRequest */ private $request; protected function setUp() { $this->request = new CompletePurchaseRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize(array( 'accountId' => '111111', 'siteId' => '222222', 'siteCode' => '333333', 'notifyUrl' => 'http://localhost/notify', 'cancelUrl' => 'http://localhost/cancel', 'returnUrl' => 'http://localhost/return', 'gateway' => 'IDEAL', 'issuer' => 'issuer', 'transactionId' => '123456', 'currency' => 'EUR', 'amount' => '100.00', 'description' => 'desc', 'extraData1' => 'extra 1', 'extraData2' => 'extra 2', 'extraData3' => 'extra 3', 'language' => 'a language', 'clientIp' => '127.0.0.1', 'googleAnalyticsCode' => 'analytics code', 'card' => array( 'email' => 'something@example.com', 'firstName' => 'first name', 'lastName' => 'last name', 'address1' => 'address 1', 'address2' => 'address 2', 'postcode' => '1000', 'city' => 'a city', 'country' => 'a country', 'phone' => 'phone number', ) )); } public function testSendSuccess() { $this->setMockHttpResponse('XmlCompletePurchaseSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('123456', $response->getTransactionReference()); } public function testSendFailure() { $this->setMockHttpResponse('XmlCompletePurchaseFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Back-end: missing data', $response->getMessage()); $this->assertEquals(1016, $response->getCode()); } /** * @dataProvider dataProvider */ public function testGetData($xml) { $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } public function dataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <status ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> </merchant> <transaction> <id>123456</id> </transaction> </status> EOF; return array( array($xml), ); } } tests/Message/XmlPurchaseRequestTest.php 0000604 00000021463 15173312062 0014451 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; use ReflectionMethod; class XmlPurchaseRequestTest extends TestCase { /** * @var PurchaseRequest */ private $request; protected function setUp() { $this->request = new PurchaseRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize(array( 'accountId' => '111111', 'siteId' => '222222', 'siteCode' => '333333', 'notifyUrl' => 'http://localhost/notify', 'cancelUrl' => 'http://localhost/cancel', 'returnUrl' => 'http://localhost/return', 'gateway' => 'IDEAL', 'issuer' => 'issuer', 'transactionId' => '123456', 'currency' => 'EUR', 'amount' => '100.00', 'description' => 'desc', 'extraData1' => 'extra 1', 'extraData2' => 'extra 2', 'extraData3' => 'extra 3', 'language' => 'a language', 'items' => array( array('name' => 'item 1', 'quantity' => 1), array('name' => 'item 2', 'quantity' => 2) ), 'clientIp' => '127.0.0.1', 'googleAnalyticsCode' => 'analytics code', 'card' => array( 'email' => 'something@example.com', 'firstName' => 'first name', 'lastName' => 'last name', 'address1' => 'address 1', 'address2' => 'address 2', 'postcode' => '1000', 'city' => 'a city', 'country' => 'a country', 'phone' => 'phone number', ) )); } public function testSendSuccess() { $this->setMockHttpResponse('XmlPurchaseSuccess.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertEquals( 'https://testpay.multisafepay.com/pay/?transaction=1373536347Hz4sFtg7WgMulO5q123456&lang=', $response->getRedirectUrl() ); $this->assertEquals('123456', $response->getTransactionReference()); } public function testSendFailure() { $this->setMockHttpResponse('XmlPurchaseFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Invalid amount', $response->getMessage()); $this->assertEquals(1001, $response->getCode()); } /** * @dataProvider allDataProvider */ public function testGetData($xml) { $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } /** * @dataProvider noIssuerDataProvider */ public function testGetDataWithNonIDEALGatewayDoesNotSetIssuer($xml) { $this->request->setGateway('another'); $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } /** * @dataProvider specialCharsDataProvider */ public function testGetDataWithUrlsWithSpecialChars($xml) { $this->request->setReturnUrl('http://localhost/?one=1&two=2'); $this->request->setCancelUrl('http://localhost/?one=1&two=2'); $this->request->setNotifyUrl('http://localhost/?one=1&two=2'); $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } /** * @covers \Omnipay\MultiSafepay\Message\PurchaseRequest::generateSignature() */ public function testGenerateSignature() { $method = new ReflectionMethod('\Omnipay\MultiSafepay\Message\PurchaseRequest', 'generateSignature'); $method->setAccessible(true); $signature = $method->invoke($this->request); $this->assertEquals('ad447bab87b8597853432c891e341db1', $signature); } public function allDataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <directtransaction ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> <notification_url>http://localhost/notify</notification_url> <cancel_url>http://localhost/cancel</cancel_url> <redirect_url>http://localhost/return</redirect_url> </merchant> <customer> <ipaddress>127.0.0.1</ipaddress> <locale>a language</locale> <email>something@example.com</email> <firstname>first name</firstname> <lastname>last name</lastname> <address1>address 1</address1> <address2>address 2</address2> <zipcode>1000</zipcode> <city>a city</city> <country>a country</country> <phone>phone number</phone> </customer> <google_analytics>analytics code</google_analytics> <transaction> <id>123456</id> <currency>EUR</currency> <amount>10000</amount> <description>desc</description> <var1>extra 1</var1> <var2>extra 2</var2> <var3>extra 3</var3> <gateway>IDEAL</gateway> <items><ul><li>1 x item 1</li><li>2 x item 2</li></ul></items> </transaction> <gatewayinfo> <issuerid>issuer</issuerid> </gatewayinfo> <signature>ad447bab87b8597853432c891e341db1</signature> </directtransaction> EOF; return array( array($xml), ); } public function noIssuerDataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <redirecttransaction ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> <notification_url>http://localhost/notify</notification_url> <cancel_url>http://localhost/cancel</cancel_url> <redirect_url>http://localhost/return</redirect_url> </merchant> <customer> <ipaddress>127.0.0.1</ipaddress> <locale>a language</locale> <email>something@example.com</email> <firstname>first name</firstname> <lastname>last name</lastname> <address1>address 1</address1> <address2>address 2</address2> <zipcode>1000</zipcode> <city>a city</city> <country>a country</country> <phone>phone number</phone> </customer> <google_analytics>analytics code</google_analytics> <transaction> <id>123456</id> <currency>EUR</currency> <amount>10000</amount> <description>desc</description> <var1>extra 1</var1> <var2>extra 2</var2> <var3>extra 3</var3> <gateway>another</gateway> <items><ul><li>1 x item 1</li><li>2 x item 2</li></ul></items> </transaction> <signature>ad447bab87b8597853432c891e341db1</signature> </redirecttransaction> EOF; return array( array($xml), ); } public function specialCharsDataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <directtransaction ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> <notification_url>http://localhost/?one=1&two=2</notification_url> <cancel_url>http://localhost/?one=1&two=2</cancel_url> <redirect_url>http://localhost/?one=1&two=2</redirect_url> </merchant> <customer> <ipaddress>127.0.0.1</ipaddress> <locale>a language</locale> <email>something@example.com</email> <firstname>first name</firstname> <lastname>last name</lastname> <address1>address 1</address1> <address2>address 2</address2> <zipcode>1000</zipcode> <city>a city</city> <country>a country</country> <phone>phone number</phone> </customer> <google_analytics>analytics code</google_analytics> <transaction> <id>123456</id> <currency>EUR</currency> <amount>10000</amount> <description>desc</description> <var1>extra 1</var1> <var2>extra 2</var2> <var3>extra 3</var3> <gateway>IDEAL</gateway> <items><ul><li>1 x item 1</li><li>2 x item 2</li></ul></items> </transaction> <gatewayinfo> <issuerid>issuer</issuerid> </gatewayinfo> <signature>ad447bab87b8597853432c891e341db1</signature> </directtransaction> EOF; return array( array($xml), ); } } tests/Message/RestFetchPaymentMethodsRequestTest.php 0000604 00000002137 15173312062 0016764 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class RestFetchPaymentMethodsRequestTest extends TestCase { /** * @var FetchPaymentMethodsRequest */ private $request; protected function setUp() { $this->request = new RestFetchPaymentMethodsRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize( array( 'api_key' => '123456789', 'country' => 'NL' ) ); } public function testSendSuccess() { $this->setMockHttpResponse('RestFetchPaymentMethodsSuccess.txt'); $response = $this->request->send(); $paymentMethods = $response->getPaymentMethods(); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getTransactionReference()); $this->assertInternalType('array', $paymentMethods); $this->assertContainsOnlyInstancesOf('Omnipay\Common\PaymentMethod', $paymentMethods); } } tests/Message/RestFetchIssuersRequestTest.php 0000604 00000003202 15173312062 0015452 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class RestFetchIssuersRequestTest extends TestCase { /** * @var FetchIssuersRequest */ private $request; protected function setUp() { $this->request = new RestFetchIssuersRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize( array( 'api_key' => '123456789', 'paymentMethod' => 'IDEAL' ) ); } public function testSendSuccess() { $this->setMockHttpResponse('RestFetchIssuersSuccess.txt'); $response = $this->request->send(); $issuers = $response->getIssuers(); $this->assertContainsOnlyInstancesOf('Omnipay\Common\Issuer', $issuers); $this->assertFalse($response->isRedirect()); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestFetchIssuersResponse', $response); $this->assertInternalType('array', $issuers); $this->assertNull($response->getTransactionReference()); $this->assertTrue($response->isSuccessful()); } public function testIssuerNotFound() { $this->setMockHttpResponse('RestFetchIssuersFailure.txt'); $response = $this->request->send(); $this->assertEquals('Not found', $response->getMessage()); $this->assertEquals(404, $response->getCode()); $this->assertFalse($response->isRedirect()); $this->assertFalse($response->isSuccessful()); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\RestFetchIssuersResponse', $response); } } tests/Message/XmlAbstractRequestTest.php 0000604 00000002011 15173312062 0014426 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Mockery as m; use Omnipay\Tests\TestCase; use ReflectionMethod; class XmlAbstractRequestTest extends TestCase { /** * @var AbstractRequest */ private $request; protected function setUp() { $this->request = m::mock('\Omnipay\MultiSafepay\Message\AbstractRequest')->makePartial(); } /** * @covers \Omnipay\MultiSafepay\Message\AbstractRequest::getHeaders() */ public function testUserAgentHeaderMustNotBeSet() { $method = new ReflectionMethod('\Omnipay\MultiSafepay\Message\AbstractRequest', 'getHeaders'); $method->setAccessible(true); $headers = $method->invoke($this->request); $this->assertArrayHasKey( 'User-Agent', $headers, 'Omitting User-Agent header not allowed because then Guzzle will set it and cause 403 Forbidden on the gateway' ); $this->assertEquals('Omnipay', $headers['User-Agent'], 'User-Agent header set'); } } tests/Message/XmlFetchIssuersRequestTest.php 0000604 00000005053 15173312062 0015303 0 ustar 00 <?php namespace Omnipay\MultiSafepay\Message; use Omnipay\Tests\TestCase; class XmlFetchIssuersRequestTest extends TestCase { /** * @var FetchIssuersRequest */ private $request; protected function setUp() { $this->request = new FetchIssuersRequest( $this->getHttpClient(), $this->getHttpRequest() ); $this->request->initialize(array( 'accountId' => '111111', 'siteId' => '222222', 'siteCode' => '333333', )); } /** * @dataProvider issuersProvider */ public function testSendSuccess($expected) { $this->setMockHttpResponse('XmlFetchIssuersSuccess.txt'); $response = $this->request->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals($expected, $response->getIssuers()); } public function testSendFailure() { $this->setMockHttpResponse('XmlFetchIssuersFailure.txt'); $response = $this->request->send(); $this->assertFalse($response->isSuccessful()); $this->assertEquals('Invalid merchant security code', $response->getMessage()); $this->assertEquals(1005, $response->getCode()); } /** * @dataProvider dataProvider */ public function testGetData($xml) { $data = $this->request->getData(); $this->assertInstanceOf('SimpleXMLElement', $data); // Just so the provider remains readable... $dom = dom_import_simplexml($data)->ownerDocument; $dom->formatOutput = true; $this->assertEquals($xml, $dom->saveXML()); } public function issuersProvider() { return array( array( array( '0031' => 'ABN AMRO', '0751' => 'SNS Bank', '0721' => 'ING', '0021' => 'Rabobank', '0091' => 'Friesland Bank', '0761' => 'ASN Bank', '0771' => 'SNS Regio Bank', '0511' => 'Triodos Bank', '0161' => 'Van Lanschot Bankiers', '0801' => 'Knab', ), ), ); } public function dataProvider() { $xml = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <idealissuers ua="Omnipay"> <merchant> <account>111111</account> <site_id>222222</site_id> <site_secure_code>333333</site_secure_code> </merchant> </idealissuers> EOF; return array( array($xml), ); } } tests/XmlGatewayTest.php 0000604 00000014300 15173312062 0011333 0 ustar 00 <?php /** * MultiSafepay Xml Gateway Test. */ namespace Omnipay\MultiSafepay; use Omnipay\Common\CreditCard; use Omnipay\Tests\GatewayTestCase; /** * MultiSafepay Xml Gateway Test. */ class XmlGatewayTest extends GatewayTestCase { /** * @var Gateway */ protected $gateway; /** * @var array */ protected $options; /** * @{inheritdoc} */ protected function setUp() { parent::setUp(); $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setAccountId('111111'); $this->gateway->setSiteId('222222'); $this->gateway->setSiteCode('333333'); $this->options = array( 'notifyUrl' => 'http://localhost/notify', 'cancelUrl' => 'http://localhost/cancel', 'returnUrl' => 'http://localhost/return', 'gateway' => 'IDEAL', 'issuer' => 'issuer', 'transactionId' => '123456', 'currency' => 'EUR', 'amount' => '100.00', 'description' => 'desc', 'extraData1' => 'extra 1', 'extraData2' => 'extra 2', 'extraData3' => 'extra 3', 'language' => 'a language', 'clientIp' => '127.0.0.1', 'googleAnalyticsCode' => 'analytics code', 'card' => array( 'email' => 'something@example.com', 'firstName' => 'first name', 'lastName' => 'last name', 'address1' => 'address 1', 'address2' => 'address 2', 'postcode' => '1000', 'city' => 'a city', 'country' => 'a country', 'phone' => 'phone number', ) ); } public function testFetchPaymentMethods() { /** @var \Omnipay\MultiSafepay\Message\FetchPaymentMethodsRequest $request */ $request = $this->gateway->fetchPaymentMethods(array('country' => 'NL')); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\FetchPaymentMethodsRequest', $request); $this->assertEquals('NL', $request->getCountry()); } public function testFetchIssuers() { /** @var \Omnipay\MultiSafepay\Message\FetchIssuersRequest $request */ $request = $this->gateway->fetchIssuers(); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\FetchIssuersRequest', $request); } public function testPurchase() { /** @var \Omnipay\MultiSafepay\Message\PurchaseRequest $request */ $request = $this->gateway->purchase($this->options); /** @var CreditCard $card */ $card = $request->getCard(); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\PurchaseRequest', $request); $this->assertSame('http://localhost/notify', $request->getNotifyUrl()); $this->assertSame('http://localhost/cancel', $request->getCancelUrl()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('IDEAL', $request->getGateway()); $this->assertSame('issuer', $request->getIssuer()); $this->assertSame('123456', $request->getTransactionId()); $this->assertSame('EUR', $request->getCurrency()); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('extra 1', $request->getExtraData1()); $this->assertSame('extra 2', $request->getExtraData2()); $this->assertSame('extra 3', $request->getExtraData3()); $this->assertSame('a language', $request->getLanguage()); $this->assertSame('analytics code', $request->getGoogleAnalyticsCode()); $this->assertSame('127.0.0.1', $request->getClientIp()); $this->assertSame('something@example.com', $card->getEmail()); $this->assertSame('first name', $card->getFirstName()); $this->assertSame('last name', $card->getLastName()); $this->assertSame('address 1', $card->getAddress1()); $this->assertSame('address 2', $card->getAddress2()); $this->assertSame('1000', $card->getPostcode()); $this->assertSame('a city', $card->getCity()); $this->assertSame('a country', $card->getCountry()); $this->assertSame('phone number', $card->getPhone()); } public function testCompletePurchase() { /** @var \Omnipay\MultiSafepay\Message\CompletePurchaseRequest $request */ $request = $this->gateway->completePurchase($this->options); /** @var CreditCard $card */ $card = $request->getCard(); $this->assertInstanceOf('Omnipay\MultiSafepay\Message\CompletePurchaseRequest', $request); $this->assertSame('http://localhost/notify', $request->getNotifyUrl()); $this->assertSame('http://localhost/cancel', $request->getCancelUrl()); $this->assertSame('http://localhost/return', $request->getReturnUrl()); $this->assertSame('IDEAL', $request->getGateway()); $this->assertSame('issuer', $request->getIssuer()); $this->assertSame('123456', $request->getTransactionId()); $this->assertSame('EUR', $request->getCurrency()); $this->assertSame('100.00', $request->getAmount()); $this->assertSame('desc', $request->getDescription()); $this->assertSame('extra 1', $request->getExtraData1()); $this->assertSame('extra 2', $request->getExtraData2()); $this->assertSame('extra 3', $request->getExtraData3()); $this->assertSame('a language', $request->getLanguage()); $this->assertSame('analytics code', $request->getGoogleAnalyticsCode()); $this->assertSame('127.0.0.1', $request->getClientIp()); $this->assertSame('something@example.com', $card->getEmail()); $this->assertSame('first name', $card->getFirstName()); $this->assertSame('last name', $card->getLastName()); $this->assertSame('address 1', $card->getAddress1()); $this->assertSame('address 2', $card->getAddress2()); $this->assertSame('1000', $card->getPostcode()); $this->assertSame('a city', $card->getCity()); $this->assertSame('a country', $card->getCountry()); $this->assertSame('phone number', $card->getPhone()); } } composer.json 0000604 00000001733 15173312062 0007266 0 ustar 00 { "name": "omnipay/multisafepay", "type": "library", "description": "MultiSafepay driver for the Omnipay payment processing library", "keywords": [ "gateway", "merchant", "multi safepay", "multisafepay", "omnipay", "pay", "payment" ], "homepage": "https://github.com/thephpleague/omnipay-multisafepay", "license": "MIT", "authors": [ { "name": "Adrian Macneil", "email": "adrian@adrianmacneil.com" }, { "name": "Omnipay Contributors", "homepage": "https://github.com/thephpleague/omnipay-multisafepay/contributors" } ], "autoload": { "psr-4": { "Omnipay\\MultiSafepay\\" : "src/" } }, "require": { "omnipay/common": "~2.0" }, "require-dev": { "omnipay/tests": "~2.0" }, "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } } } phpunit.xml.dist 0000604 00000001512 15173312062 0007712 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> .gitignore 0000604 00000000060 15173312062 0006524 0 ustar 00 /vendor composer.lock composer.phar phpunit.xml LICENSE 0000604 00000002047 15173312062 0005550 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. CONTRIBUTING.md 0000604 00000001040 15173312062 0006764 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 00000000372 15173312062 0006653 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 README.md 0000604 00000003660 15173312062 0006024 0 ustar 00 # Omnipay: MultiSafepay **MultiSafepay driver for the Omnipay PHP payment processing library** [](https://travis-ci.org/thephpleague/omnipay-multisafepay) [](https://packagist.org/packages/omnipay/multisafepay) [](https://packagist.org/packages/omnipay/multisafepay) [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements MultiSafepay 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/multisafepay": "~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: * MultiSafepay_Rest * MultiSafepay_Xml (Deprecated) 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-multisafepay/issues), or better yet, fork the library and submit a pull request. src/RestGateway.php 0000604 00000016032 15173312062 0010301 0 ustar 00 <?php /** * MultiSafepay REST Api Gateway. */ namespace Omnipay\MultiSafepay; use Omnipay\Common\AbstractGateway; /** * MultiSafepay REST Api gateway. * * This class forms the gateway class for the MultiSafepay REST API. * * The MultiSafepay REST api is the latest version of their API and uses * HTTP verbs and a RESTful endpoint structure. The response payloads are * formatted as JSON and authentication happens via an api key within * the HTTP headers. * * ### Environments * * The MultiSafepay API support two different environments. A sandbox environment * which can be used for testing purposes. And a live environment for production processing. * * ### Sandbox environment * * The sandbox environment allows the user to test their implementation, transactions * will be created but no actual money will be involved. * * To use the sandbox environment the testMode parameter needs to be set on the gateway object. * This ensures that the sandbox endpoint will be used, instead of the production endpoint. * * ### Credentials * * Before you can use the API you need to register an account with MultiSafepay. * * To request access to the sandbox environment you need to register * at https://testmerchant.multisafepay.com/signup * * To request access to the live environment you need to register * at https://merchant.multisafepay.com/signup * * After you create your account, you can access the MultiSafepay dashboard which is located at * https://testmerchant.multisafepay.com or https://merchant.multisafepay.com depending * on the environment you use. * * To obtain an API key you first need to register your website with MultiSafepay. * This can be done within several steps: * * 1. Navigate to the create page: https://merchant.multisafepay.com/sites * 2. Fill out the required fields. * 3. Click save. * 4. You will be redirect to the site details page where you can find the API key. * * ### Initialize gateway * * <code> * // Create the gateway * $gateway = Omnipay::create('MultiSafepay_Rest'); * * // Initialise the gateway * $gateway->initialize(array( * 'apiKey' => 'API-KEY', * 'locale' => 'en', * 'testMode' => true, // Or false, when you want to use the production environment * )); * </code> * * ### Retrieve Payment Methods * * <code> * $request = $gateway->fetchPaymentMethods(); * $response = $request->send(); * $paymentMethods = $response->getPaymentMethods(); * </code> * * @link https://github.com/MultiSafepay/PHP * @link https://www.multisafepay.com/docs/getting-started/ * @link https://www.multisafepay.com/documentation/doc/API-Reference/ * @link https://www.multisafepay.com/documentation/doc/Step-by-Step/ * @link https://www.multisafepay.com/signup/ */ class RestGateway extends AbstractGateway { /** * @{inheritdoc} */ public function getName() { return 'MultiSafepay REST'; } /** * Get the gateway parameters * * @return array */ public function getDefaultParameters() { return array( 'apiKey' => '', 'locale' => 'en', 'testMode' => false, ); } /** * Get the locale. * * Optional ISO 639-1 language code which is used to specify a * a language used to display gateway information and other * messages in the responses. * * The default language is English. * * @return string */ public function getLocale() { return $this->getParameter('locale'); } /** * Set the locale. * * Optional ISO 639-1 language code which is used to specify a * a language used to display gateway information and other * messages in the responses. * * The default language is English. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setLocale($value) { return $this->setParameter('locale', $value); } /** * Get the gateway API Key * * Authentication is by means of a single secret API key set as * the apiKey parameter when creating the gateway object. * * @return string */ public function getApiKey() { return $this->getParameter('apiKey'); } /** * Set the gateway API Key * * Authentication is by means of a single secret API key set as * the apiKey parameter when creating the gateway object. * * @param string $value * @return RestGateway provides a fluent interface. */ public function setApiKey($value) { return $this->setParameter('apiKey', $value); } /** * Retrieve payment methods active on the given MultiSafepay * account. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\RestFetchPaymentMethodsRequest */ public function fetchPaymentMethods(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestFetchPaymentMethodsRequest', $parameters ); } /** * Retrieve issuers for gateway. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\RestFetchIssuersRequest */ public function fetchIssuers(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestFetchIssuersRequest', $parameters ); } /** * Retrieve transaction by the given identifier. * * @param array $parameters * @return \Omnipay\MultiSafepay\Message\RestFetchTransactionRequest */ public function fetchTransaction(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestFetchTransactionRequest', $parameters ); } /** * Create a refund. * * @param array $parameters * @return \Omnipay\MultiSafepay\Message\RestRefundRequest */ public function refund(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestRefundRequest', $parameters ); } /** * Create a purchase request. * * MultisafePay support different types of transactions, * such as iDEAL, Paypal and CreditCard payments. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\RestPurchaseRequest */ public function purchase(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestPurchaseRequest', $parameters ); } /** * Complete a payment request. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\RestCompletePurchaseRequest */ public function completePurchase(array $parameters = array()) { return $this->createRequest( 'Omnipay\MultiSafepay\Message\RestCompletePurchaseRequest', $parameters ); } } src/Gateway.php 0000604 00000000605 15173312062 0007442 0 ustar 00 <?php /** * MultiSafepay XML Api Gateway. */ namespace Omnipay\MultiSafepay; /** * MultiSafepay XML Api gateway. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. * * @link https://www.multisafepay.com/downloads/handleidingen/Handleiding_connect(ENG).pdf */ class Gateway extends XmlGateway { } src/XmlGateway.php 0000604 00000007367 15173312062 0010137 0 ustar 00 <?php /** * MultiSafepay XML Api Gateway. */ namespace Omnipay\MultiSafepay; use Omnipay\Common\AbstractGateway; /** * MultiSafepay XML Api gateway. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. * * * ### Initialize gateway * * <code> * // Create the gateway * $gateway = Omnipay::create('MultiSafepay_Xml'); * * // Initialise the gateway * $gateway->initialize(array( * 'apiKey' => 'API-KEY', * 'locale' => 'en', * 'testMode' => true, // Or false, when you want to use the production environment * )); * </code> * * @link https://www.multisafepay.com/downloads/handleidingen/Handleiding_connect(ENG).pdf */ class XmlGateway extends AbstractGateway { /** * {@inheritdoc} */ public function getName() { return 'MultiSafepay XML'; } /** * {@inheritdoc} */ public function getDefaultParameters() { return array( 'accountId' => '', 'siteId' => '', 'siteCode' => '', 'testMode' => false, ); } /** * Get the account identifier. * * @return mixed */ public function getAccountId() { return $this->getParameter('accountId'); } /** * Set the account identifier. * * @param $value * @return $this */ public function setAccountId($value) { return $this->setParameter('accountId', $value); } /** * Get the site identifier. * * @return mixed */ public function getSiteId() { return $this->getParameter('siteId'); } /** * Set the site identifier. * * @param $value * @return $this */ public function setSiteId($value) { return $this->setParameter('siteId', $value); } /** * Get the site code. * * @return mixed */ public function getSiteCode() { return $this->getParameter('siteCode'); } /** * Set the site code. * * @param $value * @return $this */ public function setSiteCode($value) { return $this->setParameter('siteCode', $value); } /** * Retrieve payment methods active on the given MultiSafepay * account. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\FetchPaymentMethodsRequest */ public function fetchPaymentMethods(array $parameters = array()) { return $this->createRequest( '\Omnipay\MultiSafepay\Message\FetchPaymentMethodsRequest', $parameters ); } /** * Retrieve iDEAL issuers. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\FetchIssuersRequest */ public function fetchIssuers(array $parameters = array()) { return $this->createRequest( '\Omnipay\MultiSafepay\Message\FetchIssuersRequest', $parameters ); } /** * Create Purchase request. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\PurchaseRequest */ public function purchase(array $parameters = array()) { return $this->createRequest( '\Omnipay\MultiSafepay\Message\PurchaseRequest', $parameters ); } /** * Complete purchase request. * * @param array $parameters * * @return \Omnipay\MultiSafepay\Message\CompletePurchaseRequest */ public function completePurchase(array $parameters = array()) { return $this->createRequest( '\Omnipay\MultiSafepay\Message\CompletePurchaseRequest', $parameters ); } } src/Message/RestAbstractResponse.php 0000604 00000003413 15173312062 0013545 0 ustar 00 <?php /** * MultiSafepay Rest Api Abstract Response class. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\AbstractResponse; /** * MultiSafepay Rest Api Abstract Response class. * * All Response classes within the Rest namespace * inheritance from this class. */ abstract class RestAbstractResponse extends AbstractResponse { /** * Is the response successful? * * @return boolean */ public function isSuccessful() { if (! isset($this->data['success'])) { return false; } return $this->data['success']; } /** * Response Message. * * @return null|string A response message from the payment gateway */ public function getMessage() { if (!$this->isSuccessful() && isset($this->data['error_info'])) { return $this->data['error_info']; } } /** * Response code. * * @return null|string A response code from the payment gateway */ public function getCode() { if (! $this->isSuccessful() && isset($this->data['error_code'])) { return $this->data['error_code']; } } /** * Gateway Reference. * * @return null|string A reference provided by the gateway to represent this transaction */ public function getTransactionReference() { if (isset($this->data['data']['transaction_id'])) { return $this->data['data']['transaction_id']; } } /** * Get the transaction ID as generated by the merchant website. * * @return string */ public function getTransactionId() { if (isset($this->data['data']['order_id'])) { return $this->data['data']['order_id']; } } } src/Message/FetchPaymentMethodsRequest.php 0000604 00000003374 15173312062 0014717 0 ustar 00 <?php /** * MultiSafepay XML Api Fetch Payment Methods Request. */ namespace Omnipay\MultiSafepay\Message; use SimpleXMLElement; /** * MultiSafepay XML Api Fetch Payment Methods Request. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class FetchPaymentMethodsRequest extends AbstractRequest { /** * Get the country. * * @return mixed */ public function getCountry() { return $this->getParameter('country'); } /** * Set the country. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setCountry($value) { return $this->setParameter('country', $value); } /** * {@inheritdoc} */ public function getData() { $data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><gateways/>'); $data->addAttribute('ua', $this->userAgent); $merchant = $data->addChild('merchant'); $merchant->addChild('account', $this->getAccountId()); $merchant->addChild('site_id', $this->getSiteId()); $merchant->addChild('site_secure_code', $this->getSiteCode()); $customer = $data->addChild('customer'); $customer->addChild('country', $this->getCountry()); return $data; } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->post( $this->getEndpoint(), $this->getHeaders(), $data->asXML() )->send(); $this->response = new FetchPaymentMethodsResponse( $this, $httpResponse->xml() ); return $this->response; } } src/Message/PurchaseResponse.php 0000604 00000003127 15173312062 0012720 0 ustar 00 <?php /** * MultiSafepay XML Api Purchase Response. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\RedirectResponseInterface; /** * MultiSafepay XML Api Purchase Response. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { /** * {@inheritdoc} */ public function getTransactionReference() { if (isset($this->data->transaction->id)) { return (string)$this->data->transaction->id; } } /** * {@inheritdoc} */ public function isSuccessful() { return false; } /** * {@inheritdoc} */ public function isRedirect() { if (isset($this->data->transaction->payment_url) || isset($this->data->gatewayinfo->redirecturl) ) { return true; } return false; } /** * {@inheritdoc} */ public function getRedirectUrl() { if (isset($this->data->gatewayinfo->redirecturl)) { return (string)$this->data->gatewayinfo->redirecturl; } if (isset($this->data->transaction->payment_url)) { return (string) $this->data->transaction->payment_url; } return null; } /** * {@inheritdoc} */ public function getRedirectMethod() { return 'GET'; } /** * {@inheritdoc} */ public function getRedirectData() { return null; } } src/Message/RestRefundResponse.php 0000604 00000001754 15173312062 0013233 0 ustar 00 <?php /** * MultiSafepay Rest Api Refund Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Refund Response. * * The MultiSafepay API support refunds, meaning you can refund any * transaction to the customer. The fund will be deducted * from the MultiSafepay balance. * * The API also support partial refunds which means that only a * part of the amount will be refunded. * * When a transaction has been refunded the status will change to * "refunded". When the transaction has only been partial refunded the * status will change to "partial_refunded". * * ### Example * * <code> * $request = $this->gateway->refund(); * * $request->setTransactionId('test-transaction'); * $request->setAmount('10.00'); * $request->setCurrency('eur'); * $request->setDescription('Test Refund'); * * $response = $request->send(); * var_dump($response->isSuccessful()); * </code> */ class RestRefundResponse extends RestAbstractResponse { } src/Message/RestFetchPaymentMethodsResponse.php 0000604 00000002562 15173312062 0015721 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Payment Methods Response. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\FetchPaymentMethodsResponseInterface; use Omnipay\Common\PaymentMethod; /** * MultiSafepay Rest Api Fetch Payment Methods Response. * * The MultiSafepay API supports multiple payment gateways, such as * iDEAL, Paypal or CreditCard. * * This response class will be returned when using the * RestFetchPaymentMethodsRequest. And provides a list of * all supported payment methods. * * ### Example * * <code> * $request = $gateway->fetchPaymentMethods(); * $response = $request->send(); * $paymentMethods = $response->getPaymentMethods(); * print_r($paymentMethods); * </code> */ class RestFetchPaymentMethodsResponse extends RestAbstractResponse implements FetchPaymentMethodsResponseInterface { /** * Get the returned list of payment methods. * * These represent separate payment methods which the user must choose between. * * @return \Omnipay\Common\PaymentMethod[] */ public function getPaymentMethods() { $paymentMethods = array(); foreach ($this->data['data'] as $method) { $paymentMethods[] = new PaymentMethod( $method['id'], $method['description'] ); } return $paymentMethods; } } src/Message/FetchIssuersResponse.php 0000604 00000001472 15173312062 0013556 0 ustar 00 <?php /** * MultiSafepay XML Api Fetch Issuers Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay XML Api Fetch Issuers Response. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class FetchIssuersResponse extends AbstractResponse { /** * {@inheritdoc} */ public function isSuccessful() { return isset($this->data->issuers); } /** * Return available issuers as an associative array. * * @return array */ public function getIssuers() { $result = array(); foreach ($this->data->issuers->issuer as $issuer) { $result[(string) $issuer->code] = (string) $issuer->description; } return $result; } } src/Message/RestCompletePurchaseResponse.php 0000604 00000001144 15173312062 0015244 0 ustar 00 <?php /** * MultiSafepay Rest Api Complete Purchase Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Complete Purchase Response. * * * ### Example * * <code> * $transaction = $gateway->completePurchase(); * $transaction->setTransactionId($transactionId); * $response = $transaction->send(); * print_r($response->getData()); * </code> * */ class RestCompletePurchaseResponse extends RestFetchTransactionResponse { /** * {@inheritdoc} */ public function isSuccessful() { return $this->getPaymentStatus() == 'completed'; } } src/Message/FetchPaymentMethodsResponse.php 0000604 00000001544 15173312062 0015062 0 ustar 00 <?php /** * MultiSafepay XML Api Fetch Payment Methods Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepat XML Api Fetch Payment Methods Response. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class FetchPaymentMethodsResponse extends AbstractResponse { /** * {@inheritdoc} */ public function isSuccessful() { return isset($this->data->gateways); } /** * Return available payment methods as an associative array. * * @return array */ public function getPaymentMethods() { $result = array(); foreach ($this->data->gateways->gateway as $gateway) { $result[(string) $gateway->id] = (string) $gateway->description; } return $result; } } src/Message/RestAbstractRequest.php 0000604 00000010344 15173312062 0013400 0 ustar 00 <?php /** * MultiSafepay Rest Api Abstract Request class. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\AbstractRequest; use Guzzle\Common\Event; /** * MultiSafepay Rest API Abstract Request class. * * All Request classes prefixed by the Rest keyword * inheritance from this class. */ abstract class RestAbstractRequest extends AbstractRequest { /** * User Agent. * * This user agent will be sent with each API request. * * @var string */ protected $userAgent = 'Omnipay'; /** * Live API endpoint. * * This endpoint will be used when the test mode is disabled. * * @var string */ protected $liveEndpoint = 'https://api.multisafepay.com/v1/json'; /** * Test API endpoint. * * This endpoint will be used when the test mode is enabled. * * @var string */ protected $testEndpoint = 'https://testapi.multisafepay.com/v1/json'; /** * Get the locale. * * Optional ISO 639-1 language code which is used to specify a * a language used to display gateway information and other * messages in the responses. * * The default language is English. * * @return string */ public function getLocale() { return $this->getParameter('locale'); } /** * Set the locale. * * Optional ISO 639-1 language code which is used to specify a * a language used to display gateway information and other * messages in the responses. * * The default language is English. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setLocale($value) { return $this->setParameter('locale', $value); } /** * Get the gateway API Key * * Authentication is by means of a single secret API key set as * the apiKey parameter when creating the gateway object. * * @return string */ public function getApiKey() { return $this->getParameter('apiKey'); } /** * Set the gateway API Key * * Authentication is by means of a single secret API key set as * the apiKey parameter when creating the gateway object. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setApiKey($value) { return $this->setParameter('apiKey', $value); } /** * Get endpoint * * @return string */ public function getEndpoint() { if ($this->getTestMode()) { return $this->testEndpoint; } return $this->liveEndpoint; } /** * Get the raw data array for this message. The format of this varies from gateway to * gateway, but will usually be either an associative array, or a SimpleXMLElement. * * @return mixed * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { $this->validate('apiKey'); } /** * Get headers. * * @return array */ protected function getHeaders() { return array( 'api_key' => $this->getApiKey(), 'User-Agent' => $this->userAgent, ); } /** * Execute the Guzzle request. * * @param $method * @param $endpoint * @param null $query * @param null $data * @return \Guzzle\Http\Message\Response */ protected function sendRequest($method, $endpoint, $query = null, $data = null) { $this->httpClient->getEventDispatcher()->addListener('request.error', function (Event $event) { $response = $event['response']; if ($response->isError()) { $event->stopPropagation(); } }); $httpRequest = $this->httpClient->createRequest( $method, $this->getEndpoint() . $endpoint, $this->getHeaders(), $data ); // Add query parameters if (is_array($query) && ! empty($query)) { foreach ($query as $itemKey => $itemValue) { $httpRequest->getQuery()->add($itemKey, $itemValue); } } return $httpRequest->send(); } } src/Message/CompletePurchaseResponse.php 0000604 00000004103 15173312062 0014404 0 ustar 00 <?php /** * MultiSafepay XML Api Complete Purchase Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay XML Api Complete Purchase Response. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class CompletePurchaseResponse extends AbstractResponse { /** * {@inheritdoc} */ public function isSuccessful() { return $this->getPaymentStatus() === 'completed'; } /** * {@inheritdoc} */ public function getTransactionReference() { if (isset($this->data->transaction->id)) { return (string) $this->data->transaction->id; } } /** * Is the payment created, but uncompleted? * * @return boolean */ public function isInitialized() { return $this->getPaymentStatus() === 'initialized'; } /** * Is the payment created, but not yet exempted (credit cards)? * * @return boolean */ public function isUncleared() { return $this->getPaymentStatus() === 'uncleared'; } /** * Is the payment canceled? * * @return boolean */ public function isCanceled() { return $this->getPaymentStatus() === 'canceled'; } /** * Is the payment rejected? * * @return boolean */ public function isRejected() { return $this->getPaymentStatus() === 'declined'; } /** * Is the payment refunded? * * @return boolean */ public function isRefunded() { return $this->getPaymentStatus() === 'refunded'; } /** * Is the payment expired? * * @return boolean */ public function isExpired() { return $this->getPaymentStatus() === 'expired'; } /** * Get raw payment status. * * @return null|string */ public function getPaymentStatus() { if (isset($this->data->ewallet->status)) { return (string)$this->data->ewallet->status; } } } src/Message/AbstractRequest.php 0000604 00000005047 15173312062 0012546 0 ustar 00 <?php /** * MultiSafepay Abstract XML Api Request. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest; /** * Multisafepay Abstract XML Api Request. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ abstract class AbstractRequest extends BaseAbstractRequest { /** * User Agent. * * This user agent will be sent with each API request. * * @var string */ protected $userAgent = 'Omnipay'; /** * Live API endpoint. * * This endpoint will be used when the test mode is disabled. * * @var string */ protected $liveEndpoint = 'https://api.multisafepay.com/ewx/'; /** * Test API endpoint. * * This endpoint will be used when the test mode is enabled. * * @var string */ protected $testEndpoint = 'https://testapi.multisafepay.com/ewx/'; /** * Get the account identifier. * * @return mixed */ public function getAccountId() { return $this->getParameter('accountId'); } /** * Set the account identifier. * * @param $value * @return BaseAbstractRequest */ public function setAccountId($value) { return $this->setParameter('accountId', $value); } /** * Get the site identifier. * * @return mixed */ public function getSiteId() { return $this->getParameter('siteId'); } /** * Set the site identifier. * * @param $value * @return BaseAbstractRequest */ public function setSiteId($value) { return $this->setParameter('siteId', $value); } /** * Get the site code. * * @return mixed */ public function getSiteCode() { return $this->getParameter('siteCode'); } /** * Set the site code. * * @param $value * @return BaseAbstractRequest */ public function setSiteCode($value) { return $this->setParameter('siteCode', $value); } /** * Get the API endpoint. * * @return string */ public function getEndpoint() { if ($this->getTestMode()) { return $this->testEndpoint; } return $this->liveEndpoint; } /** * Get headers. * * @return array */ protected function getHeaders() { return array( 'User-Agent' => $this->userAgent, ); } } src/Message/RestRefundRequest.php 0000604 00000003762 15173312062 0013066 0 ustar 00 <?php /** * MultiSafepay Rest Api Refund Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Refund Request. * * The MultiSafepay API support refunds, meaning you can refund any * transaction to the customer. The fund will be deducted * from the MultiSafepay balance. * * The API also support partial refunds which means that only a * part of the amount will be refunded. * * When a transaction has been refunded the status will change to * "refunded". When the transaction has only been partial refunded the * status will change to "partial_refunded". * * ### Example * * <code> * $request = $this->gateway->refund(); * * $request->setTransactionId('test-transaction'); * $request->setAmount('10.00'); * $request->setCurrency('eur'); * $request->setDescription('Test Refund'); * * $response = $request->send(); * var_dump($response->isSuccessful()); * </code> */ class RestRefundRequest extends RestAbstractRequest { /** * Get the required data for the API request. * * @return array * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { parent::getData(); $this->validate('amount', 'currency', 'description', 'transactionId'); return array( 'amount' => $this->getAmountInteger(), 'currency' => $this->getCurrency(), 'description' => $this->getDescription(), 'id' => $this->getTransactionId(), 'type' => 'refund', ); } /** * Send the request with specified data * * @param mixed $data * @return RestRefundResponse */ public function sendData($data) { $httpResponse = $this->sendRequest( 'POST', '/orders/' . $data['id'] . '/refunds', $data ); $this->response = new RestRefundResponse( $this, $httpResponse ); return $this->response; } } src/Message/RestCompletePurchaseRequest.php 0000604 00000002347 15173312062 0015104 0 ustar 00 <?php /** * MultiSafepay Rest Api Complete Purchase Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Complete Purchase Request. * * ### Example * * <code> * $transaction = $gateway->completePurchase(); * $transaction->setTransactionId($transactionId); * $response = $transaction->send(); * print_r($response->getData()); * </code> * */ class RestCompletePurchaseRequest extends RestFetchTransactionRequest { /** * Get the required data from the API request. * * @return array * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { $this->validate('transactionId'); $transactionId = $this->getTransactionId(); return compact('transactionId'); } /** * Send the API request. * * @param mixed $data * @return RestCompletePurchaseResponse */ public function sendData($data) { $httpResponse = $this->sendRequest( 'get', '/orders/' . $data['transactionId'] ); $this->response = new RestCompletePurchaseResponse( $this, $httpResponse->json() ); return $this->response; } } src/Message/RestFetchIssuersRequest.php 0000604 00000002771 15173312062 0014251 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Issuers Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Fetch Issuers Request. * * Some payment providers require you to specify a issuer. * This request provides a list of all possible issuers * for the specified gateway. * * Currently IDEAL is the only provider which requires an issuer. * * <code> * $request = $gateway->fetchIssuers(); * $request->setPaymentMethod('IDEAL'); * $response = $request->send(); * $issuers = $response->getIssuers(); * print_r($issuers); * </code> * * @link https://www.multisafepay.com/documentation/doc/API-Reference */ class RestFetchIssuersRequest extends RestAbstractRequest { /** * Get the required data for the API request. * * @return array * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { parent::getData(); $this->validate('paymentMethod'); $paymentMethod = $this->getPaymentMethod(); return compact('paymentMethod'); } /** * Execute the API request. * * @param mixed $data * @return FetchIssuersResponse */ public function sendData($data) { $httpResponse = $this->sendRequest( 'GET', '/issuers/' . $data['paymentMethod'] ); $this->response = new RestFetchIssuersResponse( $this, $httpResponse->json() ); return $this->response; } } src/Message/RestFetchIssuersResponse.php 0000604 00000002170 15173312062 0014410 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Issuers Response. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Issuer; use Omnipay\Common\Message\FetchIssuersResponseInterface; /** * MultiSafepay Rest Api Fetch Issuers Response. * * This response class will be returned when * using the RestFetchIssuersRequest. And provides a * list of all possible issuers for the specified gateway. * * ### Example * * <code> * $request = $gateway->fetchIssuers(); * $request->setPaymentMethod('IDEAL'); * $response = $request->send(); * $issuers = $response->getIssuers(); * print_r($issuers); * </code> */ class RestFetchIssuersResponse extends RestAbstractResponse implements FetchIssuersResponseInterface { /** * Return available issuers as an associative array. * * @return \Omnipay\Common\Issuer[] */ public function getIssuers() { $issuers = array(); foreach ($this->data['data'] as $issuer) { $issuers[] = new Issuer( $issuer['code'], $issuer['description'] ); } return $issuers; } } src/Message/RestPurchaseResponse.php 0000604 00000006455 15173312062 0013565 0 ustar 00 <?php /** * MultiSafepay Rest Api Purchase Response. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\RedirectResponseInterface; /** * MultiSafepay Rest Api Purchase Response. * * The payment request allows the merchant to charge a customer. * * ### Redirect vs Direct Payments * * A redirect payment is the standard payment process. * During a redirect payment the consumer is redirected to * MultiSafepay's secure Hosted Payment Pages to enter their * payment details and is suitable for most scenarios. If you * prefer greater control over your checkout process you should * use direct payments. During a direct payment the consumer * does not need to visit MultiSafepay Hosted Payment Pages. * Instead your website collects the requirement payment details * and the consumer is redirect immediately to their chosen payment * provider. * * ### Create Card * * <code> * // Create a credit card object * $card = new CreditCard(array( * 'firstName' => 'Example', * 'lastName' => 'Customer', * 'number' => '4222222222222222', * 'expiryMonth' => '01', * 'expiryYear' => '2020', * 'cvv' => '123', * 'email' => 'customer@example.com', * 'address1' => '1 Scrubby Creek Road', * 'country' => 'AU', * 'city' => 'Scrubby Creek', * 'postalcode' => '4999', * 'state' => 'QLD', * )); * </code> * * ### Initialize a "redirect" payment. * * The customer will be redirected to the MultiSafepay website * where they need to enter their payment details. * * <code> * $request = $gateway->purchase(); * * $request->setAmount('20.00'); * $request->setTransactionId('TEST-TRANSACTION'); * $request->setDescription('Test transaction'); * * $request->setCurrency('EUR'); * $request->setType('redirect'); * * $response = $request->send(); * var_dump($response->getData()); * </code> * * ### Initialize a "direct" payment. * * The merchant website need to collect the payment details, so * the user can stay at the merchant website. * * <code> * $request = $gateway->purchase(); * * $request->setAmount('20.00'); * $request->setTransactionId('TEST-TRANSACTION'); * $request->setDescription('Test transaction'); * * $request->setCurrency('EUR'); * $request->setType('direct'); * $request->setCard($card); * * $request->setGateway('IDEAL'); * $request->setIssuer('ISSUER-ID'); // This ID can be found, with the RestFetchIssuersRequest. * * $response = $request->send(); * var_dump($response->getData()); * </code> */ class RestPurchaseResponse extends RestAbstractResponse implements RedirectResponseInterface { /** * {@inheritdoc} */ public function isRedirect() { return isset($this->data['data']['payment_url']); } /** * {@inheritdoc} */ public function getRedirectUrl() { if (! $this->isRedirect()) { return null; } return $this->data['data']['payment_url']; } /** * {@inheritdoc} */ public function getRedirectMethod() { return 'GET'; } /** * {@inheritdoc} */ public function getRedirectData() { return null; } } src/Message/RestFetchTransactionResponse.php 0000604 00000004313 15173312062 0015241 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Transaction Response. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Fetch Transaction Response. * * To get information about a previous processed transaction, MultiSafepay provides * the /orders/{order_id} resource. This resource can be used to query the details * about a specific transaction. * * <code> * // Fetch the transaction. * $transaction = $gateway->fetchTransaction(); * $transaction->setTransactionId($transactionId); * $response = $transaction->send(); * print_r($response->getData()); * </code> * * @link https://www.multisafepay.com/documentation/doc/API-Reference */ class RestFetchTransactionResponse extends RestAbstractResponse { /** * Is the payment created, but uncompleted? * * @return boolean */ public function isInitialized() { return $this->getPaymentStatus() == 'initialized'; } /** * Is the payment created, but not yet exempted (credit cards)? * * @return boolean */ public function isUncleared() { return $this->getPaymentStatus() == 'uncleared'; } /** * Is the payment canceled? * * @return boolean */ public function isCanceled() { return $this->getPaymentStatus() == 'canceled'; } /** * Is the payment rejected? * * @return boolean */ public function isDeclined() { return $this->getPaymentStatus() == 'declined'; } /** * Is the payment refunded? * * @return boolean */ public function isRefunded() { if ($this->getPaymentStatus() == 'refunded' || $this->getPaymentStatus() == 'chargedback' ) { return true; } return false; } /** * Is the payment expired? * * @return boolean */ public function isExpired() { return $this->getPaymentStatus() == 'expired'; } /** * Get raw payment status. * * @return null|string */ public function getPaymentStatus() { if (isset($this->data['data']['status'])) { return $this->data['data']['status']; } } } src/Message/CompletePurchaseRequest.php 0000604 00000002633 15173312062 0014244 0 ustar 00 <?php /** * MultiSafepay XML Api Complete Purchase Request. */ namespace Omnipay\MultiSafepay\Message; use SimpleXMLElement; /** * MultiSafepay XML Api Complete Purchase Request. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class CompletePurchaseRequest extends PurchaseRequest { /** * {@inheritdoc} */ public function getData() { $this->validate('transactionId'); $data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><status/>'); $data->addAttribute('ua', $this->userAgent); $merchant = $data->addChild('merchant'); $merchant->addChild('account', $this->getAccountId()); $merchant->addChild('site_id', $this->getSiteId()); $merchant->addChild('site_secure_code', $this->getSiteCode()); $transaction = $data->addChild('transaction'); $transaction->addChild('id', $this->getTransactionId()); return $data; } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->post( $this->getEndpoint(), $this->getHeaders(), $data->asXML() )->send(); $this->response = new CompletePurchaseResponse( $this, $httpResponse->xml() ); return $this->response; } } src/Message/PurchaseRequest.php 0000604 00000016631 15173312062 0012556 0 ustar 00 <?php /** * MultiSafepay XML Api Purchase Request. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\CreditCard; use SimpleXMLElement; /** * MultiSafepay XML Api Purchase Request. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class PurchaseRequest extends AbstractRequest { /** * Get the language. * * @return mixed */ public function getLanguage() { return $this->getParameter('language'); } /** * Set the language. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setLanguage($value) { return $this->setParameter('language', $value); } /** * Get the gateway. * * @return mixed */ public function getGateway() { return $this->getParameter('gateway'); } /** * Set the gateway. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setGateway($value) { return $this->setParameter('gateway', $value); } /** * Get Issuer. * * @return mixed */ public function getIssuer() { return $this->getParameter('issuer'); } /** * Set issuer. * * @param string $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setIssuer($value) { return $this->setParameter('issuer', $value); } /** * Get the Google analytics code. * * @return mixed */ public function getGoogleAnalyticsCode() { return $this->getParameter('googleAnalyticsCode'); } /** * Set the Google analytics code. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setGoogleAnalyticsCode($value) { return $this->setParameter('googleAnalyticsCode', $value); } /** * Get the value of "extradata1" * * @return mixed */ public function getExtraData1() { return $this->getParameter('extraData1'); } /** * Set the value of "extradata1" * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setExtraData1($value) { return $this->setParameter('extraData1', $value); } /** * Get the value of "extradata2" * * @return mixed */ public function getExtraData2() { return $this->getParameter('extraData2'); } /** * Set the value of "extraData2 * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setExtraData2($value) { return $this->setParameter('extraData2', $value); } /** * Get the value of "extraData3" * * @return mixed */ public function getExtraData3() { return $this->getParameter('extraData3'); } /** * Set the value of "extraData3" * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setExtraData3($value) { return $this->setParameter('extraData3', $value); } /** * Get the items. * * @return mixed */ public function getItems() { return $this->getParameter('items'); } /** * Set the items. * * @param array|\Omnipay\Common\ItemBag $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setItems($value) { return $this->setParameter('items', $value); } /** * {@inheritdoc} */ public function getData() { $this->validate('transactionId', 'amount', 'currency', 'description', 'clientIp', 'card'); if ('IDEAL' === $this->getGateway() && $this->getIssuer()) { $data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><directtransaction/>'); } else { $data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><redirecttransaction/>'); } $data->addAttribute('ua', $this->userAgent); $merchant = $data->addChild('merchant'); $merchant->addChild('account', $this->getAccountId()); $merchant->addChild('site_id', $this->getSiteId()); $merchant->addChild('site_secure_code', $this->getSiteCode()); $merchant->addChild('notification_url', htmlspecialchars($this->getNotifyUrl())); $merchant->addChild('cancel_url', htmlspecialchars($this->getCancelUrl())); $merchant->addChild('redirect_url', htmlspecialchars($this->getReturnUrl())); /** @var CreditCard $card */ $card = $this->getCard(); $customer = $data->addChild('customer'); $customer->addChild('ipaddress', $this->getClientIp()); $customer->addChild('locale', $this->getLanguage()); $customer->addChild('email', $card->getEmail()); $customer->addChild('firstname', $card->getFirstName()); $customer->addChild('lastname', $card->getLastName()); $customer->addChild('address1', $card->getAddress1()); $customer->addChild('address2', $card->getAddress2()); $customer->addChild('zipcode', $card->getPostcode()); $customer->addChild('city', $card->getCity()); $customer->addChild('country', $card->getCountry()); $customer->addChild('phone', $card->getPhone()); $data->addChild('google_analytics', $this->getGoogleAnalyticsCode()); $transaction = $data->addChild('transaction'); $transaction->addChild('id', $this->getTransactionId()); $transaction->addChild('currency', $this->getCurrency()); $transaction->addChild('amount', $this->getAmountInteger()); $transaction->addChild('description', $this->getDescription()); $transaction->addChild('var1', $this->getExtraData1()); $transaction->addChild('var2', $this->getExtraData2()); $transaction->addChild('var3', $this->getExtraData3()); $transaction->addChild('gateway', $this->getGateway()); if ($items = $this->getItems()) { $itemsHtml = '<ul>'; foreach ($items as $item) { $itemsHtml .= "<li>{$item['quantity']} x {$item['name']}</li>"; } $itemsHtml .= '</ul>'; $transaction->addChild('items', htmlspecialchars($itemsHtml)); } if ('IDEAL' === $this->getGateway() && $this->getIssuer()) { $gatewayInfo = $data->addChild('gatewayinfo'); $gatewayInfo->addChild('issuerid', $this->getIssuer()); } $data->addChild('signature', $this->generateSignature()); return $data; } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->post( $this->getEndpoint(), $this->getHeaders(), $data->asXML() )->send(); $this->response = new PurchaseResponse( $this, $httpResponse->xml() ); return $this->response; } /** * Generate signature. * * @return string */ protected function generateSignature() { return md5( $this->getAmountInteger(). $this->getCurrency(). $this->getAccountId(). $this->getSiteId(). $this->getTransactionId() ); } } src/Message/FetchIssuersRequest.php 0000604 00000002355 15173312062 0013411 0 ustar 00 <?php /** * MultiSafepay XML Api Fetch Issuers Request. */ namespace Omnipay\MultiSafepay\Message; use SimpleXMLElement; /** * MultiSafepay XML Api Fetch Issuers Request. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ class FetchIssuersRequest extends AbstractRequest { /** * {@inheritdoc} */ public function getData() { $data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><idealissuers/>'); $data->addAttribute('ua', $this->userAgent); $merchant = $data->addChild('merchant'); $merchant->addChild('account', $this->getAccountId()); $merchant->addChild('site_id', $this->getSiteId()); $merchant->addChild('site_secure_code', $this->getSiteCode()); return $data; } /** * {@inheritdoc} */ public function sendData($data) { $httpResponse = $this->httpClient->post( $this->getEndpoint(), $this->getHeaders(), $data->asXML() )->send(); $this->response = new FetchIssuersResponse( $this, $httpResponse->xml() ); return $this->response; } } src/Message/RestFetchTransactionRequest.php 0000604 00000003071 15173312062 0015073 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Transaction Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Fetch Transaction Request. * * To get information about a previous processed transaction, MultiSafepay provides * the /orders/{order_id} resource. This resource can be used to query the details * about a specific transaction. * * <code> * // Fetch the transaction. * $transaction = $gateway->fetchTransaction(); * $transaction->setTransactionId($transactionId); * $response = $transaction->send(); * print_r($response->getData()); * </code> * * @link https://www.multisafepay.com/documentation/doc/API-Reference */ class RestFetchTransactionRequest extends RestAbstractRequest { /** * Get the required data which is needed * to execute the API request. * * @return array * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { parent::getData(); $this->validate('transactionId'); $transactionId = $this->getTransactionId(); return compact('transactionId'); } /** * Execute the API request. * * @param mixed $data * @return RestFetchTransactionResponse */ public function sendData($data) { $httpResponse = $this->sendRequest( 'get', '/orders/' . $data['transactionId'] ); $this->response = new RestFetchTransactionResponse( $this, $httpResponse->json() ); return $this->response; } } src/Message/AbstractResponse.php 0000604 00000001513 15173312062 0012706 0 ustar 00 <?php /** * MultiSafepay Abstract XML Api Response. */ namespace Omnipay\MultiSafepay\Message; use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse; /** * MultiSafepay Abstract XML Api Response. * * @deprecated This API is deprecated and will be removed in * an upcoming version of this package. Please switch to the Rest API. */ abstract class AbstractResponse extends BaseAbstractResponse { /** * {@inheritdoc} */ public function getMessage() { if (isset($this->data->error)) { return (string) $this->data->error->description; } return null; } /** * {@inheritdoc} */ public function getCode() { if (isset($this->data->error)) { return (string) $this->data->error->code; } return null; } } src/Message/RestFetchPaymentMethodsRequest.php 0000604 00000003543 15173312062 0015553 0 ustar 00 <?php /** * MultiSafepay Rest Api Fetch Payments Methods Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Fetch Payments Methods Request. * * The MultiSafepay API supports multiple payment gateways, such as * iDEAL, Paypal or CreditCard. This request provides a list * of all supported payment methods. * * ### Example * * <code> * $request = $gateway->fetchPaymentMethods(); * $response = $request->send(); * $paymentMethods = $response->getPaymentMethods(); * print_r($paymentMethods); * </code> * * @link https://www.multisafepay.com/documentation/doc/API-Reference */ class RestFetchPaymentMethodsRequest extends RestAbstractRequest { /** * Get the country. * * @return string|null */ public function getCountry() { return $this->getParameter('country'); } /** * Set the country. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setCountry($value) { return $this->setParameter('country', $value); } /** * Get the required data for the API request. * * @return array */ public function getData() { parent::getData(); $data = array( 'amount' => $this->getAmountInteger(), 'country' => $this->getCountry(), 'currency' => $this->getCurrency(), ); return array_filter($data); } /** * Execute the API request. * * @param mixed $data * @return RestFetchPaymentMethodsResponse */ public function sendData($data) { $httpResponse = $this->sendRequest('GET', '/gateways', $data); $this->response = new RestFetchPaymentMethodsResponse( $this, $httpResponse->json() ); return $this->response; } } src/Message/RestPurchaseRequest.php 0000604 00000034166 15173312062 0013417 0 ustar 00 <?php /** * MultiSafepay Rest Api Purchase Request. */ namespace Omnipay\MultiSafepay\Message; /** * MultiSafepay Rest Api Purchase Request. * * The payment request allows the merchant to charge a customer. * * ### Redirect vs Direct Payments * * A redirect payment is the standard payment process. * During a redirect payment the consumer is redirected to * MultiSafepay's secure Hosted Payment Pages to enter their * payment details and is suitable for most scenarios. If you * prefer greater control over your checkout process you should * use direct payments. During a direct payment the consumer * does not need to visit MultiSafepay Hosted Payment Pages. * Instead your website collects the requirement payment details * and the consumer is redirect immediately to their chosen payment * provider. * * ### Create Card * * <code> * // Create a credit card object * $card = new CreditCard(array( * 'firstName' => 'Example', * 'lastName' => 'Customer', * 'number' => '4222222222222222', * 'expiryMonth' => '01', * 'expiryYear' => '2020', * 'cvv' => '123', * 'email' => 'customer@example.com', * 'address1' => '1 Scrubby Creek Road', * 'country' => 'AU', * 'city' => 'Scrubby Creek', * 'postalcode' => '4999', * 'state' => 'QLD', * )); * </code> * * ### Initialize a "redirect" payment. * * The customer will be redirected to the MultiSafepay website * where they need to enter their payment details. * * <code> * $request = $gateway->purchase(); * * $request->setAmount('20.00'); * $request->setTransactionId('TEST-TRANSACTION'); * $request->setDescription('Test transaction'); * * $request->setCurrency('EUR'); * $request->setType('redirect'); * * $response = $request->send(); * var_dump($response->getData()); * </code> * * ### Initialize a "direct" payment. * * The merchant website need to collect the payment details, so * the user can stay at the merchant website. * * <code> * $request = $gateway->purchase(); * * $request->setAmount('20.00'); * $request->setTransactionId('TEST-TRANSACTION'); * $request->setDescription('Test transaction'); * * $request->setCurrency('EUR'); * $request->setType('direct'); * $request->setCard($card); * * $request->setGateway('IDEAL'); * $request->setIssuer('ISSUER-ID'); // This ID can be found, with the RestFetchIssuersRequest. * * $response = $request->send(); * var_dump($response->getData()); * </code> */ class RestPurchaseRequest extends RestAbstractRequest { /** * Get payment type. * * Specifies the payment flow for the checkout process. * * @return string */ public function getType() { return $this->getParameter('type'); } /** * Set payment type. * * Specifies the payment flow for the checkout process. * Possible values are 'redirect', 'direct' * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setType($value) { return $this->setParameter('type', $value); } /** * Get recurring Payment Id * * A previously stored identifier referring to a * payment method to be charged again. * * @return int|null */ public function getRecurringId() { return $this->getParameter('recurring_id'); } /** * Set recurring Payment Id * * A previously stored identifier referring to a * payment method to be charged again. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setRecurringId($value) { return $this->setParameter('recurring_id', $value); } /** * Get the gateway. * * The unique gateway id to immediately direct the customer to the payment method. * You retrieve these gateways using a gateway request. * * @return mixed */ public function getGateway() { return $this->getParameter('gateway'); } /** * Set the gateway. * * The unique gateway id to immediately direct the customer to the payment method. * You retrieve these gateways using a gateway request. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setGateway($value) { return $this->setParameter('gateway', $value); } /** * Get value of var1. * * A free variable for custom data to be stored and persisted. * * @return string|null */ public function getVar1() { return $this->getParameter('var1'); } /** * Set var1. * * A free optional variable for custom data to be stored and persisted. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setVar1($value) { return $this->setParameter('var1', $value); } /** * Get var2. * * A free variable for custom data to be stored and persisted. * * @return string|null */ public function getVar2() { return $this->getParameter('var2'); } /** * Set var2. * * A free variable for custom data to be stored and persisted. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setVar2($value) { return $this->setParameter('var2', $value); } /** * Get var3. * * A free variable for custom data to be stored and persisted. * * @return string|null */ public function getVar3() { return $this->getParameter('var3'); } /** * Set var3. * * A free variable for custom data to be stored and persisted. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setVar3($value) { return $this->setParameter('var3', $value); } /** * Get manual. * * If true this forces a credit card transaction to require manual * acceptance regardless of the outcome from fraud checks. * It is possible that a high risk transaction is still declined. * * @return boolean|null */ public function getManual() { return $this->getParameter('manual'); } /** * Set manual. * * If true this forces a credit card transaction to require manual * acceptance regardless of the outcome from fraud checks. * It is possible that a high risk transaction is still declined. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setManual($value) { return $this->setParameter('manual', $value); } /** * Get days active. * * The number of days the payment link will be active for. * When not specified the default will be 30 days. * * @return int|null */ public function getDaysActive() { return $this->getParameter('days_active'); } /** * Set days active. * * The number of days the payment link will be active for. * When not specified the default will be 30 days. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setDaysActive($value) { return $this->setParameter('days_active', $value); } /** * Get close window. * * Set to true if you will display the MultiSafepay payment * page in a new window and want it to close automatically * after the payment process has been completed. * * @return boolean|null */ public function getCloseWindow() { return $this->getParameter('close_window'); } /** * Set close window. * * Set to true if you will display the MultiSafepay payment * page in a new window and want it to close automatically * after the payment process has been completed. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setCloseWindow($value) { return $this->setParameter('close_window', $value); } /** * Send mail. * * True if you will send your own bank transfer payment instructions to * consumers and do not want MultiSafepay to do this. * * @return boolean */ public function getSendMail() { return $this->getParameter('disable_send_mail'); } /** * Send mail. * * True if you will send your own bank transfer payment instructions to * consumers and do not want MultiSafepay to do this. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setSendMail($value) { return $this->setParameter('disable_send_mail', $value); } /** * Google analytics code. * * Your Google Analytics Site Id. * This will be injected into the payment pages * so you can trigger custom events and track payment metrics. * * @return string|null */ public function getGoogleAnalyticsCode() { return $this->getParameter('google_analytics'); } /** * Google analytics code. * * Your Google Analytics Site Id. * This will be injected into the payment pages * so you can trigger custom events and track payment metrics. * * @param $value * @return \Omnipay\Common\Message\AbstractRequest */ public function setGoogleAnalyticsCode($value) { return $this->setParameter('google_analytics', $value); } /** * Get the payment options. * * @return array */ protected function getPaymentData() { $data = array( 'cancel_url' => $this->getCancelUrl(), 'close_window' => $this->getCloseWindow(), 'notify_url' => $this->getNotifyUrl(), 'return_url' => $this->getReturnUrl(), ); return array_filter($data); } /** * Customer information. * * This function returns all the provided * client related parameters. * * @return array */ public function getCustomerData() { $data = array( 'disable_send_mail' => $this->getSendMail(), 'locale' => $this->getLocale(), ); if (is_null($this->getCard())) { return array_filter($data); } $cardData = array( 'address_1' => $this->getCard()->getAddress1(), 'address_2' => $this->getCard()->getAddress2(), 'city' => $this->getCard()->getCity(), 'country' => $this->getCard()->getCountry(), 'email' => $this->getCard()->getEmail(), 'first_name' => $this->getCard()->getFirstName(), 'house_number' => $this->getCard()->getNumber(), 'last_name' => $this->getCard()->getLastName(), 'phone' => $this->getCard()->getPhone(), 'state' => $this->getCard()->getState(), 'zip_code' => $this->getCard()->getPostcode(), ); return array_filter( array_merge($data, $cardData) ); } /** * Get gateway data. * * @return array */ protected function getGatewayData() { $data = array( 'issuer_id' => $this->getIssuer(), ); return array_filter($data); } /** * Get the raw data array for this message. The format of this varies from gateway to * gateway, but will usually be either an associative array, or a SimpleXMLElement. * * @return array * @throws \Omnipay\Common\Exception\InvalidRequestException */ public function getData() { parent::getData(); $this->validate( 'amount', 'currency', 'description', 'transactionId', 'type' ); // Direct order. if ($this->getType() === 'direct') { $this->validate('gateway'); } // When the gateway is set to IDEAL, // the issuer parameter is required. if ( $this->getType() == 'direct' && $this->getGateway() == 'IDEAL' ) { $this->validate('issuer'); } $data = array( 'amount' => $this->getAmountInteger(), 'currency' => $this->getCurrency(), 'days_active' => $this->getDaysActive(), 'description' => $this->getDescription(), 'gateway' => $this->getGateway(), 'google_analytics' => $this->getGoogleAnalyticsCode(), 'items' => $this->getItems(), 'manual' => $this->getManual(), 'order_id' => $this->getTransactionId(), 'recurring_id' => $this->getRecurringId(), 'type' => $this->getType(), 'var1' => $this->getVar1(), 'var2' => $this->getVar2(), 'var3' => $this->getVar3(), ); $paymentData = $this->getPaymentData(); if (! empty($paymentData)) { $data['payment_options'] = $paymentData; } $customerData = $this->getCustomerData(); if (! empty($customerData)) { $data['customer'] = $customerData; } $gatewayData = $this->getGatewayData(); if (! empty($gatewayData)) { $data['gateway_info'] = $gatewayData; } return array_filter($data); } /** * Send the request with specified data * * @param mixed $data * @return RestPurchaseResponse */ public function sendData($data) { $httpResponse = $this->sendRequest('POST', '/orders', null, $data); $this->response = new RestPurchaseResponse( $this, $httpResponse->json() ); return $this->response; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings