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 312a24c85ca..28fa8556545 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -365,6 +365,10 @@ + + + +