From 60f379ba06e8ce19e1a9557d41ce02edead8d1d5 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmytro Naumenko Date: Fri, 17 May 2024 12:30:07 +0300 Subject: [PATCH] Payment_gross is empty for non-USD payments --- src/Message/CompletePurchaseResponse.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index 930aea0..7d67e23 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -93,7 +93,11 @@ public function getTransactionStatus(): string */ public function getAmount(): string { - return $this->data['payment_gross'] ?? $this->data['mc_gross']; + if (isset($this->data['payment_gross']) && $this->data['payment_gross'] !== "") { + return $this->data['payment_gross']; + } + + return $this->data['mc_gross']; } /** @@ -111,7 +115,11 @@ public function getResult() */ public function getFee(): string { - return $this->data['payment_fee'] ?? $this->data['mc_fee']; + if (isset($this->data['payment_fee']) && $this->data['payment_fee'] !== "") { + return $this->data['payment_fee']; + } + + return $this->data['mc_fee']; } /**