Skip to content

Commit

Permalink
fix: Do not cancel if refund fails
Browse files Browse the repository at this point in the history
  • Loading branch information
soleilcot committed Jun 16, 2023
1 parent 658cce9 commit 92ea933
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Order/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ public function handleAutoCancel($order, $decision)
{
// if order failed NoFraud check, try to refund and cancel order
if ($decision == 'fail' || $decision == 'fraudulent') {
$this->refundOrder($order);
// Handle custom cancel for Payment Method if needed
if (!$this->_runCustomAutoCancel($order)) {
if ($this->refundOrder($order) && !$this->_runCustomAutoCancel($order)) {
$order->cancel();
$order->setNofraudStatus($decision);
$order->setState(Order::STATE_CANCELED);
Expand Down Expand Up @@ -226,6 +225,7 @@ public function refundOrder($order)
}
} catch (\Exception $e) {
$this->logger->logRefundException($e, $order->getId());
return false;
}
}
}
Expand Down

0 comments on commit 92ea933

Please sign in to comment.