From b9be9ba4781987994cc1610594d4e74349f862ea Mon Sep 17 00:00:00 2001 From: Shen DeShayne Date: Tue, 28 May 2019 18:53:20 -0700 Subject: [PATCH] more accurate response message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `exact_message` returns “Transaction Normal” when `transaction_approved` is 0 (failure). This provides a more descriptive message. --- src/Message/PayeezyResponse.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Message/PayeezyResponse.php b/src/Message/PayeezyResponse.php index 4710d73..ef754a4 100644 --- a/src/Message/PayeezyResponse.php +++ b/src/Message/PayeezyResponse.php @@ -120,7 +120,13 @@ public function getCardReference() public function getMessage() { - return $this->getDataItem('exact_message'); + // bank_message is more human readable. See: https://support.payeezy.com/hc/en-us/articles/206601408-First-Data-Payeezy-Gateway-Web-Service-API-Reference-Guide + $message = $this->getDataItem('bank_message'); + if (empty($message)) { + $message = $this->getDataItem('exact_message'); + } + + return $message; } /**