Skip to content

Commit

Permalink
Move Payment object check to the capture method
Browse files Browse the repository at this point in the history
  • Loading branch information
inpsyde-maticluznar committed Feb 6, 2024
1 parent a6e2f82 commit e86fee2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/MerchantCapture/MerchantCaptureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ public function run(ContainerInterface $container): bool

add_action(
$pluginId . '_after_webhook_action',
static function (Payment $payment, WC_Order $order) use ($container) {
static function ($payment, WC_Order $order) use ($container) {

if (!$payment instanceof Payment) {
return;
}

if ($payment->isAuthorized()) {
if (!$payment->getAmountCaptured() == 0.0) {
Expand Down
4 changes: 1 addition & 3 deletions src/Payment/MollieOrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ public function onWebhookAction()
));
}

if ($payment instanceof Payment) {
do_action($this->pluginId . '_after_webhook_action', $payment, $order);
}
do_action($this->pluginId . '_after_webhook_action', $payment, $order);
// Status 200
}
/**
Expand Down

0 comments on commit e86fee2

Please sign in to comment.