Last mile confirmation request , approval, payment Feature

This commit is contained in:
Hagernesh
2026-08-05 19:58:41 +00:00
parent 37d0cc966a
commit 1f4d659ffb
26 changed files with 1334 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
import { URL_CONSTANTS } from "@/constants/URLS";
import { client } from "../utils/api";
const L = URL_CONSTANTS.LAST_MILE_REQUESTS;
export interface LastMileRequest {
id: string;
bookingId: string;
booking?: { id: string; reference?: string } | null;
trainScheduleId: string;
status: "AWAITING_CONFIRMATION" | "SUBMITTED" | "APPROVED" | "REJECTED";
requestedContainerNumbers?: string[] | null;
rejectionReason?: string | null;
createdAt: string;
updatedAt: string;
}
export const lastMileRequestsService = {
/** One last-mile confirmation request, by id. */
get: async (id: string): Promise<LastMileRequest> => {
const { data } = await client.get(L.BY_ID(id));
return data.data ?? data;
},
/** Confirm which containers on the booking go via EDR last-mile. */
submit: async (
id: string,
containerNumbers: string[],
): Promise<LastMileRequest> => {
const { data } = await client.post(L.SUBMIT(id), { containerNumbers });
return data.data ?? data;
},
};