Skip to content

Commit

Permalink
Merge pull request #94 from vippsas/publication-2.4.9
Browse files Browse the repository at this point in the history
Publication 2.4.9
  • Loading branch information
voleye authored Mar 22, 2021
2 parents 756efc4 + a9ae97b commit 0df6016
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions Model/TransactionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private function processReservedTransaction(QuoteInterface $vippsQuote, Transact
if ($vippsQuote->getOrderId()) {
$order = $this->orderRepository->get($vippsQuote->getOrderId());
} else {
$order = $this->placeOrder($transaction);
$order = $this->placeOrder($vippsQuote, $transaction);
}

$paymentAction = $this->config->getValue('vipps_payment_action');
Expand Down Expand Up @@ -319,14 +319,22 @@ private function acquireLock($reservedOrderId)
* @throws WrongAmountException
* @throws \Exception
*/
private function placeOrder(Transaction $transaction)
private function placeOrder(QuoteInterface $vippsQuote, Transaction $transaction)
{
$quote = $this->quoteLocator->get($transaction->getOrderId());
$quote = $this->cartRepository->get($vippsQuote->getQuoteId());
if (!$quote) {
throw new \Exception( //@codingStandardsIgnoreLine
__('Could not place order. Could not find quote with such reserved order id.')
__('Could not place order. Could not find quote.')
);
}

if ($vippsQuote->getReservedOrderId()
&& $quote->getReservedOrderId() !== $vippsQuote->getReservedOrderId()
) {
$quote->setReservedOrderId($vippsQuote->getReservedOrderId());
$this->cartRepository->save($quote);
}

if (!$quote->getReservedOrderId() || $quote->getReservedOrderId() !== $transaction->getOrderId()) {
throw new \Exception( //@codingStandardsIgnoreLine
__('Quote reserved order id does not match Vipps transaction order id.')
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.4.8",
"version": "2.4.9",
"require": {
"magento/framework": "103.0.*",
"magento/module-sales": "103.0.*",
Expand Down

0 comments on commit 0df6016

Please sign in to comment.