diff --git a/controllers/admin/AdminRefundController.php b/controllers/admin/AdminRefundController.php index 43f3973c5..e68412cde 100644 --- a/controllers/admin/AdminRefundController.php +++ b/controllers/admin/AdminRefundController.php @@ -134,11 +134,7 @@ private function sentRefundRequest(\Order $order, \OrderPayment $payment, float } $maxRefundAmount -= $refundAmount; - try { - $this->orderService->refund($order, $refundAmount); - } catch (\Throwable $th) { - // Silently handle refund errors - } + $this->orderService->refund($order, $refundAmount); $body = $this->refundBuilder->create($order, $payment, $refundAmount); diff --git a/src/Refund/Decorators/IssuePartialRefundHandler.php b/src/Refund/Decorators/IssuePartialRefundHandler.php index 331ddac05..d934f1d56 100644 --- a/src/Refund/Decorators/IssuePartialRefundHandler.php +++ b/src/Refund/Decorators/IssuePartialRefundHandler.php @@ -60,15 +60,17 @@ public function __construct( */ public function handle(IssuePartialRefundCommand $command): void { - if (\Configuration::get(Settings::LABEL_REFUND_CONF)){ + $buckarooRefundEnabled = (bool) \Configuration::get(Settings::LABEL_REFUND_CONF); + + if ($buckarooRefundEnabled) { $refundSummary = $this->refundHandler->getRefundSummary($command); - $this->handler->handle($command); - if ( - !$this->session->has(self::KEY_SKIP_REFUND_REQUEST) - ) { - $this->refundHandler->execute($command, $refundSummary); - $this->session->remove(self::KEY_SKIP_REFUND_REQUEST); - } + } + + $this->handler->handle($command); + + if ($buckarooRefundEnabled && !$this->session->has(self::KEY_SKIP_REFUND_REQUEST)) { + $this->refundHandler->execute($command, $refundSummary); + $this->session->remove(self::KEY_SKIP_REFUND_REQUEST); } } }