mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 08:18:20 +00:00
Last mile confirmation request , approval, payment Feature
This commit is contained in:
@@ -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;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user