Skip to content

Commit

Permalink
Merged in SC-140 (pull request #28)
Browse files Browse the repository at this point in the history
[SC-140] Don't capture non-deliverable orders

* [SC-140] Invoice Capture will now not proceed if order does not have Svea actions CanDeliverOrder or CanDeliverOrderPartially.


Approved-by: Alexandru-Georgian Mazalu
  • Loading branch information
martinSternelius committed May 20, 2022
1 parent 7dd9f28 commit 6b80f6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Model/Svea/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,16 @@ public function captureSveaPayment(\Magento\Payment\Model\InfoInterface $payment
$payment->setAdditionalInformation('svea_delivery_id', $delivery->getId());
$payment->setTransactionId($delivery->getId());
$invoice->setTransactionId($delivery->getId());
return;
}

return;
}

if ($isFullDelivery && !$sveaOrder->canDeliver()) {
throw new LocalizedException(__('We can\'t do a full delivery on this particular order. Capture offline and please do it manually in Svea.'));
// If no delivery exists then this order is currently not deliverable for other reasons,
// Likely payment review is required due to high invoice amount
throw new LocalizedException(
__(
'Can not capture. Svea has not marked the order as Deliverable. Review the order in Svea.'
)
);
}

$paymentObj = new DeliverOrder();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sveawebpay/nwt-magento2-checkout",
"description": "Svea Checkout",
"type": "magento2-module",
"version": "1.2.17",
"version": "1.2.18",
"autoload": {
"files": [
"registration.php"
Expand Down

0 comments on commit 6b80f6a

Please sign in to comment.