From 4540ce8e02997e018505803c6927fd81de7ae337 Mon Sep 17 00:00:00 2001 From: khantil Date: Tue, 28 Aug 2018 13:36:59 -0600 Subject: [PATCH] Fix to throwing exception when successful transaction We've had issues when capture transaction for an authorized token where the transaction was successful however the `isSuccessfulResponse` returned false. After bunch of logging we found that BluePay API was sending status value as `APPROVED\r`. Because of appended character `\r`, method `isSuccessfulResponse` was returning false. --- PHP/BluePay.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHP/BluePay.php b/PHP/BluePay.php index 96c04df..5885c6f 100755 --- a/PHP/BluePay.php +++ b/PHP/BluePay.php @@ -889,8 +889,8 @@ public function process() { protected function parseResponse() { parse_str($this->response, $output); - $this->status = isset($output['Result']) ? $output['Result'] : null; - $this->message = isset($output['MESSAGE']) ? $output['MESSAGE'] : null; + $this->status = isset($output['Result']) ? trim($output['Result']) : null; + $this->message = isset($output['MESSAGE']) ? trim($output['MESSAGE']) : null; $this->transID = isset($output['RRNO']) ? $output['RRNO'] : null; $this->maskedAccount = isset($output['PAYMENT_ACCOUNT']) ? $output['PAYMENT_ACCOUNT'] : null; $this->cardType = isset($output['CARD_TYPE']) ? $output['CARD_TYPE'] : null;