diff --git a/README.md b/README.md index 1eb11bb..a5890d5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This repository contains the OpenCart wallee payment module that enables the sh ## Documentation -* [English](https://plugin-documentation.wallee.com/wallee-payment/opencart-2.2/1.0.46/docs/en/documentation.html) +* [English](https://plugin-documentation.wallee.com/wallee-payment/opencart-2.2/1.0.49/docs/en/documentation.html) ## Support @@ -21,4 +21,4 @@ Support queries can be issued on the [wallee support site](https://app-wallee.co ## License -Please see the [license file](https://github.com/wallee-payment/opencart-2.2/blob/1.0.46/LICENSE) for more information. \ No newline at end of file +Please see the [license file](https://github.com/wallee-payment/opencart-2.2/blob/1.0.49/LICENSE) for more information. \ No newline at end of file diff --git a/docs/en/documentation.html b/docs/en/documentation.html index c4fd38d..405d06e 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -22,7 +22,7 @@

Documentation

  • - + Source
  • @@ -49,7 +49,7 @@

    1. -

      Download the extension.

      +

      Download the extension.

    2. Extract the files and upload the content of the Upload directory into the root directory of your store using FTP/SSH.

      diff --git a/upload/admin/view/template/payment/wallee.tpl b/upload/admin/view/template/payment/wallee.tpl index fb9404c..9d6b3ea 100644 --- a/upload/admin/view/template/payment/wallee.tpl +++ b/upload/admin/view/template/payment/wallee.tpl @@ -271,14 +271,14 @@
      -

      1.0.46

      +

      1.0.49

      -

      2022/07/22 11:45:42

      +

      2022/08/11 13:04:23

      diff --git a/upload/system/library/wallee/webhook/transaction.php b/upload/system/library/wallee/webhook/transaction.php index 90936c8..01d604c 100644 --- a/upload/system/library/wallee/webhook/transaction.php +++ b/upload/system/library/wallee/webhook/transaction.php @@ -29,9 +29,21 @@ protected function getTransactionId($transaction){ protected function processOrderRelatedInner(array $order_info, $transaction){ /* @var \Wallee\Sdk\Model\Transaction $transaction */ - $transaction_info = \Wallee\Entity\TransactionInfo::loadByOrderId($this->registry, $order_info['order_id']); + $transactionInfo = \Wallee\Entity\TransactionInfo::loadByOrderId($this->registry, $order_info['order_id']); + + $finalStates = [ + \Wallee\Sdk\Model\TransactionState::FAILED, + \Wallee\Sdk\Model\TransactionState::VOIDED, + \Wallee\Sdk\Model\TransactionState::DECLINE, + \Wallee\Sdk\Model\TransactionState::FULFILL + ]; + \WalleeHelper::instance($this->registry)->ensurePaymentCode($order_info, $transaction); - if ($transaction->getState() != $transaction_info->getState()) { + + $transactionInfoState = strtoupper($transactionInfo->getState()); + if (!in_array($transactionInfoState, $finalStates)) { + \Wallee\Service\Transaction::instance($this->registry)->updateTransactionInfo($transaction, $order_info['order_id']); + switch ($transaction->getState()) { case \Wallee\Sdk\Model\TransactionState::CONFIRMED: $this->processing($transaction, $order_info); @@ -49,7 +61,8 @@ protected function processOrderRelatedInner(array $order_info, $transaction){ $this->failed($transaction, $order_info); break; case \Wallee\Sdk\Model\TransactionState::FULFILL: - if ($transaction_info->getState() != 'AUTHORIZED' && $transaction_info->getState() != 'COMPLETED') { + + if (!in_array($transactionInfoState, ['AUTHORIZED', 'COMPLETED'])) { $this->authorize($transaction, $order_info); } $this->fulfill($transaction, $order_info); @@ -65,8 +78,6 @@ protected function processOrderRelatedInner(array $order_info, $transaction){ break; } } - - \Wallee\Service\Transaction::instance($this->registry)->updateTransactionInfo($transaction, $order_info['order_id']); } protected function processing(\Wallee\Sdk\Model\Transaction $transaction, array $order_info){