mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 13:38:20 +00:00
Implement clearance-first booking flow and completion process for customs contracts
This commit is contained in:
@@ -502,6 +502,31 @@ export const contractsService = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Complete a bare initiated booking instance once its per-booking clearance
|
||||
* is CLEARANCE_READY — same payload as create; the API persists cargo,
|
||||
* prices, invoices, checks the booking window and moves the booking to the
|
||||
* operations queue.
|
||||
*/
|
||||
completeBookingUnderContract: async (
|
||||
id: string,
|
||||
bookingId: string,
|
||||
payload: Freight.CreateBookingUnderContractDto,
|
||||
): Promise<{ id: string; reference: string; warnings?: string[] }> => {
|
||||
const result = await postContract<{
|
||||
booking?: { id: string; reference: string };
|
||||
id?: string;
|
||||
reference?: string;
|
||||
warnings?: string[];
|
||||
}>(C.BOOKINGS_COMPLETE(id, bookingId), payload);
|
||||
const booking = result.booking ?? result;
|
||||
return {
|
||||
id: booking.id ?? "",
|
||||
reference: booking.reference ?? "",
|
||||
warnings: result.warnings,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Pre-create validation + authoritative price preview: the same
|
||||
* BookingPricingService pass that prices the booking on create (rail +
|
||||
|
||||
Reference in New Issue
Block a user