finilize gl flow for export

This commit is contained in:
Marshal
2026-07-02 17:55:59 +00:00
parent f77e4d150b
commit dd47068a4b
24 changed files with 2462 additions and 598 deletions

View File

@@ -354,6 +354,59 @@ export const contractsService = {
return unwrap(response.data) as Freight.ClearanceT1State;
},
/** Train schedules carrying customs bookings — GL DJ gate-pass table. */
getDjClearanceSchedules: async (): Promise<Freight.DjClearanceSchedule[]> => {
const response = await client.get(C.CLEARANCE_DJ_SCHEDULES);
return unwrap(response.data) as Freight.DjClearanceSchedule[];
},
/** Gate pass for every customs booking on a train schedule (captures time). */
grantScheduleGatepass: async (
scheduleId: string,
gatepassAt?: string,
): Promise<{ granted: number; skipped: Array<{ bookingId: string; error: string }> }> => {
const response = await client.post(C.CLEARANCE_SCHEDULE_GATEPASS(scheduleId), {
gatepassAt,
});
return unwrap(response.data) as {
granted: number;
skipped: Array<{ bookingId: string; error: string }>;
};
},
/** Gate pass for a single customs booking (captures time). */
grantGatepass: async (
bookingId: string,
gatepassAt?: string,
): Promise<{ bookingId: string; gatepassAt: string }> => {
const response = await client.post(C.BOOKING_GATEPASS(bookingId), { gatepassAt });
return unwrap(response.data) as { bookingId: string; gatepassAt: string };
},
/** GL DJ raises the post-offload final invoice (amount + invoice document). */
sendFinalInvoice: async (
bookingId: string,
payload: { amount: number; currency: string; description?: string; file: File },
): Promise<Freight.ClearanceFinalInvoiceSummary> => {
const form = new FormData();
form.append("amount", String(payload.amount));
form.append("currency", payload.currency);
if (payload.description) form.append("description", payload.description);
form.append("file", payload.file);
const response = await client.post(C.BOOKING_FINAL_INVOICE(bookingId), form, {
headers: { "Content-Type": "multipart/form-data" },
});
return unwrap(response.data) as Freight.ClearanceFinalInvoiceSummary;
},
/** GL (ET or DJ) confirms the payment slip — settles the final invoice. */
confirmFinalInvoicePaid: async (
bookingId: string,
): Promise<Freight.ClearanceFinalInvoiceSummary> => {
const response = await client.post(C.BOOKING_FINAL_INVOICE_CONFIRM(bookingId));
return unwrap(response.data) as Freight.ClearanceFinalInvoiceSummary;
},
// ── Path A self-clearance (Operations review) ──
getOpsClearanceQueue: async (): Promise<PaginatedContracts> => {
const response = await client.get<PaginatedContracts>(