1 import { CreateFulfillmentDTO } from "@medusajs/framework/types"
2
3 export function generateCreateFulfillmentData(
4 data: Partial<CreateFulfillmentDTO> & {
5 provider_id: string
6 shipping_option_id: string
7 }
8 ) {
9 const randomString = Math.random().toString(36).substring(7)
10
11 return {
12 location_id: "test-location",
13 packed_at: null,
14 shipped_at: null,
15 delivered_at: null,
16 canceled_at: null,
17 data: null,
18 provider_id: data.provider_id,
19 shipping_option_id: data.shipping_option_id,
20 metadata: data.metadata ?? null,
21 delivery_address: data.delivery_address ?? {
22 address_1: "test-address_" + randomString,
23 address_2: "test-address_" + randomString,
24 city: "test-city_" + randomString,
25 postal_code: "test-postal-code_" + randomString,
26 country_code: "test-country-code_" + randomString,
27 province: "test-province_" + randomString,
28 phone: "test-phone_" + randomString,
29 full_name: "test-full-name_" + randomString,
30 },
31 items: data.items ?? [
32 {
33 title: "test-title_" + randomString,
34 sku: "test-sku_" + randomString,
35 quantity: 1,
36 barcode: "test-barcode_" + randomString,
37 },
38 ],
39 labels: data.labels ?? [
40 {
41 tracking_number: "test-tracking-number_" + randomString,
42 tracking_url: "test-tracking-url_" + randomString,
43 label_url: "test-label-url_" + randomString,
44 },
45 ],
46 order: data.order ?? {},
47 additional_data: data.additional_data,
48 }
49 }