diff --git a/src/Magewire/Checkout/Payment/AbstractProcessor.php b/src/Magewire/Checkout/Payment/AbstractProcessor.php index 0b19c46..a93ddab 100644 --- a/src/Magewire/Checkout/Payment/AbstractProcessor.php +++ b/src/Magewire/Checkout/Payment/AbstractProcessor.php @@ -110,15 +110,26 @@ public function loadPaymentActions(): void public function placeOrder(): void { - $this->loadPaymentActions(); - $redirectUrl = $this->getRedirectUrl(); - - $this->dispatchBrowserEvent( - 'rvvup:update:showModal', - [ - 'redirectUrl' => $redirectUrl, - ] - ); + try { + $this->loadPaymentActions(); + $redirectUrl = $this->getRedirectUrl(); + + $this->dispatchBrowserEvent( + 'rvvup:update:showModal', + [ + 'redirectUrl' => $redirectUrl, + ] + ); + } catch (\Exception $exception) { + $detail = [ + 'text' => $exception->getMessage(), + 'method' => $this->getMethodCode(), + ]; + + $this->dispatchBrowserEvent('order:place:error', $detail); + $this->dispatchBrowserEvent(sprintf('order:place:%s:error', $detail['method']), $detail); + $this->dispatchErrorMessage($detail['text']); + } } /**