Skip to content

Commit

Permalink
Fixed issue with captured transaction on Fallback (#79)
Browse files Browse the repository at this point in the history
* Fixed issue with captured transaction on Fallback
  • Loading branch information
ed007m authored Nov 12, 2020
1 parent 5d86cec commit c75a37f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Controller/Payment/Fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private function prepareResponse(Redirect $resultRedirect, Transaction $transact
{
if ($transaction->transactionWasCancelled()) {
$this->messageManager->addWarningMessage(__('Your order was cancelled in Vipps.'));
} elseif ($transaction->isTransactionReserved()) {
} elseif ($transaction->isTransactionReserved() || $transaction->isTransactionCaptured()) {
return $resultRedirect->setPath('checkout/onepage/success', ['_secure' => true]);
} elseif ($transaction->isTransactionExpired()) {
$this->messageManager->addErrorMessage(
Expand Down
13 changes: 13 additions & 0 deletions Gateway/Transaction/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ public function isTransactionReserved(): bool
return false;
}

/**
* @return bool
*/
public function isTransactionCaptured(): bool
{
$item = $this->transactionLogHistory->getLastSuccessItem();
if ($item && $item->getOperation() == self::TRANSACTION_OPERATION_CAPTURE) {
return true;
}

return false;
}

/**
* @return bool
* @throws \Exception
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "magento2-module",
"description": "Vipps Payment Method",
"license": "proprietary",
"version": "2.3.8",
"version": "2.3.9",
"require": {
"magento/framework": "102.0.*",
"magento/module-sales": "102.0.*",
Expand Down

0 comments on commit c75a37f

Please sign in to comment.