diff --git a/Plugin/CustomerBalance/Observer/PreventDoubleCreditRevert.php b/Plugin/CustomerBalance/Observer/PreventDoubleCreditRevert.php new file mode 100644 index 00000000000..cf0bb87cc58 --- /dev/null +++ b/Plugin/CustomerBalance/Observer/PreventDoubleCreditRevert.php @@ -0,0 +1,37 @@ +getData('order'); + if (!$order || + !$order instanceof OrderInterface || + !$order->getPayment() + ) { + return $proceed($observer); + } + + if ($observer->getEvent()->getName() == 'restore_quote' && + $this->isMollieOrder($order) + ) { + return $subject; + } + + return $proceed($observer); + } + + private function isMollieOrder(OrderInterface $order): bool + { + $payment = $order->getPayment(); + + return strstr($payment->getMethod(), 'mollie_methods_') !== false; + } +} diff --git a/etc/di.xml b/etc/di.xml index 40b5c5fd2b6..9fb71038043 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -367,6 +367,10 @@ + + + +