From 9037e5bd15f30cb9d852de9c5d240113f4965d1d Mon Sep 17 00:00:00 2001 From: Aimeos Date: Tue, 12 May 2020 11:41:16 +0200 Subject: [PATCH] Fixes for token based payments --- src/Messages/Backend/PurchaseRequest.php | 20 ++++++++++---------- src/Messages/NotificationValuesTrait.php | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Messages/Backend/PurchaseRequest.php b/src/Messages/Backend/PurchaseRequest.php index ea68c92..ae3b444 100644 --- a/src/Messages/Backend/PurchaseRequest.php +++ b/src/Messages/Backend/PurchaseRequest.php @@ -26,15 +26,17 @@ public function getData() if (! empty($items)) { $item = array_shift($items); - $shoppingCartItem = [ - 'number' => $item['number'], - 'productNr' => $item['productNr'], - 'description' => $item['description'], - 'quantity' => $item['quantity'], - 'amount' => $item['amount'], + $shoppingCart = [ + 'item' => [ + 'number' => $item['number'], + 'productNr' => $item['productNr'], + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'amount' => $item['amount'], + ] ]; } else { - $shoppingCartItem = []; + $shoppingCart = []; } return [ @@ -49,9 +51,7 @@ public function getData() 'customerName' => $this->getCustomerName(), 'order' => [ 'description' => $this->getDescription(), - 'shoppingCart' => [ - 'item' => $shoppingCartItem, - ], + 'shoppingCart' => $shoppingCart, ], 'confirmationUrl' => $this->getNotifyUrl(), 'language' => strtoupper($this->getLanguage()), diff --git a/src/Messages/NotificationValuesTrait.php b/src/Messages/NotificationValuesTrait.php index 9a4b8bd..93362a5 100644 --- a/src/Messages/NotificationValuesTrait.php +++ b/src/Messages/NotificationValuesTrait.php @@ -168,7 +168,8 @@ public function getApprovalCode() */ public function isSuccessful() { - return $this->getTransactionState() === static::TRANSACTION_STATE_BILLED; + return $this->getTransactionState() === static::TRANSACTION_STATE_BILLED + || $this->getOperationStatus() === static::OPERATION_STATUS_OK; } /**