From b89fd05901f4bc9f2c7b9a603b4499fe28be01c8 Mon Sep 17 00:00:00 2001 From: khantil Date: Wed, 28 Nov 2018 20:46:17 -0800 Subject: [PATCH 1/2] Fix random exception being thrown for Approved Transactions The bluepay transaction call is throwing random error even when the Transactions are successful. This happens only when the API response has `Result` variable at first place in the URL parameter like `Location: /interfaces/wlcatch?Result=APPROVED&CVV2=_&TRANSACTION_TYPE=SALE&....`. So when `parse_str` in `parseResponse` tries to parse the URL parameters then it parses the key string for `Result` variable as `Location: /interfaces/wlcatch?Result => APPROVED` instead of `Result => APPROVED`. In fact, because of this bug any variable that appears after `?` was not getting parsed and thus it'll throw random errors like null transaction Id. Fix: So the fix is to remove the string `Location: /interfaces/wlcatch?` before $header value is assigned to `$this->response`. --- PHP/BluePay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHP/BluePay.php b/PHP/BluePay.php index 44b71a4..2afa7ea 100755 --- a/PHP/BluePay.php +++ b/PHP/BluePay.php @@ -928,7 +928,7 @@ public function process() { $headers = explode("\n", $headers); foreach($headers as $header) { if (stripos($header, 'Location:') !== false) { - $this->response = $header; + $this->response = substr($header, strrpos($header, '/') + 1); } } } else { From 41a40df71d39ab0008a1ac4a9664d63c7b7a9284 Mon Sep 17 00:00:00 2001 From: khantil Date: Sun, 9 Dec 2018 15:46:29 -0800 Subject: [PATCH 2/2] Corrected replace char from `/` to `?` --- PHP/BluePay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHP/BluePay.php b/PHP/BluePay.php index 2afa7ea..d5644c5 100755 --- a/PHP/BluePay.php +++ b/PHP/BluePay.php @@ -928,7 +928,7 @@ public function process() { $headers = explode("\n", $headers); foreach($headers as $header) { if (stripos($header, 'Location:') !== false) { - $this->response = substr($header, strrpos($header, '/') + 1); + $this->response = substr($header, strrpos($header, '?') + 1); } } } else {