From d274e466b46a2e4760653eecd51f74b160381bac Mon Sep 17 00:00:00 2001 From: juno Date: Tue, 18 Jun 2024 17:11:26 +0800 Subject: [PATCH 1/2] 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 2/2] 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()); }