Reflect a booking's cancelled status immediately after this refund action
PHP Tests / php-tests (push) Waiting to run
PHP Tests / php-tests (push) Waiting to run
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.
This commit is contained in:
@@ -61,6 +61,17 @@ class RefundBookingTableAction
|
|||||||
auth()->id(),
|
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()
|
Notification::make()
|
||||||
->title('Refund processed')
|
->title('Refund processed')
|
||||||
->success()
|
->success()
|
||||||
|
|||||||
Reference in New Issue
Block a user