From 90e5807a1761ec486225d82212e8595cbc6fa8fc Mon Sep 17 00:00:00 2001 From: Nyan Lin Paing <117423022+LinPaing21@users.noreply.github.com> Date: Thu, 3 Sep 2026 11:46:25 +0700 Subject: [PATCH] Reflect a booking's cancelled status immediately after this refund action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MarkBookingRefunded (queued) is still the source of truth for every other caller (API, ProcessRefundAction) — left untouched. Scoped here only: after a successful refund from the booking list/detail action specifically, flip the status in the same request instead of waiting on the queue worker, so the row/page reflects Cancelled the moment this request finishes. --- .../src/Filament/Actions/RefundBookingTableAction.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app-modules/payment/src/Filament/Actions/RefundBookingTableAction.php b/app-modules/payment/src/Filament/Actions/RefundBookingTableAction.php index 6f2d34b..86856cc 100644 --- a/app-modules/payment/src/Filament/Actions/RefundBookingTableAction.php +++ b/app-modules/payment/src/Filament/Actions/RefundBookingTableAction.php @@ -61,6 +61,17 @@ class RefundBookingTableAction auth()->id(), ); + // RefundBookingAction only dispatches RefundProcessed; + // the actual Confirmed → Cancelled flip happens in + // MarkBookingRefunded, which is queued (kept that way — + // it's the API/webhook path's source of truth too). Set + // it here as well, scoped to just this Filament action, + // so the row/page reflects it the moment this request + // finishes instead of after a queue worker catches up. + if ($record->status === BookingStatus::Confirmed) { + $record->update(['status' => BookingStatus::Cancelled]); + } + Notification::make() ->title('Refund processed') ->success()