You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
851 B

import { addMsCheckoutFillJob } from "@/workers/rpa/queue";
import type { NormalizedCargo } from "@/modules/quote/types";
import type { MsCoverageKind } from "@/lib/mothership/ms-checkout-selection";
export type MsCheckoutFillJobData = {
quoteId: string;
requestId: string;
customerId: string;
cargo: NormalizedCargo;
preferredCarrier: string;
coverage: MsCoverageKind;
cargoValueUsd?: number;
};
export async function enqueueMsCheckoutFillJob(
data: MsCheckoutFillJobData,
): Promise<void> {
if (process.env.RPA_QUEUE_ENABLED === "false") {
console.log(`[rpa-queue] 队列已禁用 ms-checkout quote_id=${data.quoteId}`);
return;
}
await addMsCheckoutFillJob(data);
console.log(
`[rpa-queue] 已入队 ms-checkout-fill quote_id=${data.quoteId} carrier=${data.preferredCarrier} coverage=${data.coverage}`,
);
}