feat(core-flows,medusa,types): fulfillment API: create (#7101)

what:

- adds fulfillment create API

RESOLVES CORE-1962
This commit is contained in:
Riqwan Thamir
2024-04-23 08:35:44 +00:00
committed by GitHub
parent 14a7378375
commit 18f3aacee6
26 changed files with 1037 additions and 14 deletions
@@ -110,4 +110,9 @@ export interface UpdateFulfillmentDTO {
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
/**
* The labels associated with the fulfillment.
*/
labels?: Omit<CreateFulfillmentLabelDTO, "fulfillment_id">[]
}
@@ -0,0 +1,183 @@
/**
* The fulfillment address to be created.
*/
export type CreateFulfillmentAddressWorkflowDTO = {
/**
* The company of the fulfillment address.
*/
company?: string | null
/**
* The first name of the fulfillment address.
*/
first_name?: string | null
/**
* The last name of the fulfillment address.
*/
last_name?: string | null
/**
* The first line of the fulfillment address.
*/
address_1?: string | null
/**
* The second line of the fulfillment address.
*/
address_2?: string | null
/**
* The city of the fulfillment address.
*/
city?: string | null
/**
* The ISO 2 character country code of the fulfillment address.
*/
country_code?: string | null
/**
* The province of the fulfillment address.
*/
province?: string | null
/**
* The postal code of the fulfillment address.
*/
postal_code?: string | null
/**
* The phone of the fulfillment address.
*/
phone?: string | null
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
}
/**
* The fulfillment item to be created.
*/
export type CreateFulfillmentItemWorkflowDTO = {
/**
* The title of the fulfillment item.
*/
title: string
/**
* The SKU of the fulfillment item.
*/
sku: string
/**
* The quantity of the fulfillment item.
*/
quantity: number
/**
* The barcode of the fulfillment item.
*/
barcode: string
/**
* The associated line item's ID.
*/
line_item_id?: string | null
/**
* The associated inventory item's ID.
*/
inventory_item_id?: string | null
}
/**
* The fulfillment label to be created.
*/
export type CreateFulfillmentLabelWorkflowDTO = {
/**
* The tracking number of the fulfillment label.
*/
tracking_number: string
/**
* The tracking URL of the fulfillment label.
*/
tracking_url: string
/**
* The URL of the label.
*/
label_url: string
}
export type CreateFulfillmentOrderWorkflowDTO = Record<string, any>
export type CreateFulfillmentWorkflowInput = {
/**
* The associated location's ID.
*/
location_id: string
/**
* The date the fulfillment was packed.
*/
packed_at?: Date | null
/**
* The date the fulfillment was shipped.
*/
shipped_at?: Date | null
/**
* The date the fulfillment was delivered.
*/
delivered_at?: Date | null
/**
* The date the fulfillment was canceled.
*/
canceled_at?: Date | null
/**
* The data necessary for the associated fulfillment provider to process the fulfillment.
*/
data?: Record<string, unknown> | null
/**
* The associated fulfillment provider's ID.
*/
provider_id: string
/**
* The associated shipping option's ID.
*/
shipping_option_id?: string | null
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
/**
* The address associated with the fulfillment. It's used for delivery.
*/
delivery_address: CreateFulfillmentAddressWorkflowDTO
/**
* The items associated with the fulfillment.
*/
items: CreateFulfillmentItemWorkflowDTO[]
/**
* The labels associated with the fulfillment.
*/
labels: CreateFulfillmentLabelWorkflowDTO[]
/**
* The associated fulfillment order.
*/
order: CreateFulfillmentOrderWorkflowDTO
}
@@ -0,0 +1,16 @@
import { CreateFulfillmentLabelWorkflowDTO } from "./create-fulfillment"
/**
* The attributes to update in the fulfillment.
*/
export interface CreateShipmentWorkflowInput {
/**
* The ID of the fulfillment
*/
id: string
/**
* The labels associated with the fulfillment.
*/
labels?: CreateFulfillmentLabelWorkflowDTO[]
}
@@ -1,5 +1,8 @@
export * from "./create-fulfillment"
export * from "./create-shipment"
export * from "./create-shipping-options"
export * from "./service-zones"
export * from "./delete-shipping-options"
export * from "./service-zones"
export * from "./shipping-profiles"
export * from "./update-fulfillment"
export * from "./update-shipping-options"
@@ -0,0 +1,39 @@
/**
* The attributes to update in the fulfillment.
*/
export interface UpdateFulfillmentWorkflowInput {
/**
* The ID of the fulfillment
*/
id: string
/**
* The associated location's ID.
*/
location_id?: string
/**
* The date the fulfillment was packed.
*/
packed_at?: Date | null
/**
* The date the fulfillment was shipped.
*/
shipped_at?: Date | null
/**
* The date the fulfillment was delivered.
*/
delivered_at?: Date | null
/**
* The data necessary for the associated fulfillment provider to process the fulfillment.
*/
data?: Record<string, unknown> | null
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
}