Skip to content

Commit

Permalink
moved code down
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuesken committed Jan 15, 2025
1 parent 56b7641 commit 34360b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Payment/MollieOrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ public function onWebhookAction()
return;
}

//don't do webhooks when order is in processing or completed state
$orderStatus = $order->get_status();
if (in_array($orderStatus, ['processing', 'completed'], true) && $payment->status !== 'completed') {
$this->logger->info($this->gateway->id . ": Order {$order->get_id()} is in {$orderStatus} state, not processing webhook for payment object {$payment->id} (" . $payment->mode . ") with staus {$payment->status}.");
return;
}

// Log a message that webhook was called, doesn't mean the payment is actually processed
$this->logger->debug($this->gateway->id . ": Mollie payment object {$payment->id} (" . $payment->mode . ") webhook call for order {$order->get_id()}.", [true]);
// Get payment method title
Expand Down Expand Up @@ -173,6 +166,13 @@ public function onWebhookAction()
$this->setBillingAddressAfterPayment($payment, $order);
}

//don't do webhooks when order is in processing or completed state
$orderStatus = $order->get_status();
if (in_array($orderStatus, ['processing', 'completed'], true) && $payment->status !== 'completed') {
$this->logger->debug($this->gateway->id . ": Order {$order->get_id()} is in {$orderStatus} state, not processing webhook for payment object {$payment->id} (" . $payment->mode . ") with staus {$payment->status}.");
return;
}

if (method_exists($payment_object, $method_name)) {
do_action($this->pluginId . '_before_webhook_payment_action', $payment, $order);
$payment_object->{$method_name}($order, $payment, $payment_method_title);
Expand Down

0 comments on commit 34360b7

Please sign in to comment.