From ba01e72145180e0ce3e12edf81fbdcd9d7fb1766 Mon Sep 17 00:00:00 2001 From: Petrica RG Date: Thu, 15 Jun 2023 14:30:00 +0300 Subject: [PATCH 1/4] Replace REASON_SUCCESS with RESPONSE_SUCCESS in BuildPaymentLink function. --- src/GatewayService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GatewayService.php b/src/GatewayService.php index b2cabb9..645176b 100644 --- a/src/GatewayService.php +++ b/src/GatewayService.php @@ -295,7 +295,7 @@ function BuildPaymentLink($request, $response) { $request->Set("gatewayServlet", "/hostedpage/servlet/BuildPaymentLinkSubmit"); $this->PerformTransaction($request, $response); - return ($response->Get(GatewayResponse::RESPONSE_CODE()) == GatewayCodes::REASON_SUCCESS && + return ($response->Get(GatewayResponse::RESPONSE_CODE()) == GatewayCodes::RESPONSE_SUCCESS && $response->Get(GatewayResponse::PAYMENT_LINK_URL()) != NULL); } From 08296c8c52ce227dcf9193d1c17ee294a15c5fb3 Mon Sep 17 00:00:00 2001 From: Petrica RG Date: Thu, 15 Jun 2023 15:48:36 +0300 Subject: [PATCH 2/4] Save always CURL info fields. Add $curlCallback functionality for GatewayService.php --- src/GatewayService.php | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/GatewayService.php b/src/GatewayService.php index 645176b..d20c31b 100644 --- a/src/GatewayService.php +++ b/src/GatewayService.php @@ -56,6 +56,11 @@ class GatewayService private $rocketGateLatestExecutionTime = 0.0; // Latest request execution time private $rocketGateLatestConnectionTime = 0.0; // Latest request connection time +// +// Optional curl callback function before curl_exec() +// + private $curlCallback; + ////////////////////////////////////////////////////////////////////// // // GatewayService() - Constructor for class. @@ -402,6 +407,18 @@ function SetReadTimeout($timeout) $this->rocketGateReadTimeout = $timeout;// Number of seconds } +////////////////////////////////////////////////////////////////////// +// +// SetCurlCallback() - Set optional curl callback +// that will allow to manipulate +// with CURL instance before curl_exec(). +// +////////////////////////////////////////////////////////////////////// +// + function SetCurlCallback($callback) + { + $this->curlCallback = $callback; + } ////////////////////////////////////////////////////////////////////// // @@ -818,17 +835,27 @@ function PerformCURLTransaction($host, GatewayRequest $request, GatewayResponse curl_setopt($handle, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); ////////////////////////////////////////////////////////////////////// + +// +// Apply optional curl callback if available +// + if (is_callable($this->curlCallback)) { + $handle = call_user_func($this->curlCallback, $handle); + } + // // Execute the operation. // $results = curl_exec($handle);// Execute the operation +// +// Save current CURL info fields +// + $this->rocketGateLatestConnectionTime = curl_getinfo($handle, CURLINFO_CONNECT_TIME); + $this->rocketGateLatestExecutionTime = curl_getinfo($handle, CURLINFO_TOTAL_TIME); + $this->rocketGateLatestResponseCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); + if (!($results)) {// Did it fail? $errorCode = curl_errno($handle);// Get the error code - if (!$errorCode) { - $this->rocketGateLatestConnectionTime = curl_getinfo($handle, CURLINFO_CONNECT_TIME); - $this->rocketGateLatestExecutionTime = curl_getinfo($handle, CURLINFO_TOTAL_TIME); - $this->rocketGateLatestResponseCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); - } $errorString = curl_error($handle);// Get the error text curl_close($handle);// Done with handle From d2b07134dcf7ebb7d925901716574b40d83cc528 Mon Sep 17 00:00:00 2001 From: Petrica RG Date: Wed, 28 Feb 2024 15:08:32 +0200 Subject: [PATCH 3/4] Add REASON_INVALID_GOOGLE_PAY_TOKEN in P8.17 version. --- src/GatewayChecksum.php | 2 +- src/GatewayCodes.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GatewayChecksum.php b/src/GatewayChecksum.php index 8e95fe1..9683640 100644 --- a/src/GatewayChecksum.php +++ b/src/GatewayChecksum.php @@ -10,7 +10,7 @@ class GatewayChecksum { - private const VERSION = "P8.16"; + private const VERSION = "P8.17"; public static $checksum = ""; public static $baseChecksum = "f23b94cc9ee73502ed35284d963c5bec"; public static $versionNo = GatewayChecksum::VERSION; diff --git a/src/GatewayCodes.php b/src/GatewayCodes.php index 8ad0582..5dc7e4f 100644 --- a/src/GatewayCodes.php +++ b/src/GatewayCodes.php @@ -214,4 +214,5 @@ class GatewayCodes { const REASON_INVALID_REFERENCE_SCHEME_TRANSACTION = 459; const REASON_INVALID_CUSTOMER_ADDRESS = 460; const REASON_INVALID_BUILD_PAYMENT_LINK_REQUEST = 462; + const REASON_INVALID_GOOGLE_PAY_TOKEN = 464; } From 8f178e2f18ffd0f7adf0c1925a1cc92d04b3a572 Mon Sep 17 00:00:00 2001 From: Petrica RG Date: Wed, 28 Feb 2024 15:11:58 +0200 Subject: [PATCH 4/4] Add REASON_INVALID_GOOGLE_PAY_TOKEN in P8.17 version. --- src/GatewayChecksum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GatewayChecksum.php b/src/GatewayChecksum.php index 9683640..ed31fe7 100644 --- a/src/GatewayChecksum.php +++ b/src/GatewayChecksum.php @@ -12,7 +12,7 @@ class GatewayChecksum { private const VERSION = "P8.17"; public static $checksum = ""; - public static $baseChecksum = "f23b94cc9ee73502ed35284d963c5bec"; + public static $baseChecksum = "9f431e8ab78f49b3ac956b3386ce02d2"; public static $versionNo = GatewayChecksum::VERSION; //////////////////////////////////////////////////////////////////////