From b45ee81c8d71aebbf077fc17caba2fdd92ff37ff Mon Sep 17 00:00:00 2001 From: DerCoder Date: Sun, 10 Jul 2016 03:28:56 +0200 Subject: [PATCH 01/10] returnUrl, cancelUrl and notifyUrl added for API 2.0.6 --- .coveralls.yml | 2 ++ .travis.yml | 3 +++ README.md | 1 + composer.json | 3 ++- src/Omnipay/Ecopayz/Message/PurchaseRequest.php | 16 ++++++++++++++-- .../Message/FetchTransactionResponseTest.php | 1 + .../Ecopayz/Message/PurchaseRequestTest.php | 17 +++++++++++++++-- .../Ecopayz/Message/PurchaseResponseTest.php | 1 + 8 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000..11dcc7f3 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,2 @@ +coverage_clover: ./clover.xml +json_path: ./coveralls-upload.json \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 67753ce6..2618d790 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,12 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm before_script: - composer install -n --dev --prefer-source script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text + +after_script: vendor/bin/coveralls -v \ No newline at end of file diff --git a/README.md b/README.md index 203bfced..6bad99a5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ **Ecopayz driver for the Omnipay PHP payment processing library** [![Build Status](https://travis-ci.org/dercoder/omnipay-ecopayz.png?branch=master)](https://travis-ci.org/dercoder/omnipay-ecopayz) +[![Coverage Status](https://coveralls.io/repos/dercoder/omnipay-ecopayz/badge.svg?branch=master&service=github)](https://coveralls.io/github/dercoder/omnipay-ecopayz?branch=master) [![Dependency Status](https://www.versioneye.com/user/projects/54366b4be993e89c45000137/badge.png)](https://www.versioneye.com/user/projects/54366b4be993e89c45000137) [![Latest Stable Version](https://poser.pugx.org/dercoder/omnipay-ecopayz/v/stable.png)](https://packagist.org/packages/dercoder/omnipay-ecopayz) diff --git a/composer.json b/composer.json index e0ee9257..2933d767 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "omnipay/common": "~2.3" }, "require-dev": { - "omnipay/tests": "~2.0" + "omnipay/tests": "~2.0", + "satooshi/php-coveralls": "1.0.0" }, "extra": { "branch-alias": { diff --git a/src/Omnipay/Ecopayz/Message/PurchaseRequest.php b/src/Omnipay/Ecopayz/Message/PurchaseRequest.php index 07935463..68060389 100644 --- a/src/Omnipay/Ecopayz/Message/PurchaseRequest.php +++ b/src/Omnipay/Ecopayz/Message/PurchaseRequest.php @@ -12,7 +12,7 @@ * @author Alexander Fedra * @copyright 2015 DerCoder * @license http://opensource.org/licenses/mit-license.php MIT - * @version 2.0.3 Ecopayz API Specification + * @version 2.0.6 Ecopayz API Specification */ class PurchaseRequest extends AbstractRequest { @@ -65,8 +65,20 @@ public function getData() $data['Amount'] = $this->getAmount(); $data['Currency'] = $this->getCurrency(); $data['MerchantFreeText'] = $this->getDescription(); - $data['Checksum'] = $this->calculateArrayChecksum($data); + if ($returnUrl = $this->getReturnUrl()) { + $data['OnSuccessUrl'] = $returnUrl; + } + + if ($cancelUrl = $this->getCancelUrl()) { + $data['OnFailureUrl'] = $cancelUrl; + } + + if ($notifyUrl = $this->getNotifyUrl()) { + $data['TransferUrl'] = $notifyUrl; + } + + $data['Checksum'] = $this->calculateArrayChecksum($data); return $data; } diff --git a/tests/Omnipay/Ecopayz/Message/FetchTransactionResponseTest.php b/tests/Omnipay/Ecopayz/Message/FetchTransactionResponseTest.php index e07b2a3d..5ea697bc 100644 --- a/tests/Omnipay/Ecopayz/Message/FetchTransactionResponseTest.php +++ b/tests/Omnipay/Ecopayz/Message/FetchTransactionResponseTest.php @@ -37,6 +37,7 @@ public function testSuccess() $this->assertSame('OK', $response->getMessage()); $this->assertSame('2064', $response->getTransactionId()); $this->assertSame('1865010000008316336', $response->getTransactionReference()); + $this->assertSame('', $response->getTransactionDescription()); $this->assertSame('7.91', $response->getAmount()); $this->assertSame('EUR', $response->getCurrency()); $this->assertSame('110355', $response->getMerchantAccountNumber()); diff --git a/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php b/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php index 62e78e5a..96fbb84f 100644 --- a/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php +++ b/tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php @@ -18,7 +18,10 @@ public function setUp() 'transactionId' => 'TX4567890', 'description' => 'Free Text Description', 'amount' => '12.34', - 'currency' => 'EUR' + 'currency' => 'EUR', + 'returnUrl' => 'http://example.com/return', + 'cancelUrl' => 'http://example.com/cancel', + 'notifyUrl' => 'http://example.com/notify', )); } @@ -33,6 +36,16 @@ public function testGetData() $this->assertSame('12.34', $data['Amount']); $this->assertSame('EUR', $data['Currency']); $this->assertSame('Free Text Description', $data['MerchantFreeText']); - $this->assertSame('84bbad2a636aa9226c03f17ff813a181', $data['Checksum']); + $this->assertSame('7320d93a3daa1e296f56fa7f40d6fb8b', $data['Checksum']); + $this->assertSame('http://example.com/return', $data['OnSuccessUrl']); + $this->assertSame('http://example.com/cancel', $data['OnFailureUrl']); + $this->assertSame('http://example.com/notify', $data['TransferUrl']); + } + + public function testSendData() + { + $data = $this->request->getData(); + $response = $this->request->sendData($data); + $this->assertSame('Omnipay\Ecopayz\Message\PurchaseResponse', get_class($response)); } } diff --git a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php index 3ebff808..a8b8b9d6 100644 --- a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php +++ b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php @@ -19,6 +19,7 @@ public function testResult() )); $this->assertFalse($response->isSuccessful()); + $this->assertTrue($response->isRedirect()); $this->assertNull($response->getCode()); $this->assertNull($response->getMessage()); $this->assertSame('https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx?PaymentPageID=100&MerchantAccountNumber=100001&CustomerIdAtMerchant=1123456789&TxID=TX4567890&Amount=12.34&Currency=EUR&MerchantFreeText=Free+Text+Description&Checksum=84bbad2a636aa9226c03f17ff813a181', $response->getRedirectUrl()); From 12b7dfb9cfe5f872d40ab8c5d508961bcad24051 Mon Sep 17 00:00:00 2001 From: Alexander Shovdra Date: Mon, 18 Jul 2016 00:35:57 +0300 Subject: [PATCH 02/10] Added ability to use sandbox API --- .../Ecopayz/Message/AbstractRequest.php | 24 +++++++++++++++++++ .../Message/FetchTransactionRequest.php | 6 ++--- src/Omnipay/Ecopayz/Message/PayoutRequest.php | 4 +--- .../Ecopayz/Message/PurchaseResponse.php | 10 ++++++-- .../Ecopayz/Message/PurchaseResponseTest.php | 7 ++++-- 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/Omnipay/Ecopayz/Message/AbstractRequest.php b/src/Omnipay/Ecopayz/Message/AbstractRequest.php index b8ee20fc..a21aea85 100644 --- a/src/Omnipay/Ecopayz/Message/AbstractRequest.php +++ b/src/Omnipay/Ecopayz/Message/AbstractRequest.php @@ -11,6 +11,20 @@ */ abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest { + /** + * Test Endpoint URL + * + * @var string URL + */ + protected $testEndpoint = 'https://secure.test.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; + + /** + * Live Endpoint URL + * + * @var string URL + */ + protected $liveEndpoint = 'https://secure.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; + /** * Get the Merchant ID * @@ -96,6 +110,16 @@ public function setMerchantAccountNumber($value) return $this->setParameter('merchantAccountNumber', $value); } + /** + * Get API endpoint URL + * + * @return string + */ + protected function getEndpoint() + { + return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; + } + /** * Get calculated checksum * diff --git a/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php b/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php index 20353a6f..3c5e3616 100644 --- a/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php +++ b/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php @@ -14,8 +14,6 @@ */ class FetchTransactionRequest extends AbstractRequest { - protected $endpoint = 'https://secure.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; - /** * Get the data for this request. * @@ -114,7 +112,7 @@ public function sendData($data) 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryBySVSTransactionID' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->endpoint, $headers, $data); + $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); $httpResponse = $httpRequest->send(); $xmlResponse = $httpResponse->xml() ->children('http://schemas.xmlsoap.org/soap/envelope/') @@ -142,7 +140,7 @@ public function sendData($data) 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryByCustomerTransactionID' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->endpoint, $headers, $data); + $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); $httpResponse = $httpRequest->send(); $xmlResponse = $httpResponse->xml() ->children('http://schemas.xmlsoap.org/soap/envelope/') diff --git a/src/Omnipay/Ecopayz/Message/PayoutRequest.php b/src/Omnipay/Ecopayz/Message/PayoutRequest.php index 7116676e..db74a59a 100644 --- a/src/Omnipay/Ecopayz/Message/PayoutRequest.php +++ b/src/Omnipay/Ecopayz/Message/PayoutRequest.php @@ -13,8 +13,6 @@ */ class PayoutRequest extends AbstractRequest { - protected $endpoint = 'https://secure.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; - /** * Get the Client Account Number * @@ -161,7 +159,7 @@ public function sendData($data) 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/Payout' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->endpoint, $headers, $data); + $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); $httpResponse = $httpRequest->send(); $xmlResponse = $httpResponse->xml() ->children('http://schemas.xmlsoap.org/soap/envelope/') diff --git a/src/Omnipay/Ecopayz/Message/PurchaseResponse.php b/src/Omnipay/Ecopayz/Message/PurchaseResponse.php index 34497c4d..9137bab8 100644 --- a/src/Omnipay/Ecopayz/Message/PurchaseResponse.php +++ b/src/Omnipay/Ecopayz/Message/PurchaseResponse.php @@ -16,7 +16,8 @@ */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { - protected $endpoint = 'https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx'; + protected $testEndpoint = 'https://secure.test.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx'; + protected $liveEndpoint = 'https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx'; public function __construct(RequestInterface $request, $data) { @@ -36,7 +37,7 @@ public function isRedirect() public function getRedirectUrl() { - return $this->endpoint . '?' . http_build_query($this->data, '', '&'); + return $this->getEndpoint() . '?' . http_build_query($this->data, '', '&'); } public function getRedirectMethod() @@ -48,4 +49,9 @@ public function getRedirectData() { return null; } + + protected function getEndpoint() + { + return $this->getRequest()->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; + } } diff --git a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php index a8b8b9d6..8158a8b9 100644 --- a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php +++ b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php @@ -1,13 +1,16 @@ getMockRequest(), array( + $request = $this->getMockRequest(); + $request->shouldReceive('getTestMode'); + + $response = new PurchaseResponse($request, array( 'PaymentPageID' => '100', 'MerchantAccountNumber' => '100001', 'CustomerIdAtMerchant' => '1123456789', From 825e937e1b057e25cba4067e048bf5bc0a60a836 Mon Sep 17 00:00:00 2001 From: Alexander Fedra Date: Thu, 15 Sep 2016 18:18:21 +0200 Subject: [PATCH 03/10] IP verification removed for proxy connections --- .../Ecopayz/Message/CompletePurchaseRequest.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php b/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php index c69c44eb..911dbea9 100644 --- a/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php +++ b/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php @@ -13,12 +13,6 @@ */ class CompletePurchaseRequest extends FetchTransactionRequest { - private $trustedIps = array( - '213.129.76.104', '213.129.76.105', - '217.21.162.163', '217.21.162.164', - '176.57.42.131', '176.57.42.132' - ); - /** * Get the data for this request. * @@ -32,14 +26,6 @@ public function getData() 'merchantPassword' ); - if (!$this->getTestMode()) { - - if (!in_array($this->httpRequest->getClientIp(), $this->trustedIps)) { - throw new InvalidRequestException('IP Address is invalid to access this function'); - } - - } - if ($xml = $this->httpRequest->request->get('XML')) { if (!$this->validateChecksum($xml)) { From fa499a1a076ef414665a0a702764c1034e27a214 Mon Sep 17 00:00:00 2001 From: "Melvin D. Protacio" Date: Tue, 30 Mar 2021 20:43:21 +0800 Subject: [PATCH 04/10] update omnipay/common to 3.0 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2933d767..367507ea 100644 --- a/composer.json +++ b/composer.json @@ -16,10 +16,10 @@ "psr-0": { "Omnipay\\Ecopayz\\" : "src/" } }, "require": { - "omnipay/common": "~2.3" + "omnipay/common": "^3.0.0" }, "require-dev": { - "omnipay/tests": "~2.0", + "omnipay/tests": "^3.0.0", "satooshi/php-coveralls": "1.0.0" }, "extra": { From cae5333cf820397afcc88c604425ee0d45608fe1 Mon Sep 17 00:00:00 2001 From: "Melvin D. Protacio" Date: Tue, 30 Mar 2021 20:52:21 +0800 Subject: [PATCH 05/10] update --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 367507ea..fbd3de15 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "omnipay/tests": "^3.0.0", - "satooshi/php-coveralls": "1.0.0" + "php-coveralls/php-coveralls": "^2.4.0" }, "extra": { "branch-alias": { From 397277a8431d29c42168d50cabdbb88a9d2544d0 Mon Sep 17 00:00:00 2001 From: "Melvin D. Protacio" Date: Thu, 8 Apr 2021 22:58:15 +0800 Subject: [PATCH 06/10] update requirement --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fbd3de15..d5eaf5d4 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "psr-0": { "Omnipay\\Ecopayz\\" : "src/" } }, "require": { - "omnipay/common": "^3.0.0" + "omnipay/common": "^2.0||^3.0" }, "require-dev": { "omnipay/tests": "^3.0.0", From 8e154a5421b7db1178407080d38ea90187b79c41 Mon Sep 17 00:00:00 2001 From: "Melvin D. Protacio" Date: Fri, 2 Jul 2021 13:35:52 +0800 Subject: [PATCH 07/10] upgrade to omnipay v3 --- composer.json | 5 +-- .../Message/CompletePurchaseRequest.php | 7 ----- .../Message/FetchTransactionRequest.php | 31 ++++++------------- src/Omnipay/Ecopayz/Message/PayoutRequest.php | 5 ++- 4 files changed, 14 insertions(+), 34 deletions(-) diff --git a/composer.json b/composer.json index d5eaf5d4..04b38d1f 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,12 @@ "psr-0": { "Omnipay\\Ecopayz\\" : "src/" } }, "require": { - "omnipay/common": "^2.0||^3.0" + "omnipay/common": "^3.0" }, "require-dev": { "omnipay/tests": "^3.0.0", - "php-coveralls/php-coveralls": "^2.4.0" + "php-coveralls/php-coveralls": "^2.4.0", + "squizlabs/php_codesniffer": "3.*" }, "extra": { "branch-alias": { diff --git a/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php b/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php index 911dbea9..4e599be3 100644 --- a/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php +++ b/src/Omnipay/Ecopayz/Message/CompletePurchaseRequest.php @@ -27,20 +27,15 @@ public function getData() ); if ($xml = $this->httpRequest->request->get('XML')) { - if (!$this->validateChecksum($xml)) { throw new InvalidRequestException('Invalid XML checksum'); } return new \SimpleXMLElement($xml); - } elseif ($xml = $this->httpRequest->getContent()) { return new \SimpleXMLElement($xml); - } else { - throw new InvalidRequestException('Missing XML'); - } } @@ -53,7 +48,6 @@ public function getData() public function sendData($data) { if (isset($data->StatusReport)) { - if (in_array($data->StatusReport->Status, array(1, 2, 3))) { $response = $this->createResponse('OK', 0, 'OK'); } elseif (in_array($data->StatusReport->Status, array(4, 5))) { @@ -65,7 +59,6 @@ public function sendData($data) header('Content-Type: text/xml; charset=utf-8'); echo $response; die(); - } else { return new CompletePurchaseResponse($this, $data); } diff --git a/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php b/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php index 3c5e3616..53a06df2 100644 --- a/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php +++ b/src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php @@ -1,4 +1,5 @@ getTransactionReference()) { - $query = $body->appendChild( $document->createElement('q0:QueryBySVSTransactionID') ); @@ -63,9 +63,7 @@ public function getData() $request->appendChild( $document->createElement('q0:SVSTxID', $transactionReference) ); - } elseif ($transactionId = $this->getTransactionId()) { - $query = $body->appendChild( $document->createElement('q0:QueryByCustomerTransactionID') ); @@ -85,11 +83,8 @@ public function getData() $request->appendChild( $document->createElement('q0:TxID', $transactionId) ); - } else { - throw new InvalidRequestException('The transactionId or transactionReference parameter is required'); - } return $document->saveXML(); @@ -98,23 +93,21 @@ public function getData() /** * Send the request with specified data * - * @param mixed $data The data to send - * @throws InvalidResponseException - * @throws InvalidRequestException + * @param mixed $data The data to send * @return FetchTransactionResponse + * @throws InvalidRequestException + * @throws InvalidResponseException */ public function sendData($data) { if (strpos($data, 'QueryBySVSTransactionID') !== false) { - $headers = array( 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryBySVSTransactionID' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); - $httpResponse = $httpRequest->send(); - $xmlResponse = $httpResponse->xml() + $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data); + $xmlResponse = simplexml_load_string($httpResponse->getBody()->getContents()) ->children('http://schemas.xmlsoap.org/soap/envelope/') ->children('http://www.ecocard.com/merchantAPI/'); @@ -132,17 +125,14 @@ public function sendData($data) ->QueryBySVSTransactionIDResponse ->TransactionResponse ); - } elseif (strpos($data, 'QueryByCustomerTransactionID') !== false) { - $headers = array( 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryByCustomerTransactionID' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); - $httpResponse = $httpRequest->send(); - $xmlResponse = $httpResponse->xml() + $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data); + $xmlResponse = simplexml_load_string($httpResponse->getBody()->getContents()) ->children('http://schemas.xmlsoap.org/soap/envelope/') ->children('http://www.ecocard.com/merchantAPI/'); @@ -160,11 +150,8 @@ public function sendData($data) ->QueryByCustomerTransactionIDResponse ->TransactionResponse ); - } else { - throw new InvalidRequestException('The transactionId or transactionReference parameter is required'); - } } } diff --git a/src/Omnipay/Ecopayz/Message/PayoutRequest.php b/src/Omnipay/Ecopayz/Message/PayoutRequest.php index db74a59a..41a27783 100644 --- a/src/Omnipay/Ecopayz/Message/PayoutRequest.php +++ b/src/Omnipay/Ecopayz/Message/PayoutRequest.php @@ -159,9 +159,8 @@ public function sendData($data) 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/Payout' ); - $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data); - $httpResponse = $httpRequest->send(); - $xmlResponse = $httpResponse->xml() + $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data); + $xmlResponse = simplexml_load_string($httpResponse->getBody()->getContents()) ->children('http://schemas.xmlsoap.org/soap/envelope/') ->children('http://www.ecocard.com/merchantAPI/'); From ce2c6cfda6390106d6d6b06a7b020ce34ab3f3b6 Mon Sep 17 00:00:00 2001 From: "Melvin D. Protacio" Date: Fri, 2 Jul 2021 13:49:18 +0800 Subject: [PATCH 08/10] remove TestListener --- phpunit.xml.dist | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ad0befd1..da14877a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,9 +14,6 @@ ./tests/ - - - ./src From d274e466b46a2e4760653eecd51f74b160381bac Mon Sep 17 00:00:00 2001 From: juno Date: Tue, 18 Jun 2024 17:11:26 +0800 Subject: [PATCH 09/10] updated ecopayz endpoints --- src/Omnipay/Ecopayz/Message/AbstractRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Omnipay/Ecopayz/Message/AbstractRequest.php b/src/Omnipay/Ecopayz/Message/AbstractRequest.php index a21aea85..dfcaa703 100644 --- a/src/Omnipay/Ecopayz/Message/AbstractRequest.php +++ b/src/Omnipay/Ecopayz/Message/AbstractRequest.php @@ -16,14 +16,14 @@ abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest * * @var string URL */ - protected $testEndpoint = 'https://secure.test.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; + protected $testEndpoint = 'https://merchantapi.test.payz.com/MerchantAPIService.asmx'; /** * Live Endpoint URL * * @var string URL */ - protected $liveEndpoint = 'https://secure.ecopayz.com/services/MerchantAPI/MerchantAPIService.asmx'; + protected $liveEndpoint = 'https://merchantapi.payz.com/MerchantAPIService.asmx'; /** * Get the Merchant ID From 8823c750197d3470048c4c1b5c11ded0971f46a3 Mon Sep 17 00:00:00 2001 From: juno Date: Tue, 18 Jun 2024 18:56:37 +0800 Subject: [PATCH 10/10] updated getRedirectEndpoint and version --- README.md | 2 +- composer.json | 2 +- src/Omnipay/Ecopayz/Message/PurchaseResponse.php | 13 ++++++++++--- .../Ecopayz/Message/PurchaseResponseTest.php | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6bad99a5..5c996829 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ to your `composer.json` file: ```json { "require": { - "dercoder/omnipay-ecopayz": "~1.0" + "dercoder/omnipay-ecopayz": "~2.0.x-dev" } } ``` diff --git a/composer.json b/composer.json index 04b38d1f..cb73f953 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } } } diff --git a/src/Omnipay/Ecopayz/Message/PurchaseResponse.php b/src/Omnipay/Ecopayz/Message/PurchaseResponse.php index 9137bab8..9083925c 100644 --- a/src/Omnipay/Ecopayz/Message/PurchaseResponse.php +++ b/src/Omnipay/Ecopayz/Message/PurchaseResponse.php @@ -16,8 +16,10 @@ */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { - protected $testEndpoint = 'https://secure.test.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx'; - protected $liveEndpoint = 'https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx'; + protected $testEndpoint = 'https://myaccount.test.payz.com/purchase/create'; + protected $liveEndpoint = 'https://myaccount.payz.com/purchase/create'; + protected $testRedirectEndpoint = 'https://myaccount.test.payz.com/purchase/request'; + protected $redirectEndpoint = 'https://myaccount.payz.com/purchase/request'; public function __construct(RequestInterface $request, $data) { @@ -37,7 +39,7 @@ public function isRedirect() public function getRedirectUrl() { - return $this->getEndpoint() . '?' . http_build_query($this->data, '', '&'); + return $this->getRedirectEndpoint() . '?' . http_build_query($this->data, '', '&'); } public function getRedirectMethod() @@ -54,4 +56,9 @@ protected function getEndpoint() { return $this->getRequest()->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; } + + protected function getRedirectEndpoint() + { + return $this->getRequest()->getTestMode() ? $this->testRedirectEndpoint : $this->redirectEndpoint; + } } diff --git a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php index 8158a8b9..326ab1ea 100644 --- a/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php +++ b/tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php @@ -25,7 +25,7 @@ public function testResult() $this->assertTrue($response->isRedirect()); $this->assertNull($response->getCode()); $this->assertNull($response->getMessage()); - $this->assertSame('https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx?PaymentPageID=100&MerchantAccountNumber=100001&CustomerIdAtMerchant=1123456789&TxID=TX4567890&Amount=12.34&Currency=EUR&MerchantFreeText=Free+Text+Description&Checksum=84bbad2a636aa9226c03f17ff813a181', $response->getRedirectUrl()); + $this->assertSame('https://myaccount.payz.com/purchase/request?PaymentPageID=100&MerchantAccountNumber=100001&CustomerIdAtMerchant=1123456789&TxID=TX4567890&Amount=12.34&Currency=EUR&MerchantFreeText=Free+Text+Description&Checksum=84bbad2a636aa9226c03f17ff813a181', $response->getRedirectUrl()); $this->assertSame('GET', $response->getRedirectMethod()); $this->assertNull($response->getRedirectData()); }