feat(bookings): update payment eligibility logic for general contracts and one-time bookings

This commit is contained in:
Marshal
2026-06-22 11:40:35 +00:00
parent b777da4bd7
commit ff039bd440
3 changed files with 17 additions and 3 deletions

View File

@@ -50,8 +50,15 @@ export function ReadonlyBookingView({ booking }: { booking: Freight.IBooking })
});
const pricing = booking.pricingBreakdown;
// A general contract is paid once it's FULLY_EXECUTED (signed) — it never
// enters batch selection. A one-time booking can only pay once it's been
// SELECTED_FOR_BATCH (assigned a slot with a pay window).
const isGeneralContract = booking.bookingType === "GENERAL_CONTRACT";
const canPay =
status === "SELECTED_FOR_BATCH" && booking.paymentStatus !== "PAID";
booking.paymentStatus !== "PAID" &&
(isGeneralContract
? status === "FULLY_EXECUTED"
: status === "SELECTED_FOR_BATCH");
const showCountdown = canPay && !!booking.paymentDeadline;
const isExpired = status === "EXPIRED";
const isPendingConsolidation = status === "PENDING_CONSOLIDATION";

View File

@@ -180,6 +180,9 @@ function PrimaryAction({
}) {
const { status, id } = booking;
const go = () => onNavigate(`/bookings/${id}`);
// A general contract is payable as soon as it's FULLY_EXECUTED (signed); a
// one-time booking only after it's SELECTED_FOR_BATCH.
const isGeneralContract = booking.bookingType === "GENERAL_CONTRACT";
if (status === "DRAFT") {
return (
<Button
@@ -210,7 +213,10 @@ function PrimaryAction({
</Button>
);
}
if (status === "SELECTED_FOR_BATCH" && booking.paymentStatus !== "PAID") {
const payableStatus = isGeneralContract
? "FULLY_EXECUTED"
: "SELECTED_FOR_BATCH";
if (status === payableStatus && booking.paymentStatus !== "PAID") {
return <PayNowButton booking={booking} />;
}
return (