Skip to content

Commit

Permalink
Merge pull request #211 from dystcz/fix/disable-marking-pending-payme…
Browse files Browse the repository at this point in the history
…nt-status-when-order-has-one-of-future-statuses

fix: disable marking pending payment when order already has one of future statuses
  • Loading branch information
repl6669 authored Dec 3, 2024
2 parents 64ec3e0 + aaf2a8c commit 006a83e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Domain/Payments/Actions/MarkPendingPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ class MarkPendingPayment
*/
public function __invoke(Order $order): Order
{
$disabledStatuses = [
'payment-received',
'dispatched',
'delivered',
'cancelled',
'on-hold',
];

if (in_array($order->status, $disabledStatuses)) {
return $order;
}

$order = (new ChangeOrderStatus)($order, OrderStatus::PENDING_PAYMENT);

return $order;
Expand Down

0 comments on commit 006a83e

Please sign in to comment.