feat(medusa,workflows) Create cart workflow (#4685)
* chore: add baseline test for create cart * chore: add basic paths into handlers + make first tests pass * chore: move input alias to cart specific workflow * chore: move data around into buckets * chore: normalize handlers and introduce types * chore: move aliases to handlers concern * chore: add compensation step for create cart * chore: merge with latest develop * chore: handle error manually + type inputs * chore: handle error manually * chore: added types for each handler * chore: remove addresses * chore: added changset * chore: undo package changes * chore: added config settings to retreieve, cleanup of types * chore: capitalize cart handlers * chore: rename todo * chore: add feature flag for workflow * chore: reorder handlers * chore: add logger to route handler * chore: removed weird vscode moving around things * chore: refactor handlers * chore: refactor compensate step * chore: changed poistion * chore: aggregate config data * chore: moved handlers to their own domain + pr review addressing * chore: address pr reviews * chore: move types to type package * chore: update type to include config * chore: remove error scoping
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export type AddressDTO = {
|
||||
id?: string
|
||||
address_1: string
|
||||
address_2?: string | null
|
||||
company?: string | null
|
||||
country_code: string
|
||||
city?: string | null
|
||||
phone?: string | null
|
||||
postal_code?: string | null
|
||||
province?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
created_at?: string | Date
|
||||
updated_at?: string | Date
|
||||
deleted_at?: string | Date | null
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./common"
|
||||
@@ -0,0 +1,27 @@
|
||||
export type CartDTO = {
|
||||
id?: string
|
||||
email?: string
|
||||
billing_address_id?: string
|
||||
shipping_address_id?: string
|
||||
region_id?: string
|
||||
customer_id?: string
|
||||
payment_id?: string
|
||||
completed_at?: Date
|
||||
payment_authorized_at?: Date
|
||||
idempotency_key?: string
|
||||
context?: Record<string, unknown>
|
||||
metadata?: Record<string, unknown>
|
||||
sales_channel_id?: string | null
|
||||
shipping_total?: number
|
||||
discount_total?: number
|
||||
raw_discount_total?: number
|
||||
item_tax_total?: number | null
|
||||
shipping_tax_total?: number | null
|
||||
tax_total?: number | null
|
||||
refunded_total?: number
|
||||
total?: number
|
||||
subtotal?: number
|
||||
refundable_amount?: number
|
||||
gift_card_total?: number
|
||||
gift_card_tax_total?: number
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./common"
|
||||
@@ -1,18 +1,20 @@
|
||||
export * from "./address"
|
||||
export * from "./bundles"
|
||||
export * from "./cache"
|
||||
export * from "./cart"
|
||||
export * from "./common"
|
||||
export * from "./dal"
|
||||
export * from "./event-bus"
|
||||
export * from "./feature-flag"
|
||||
export * from "./inventory"
|
||||
export * from "./joiner"
|
||||
export * from "./logger"
|
||||
export * from "./modules-sdk"
|
||||
export * from "./product"
|
||||
export * from "./product-category"
|
||||
export * from "./sales-channel"
|
||||
export * from "./search"
|
||||
export * from "./shared-context"
|
||||
export * from "./stock-location"
|
||||
export * from "./transaction-base"
|
||||
export * from "./dal"
|
||||
export * from "./logger"
|
||||
export * from "./feature-flag"
|
||||
export * from "./sales-channel"
|
||||
export * from "./workflow"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AddressDTO } from "../../address"
|
||||
import { WorkflowInputConfig } from "../common"
|
||||
|
||||
export interface CreateLineItemInputDTO {
|
||||
variant_id: string
|
||||
quantity: number
|
||||
}
|
||||
|
||||
export interface CreateCartWorkflowInputDTO {
|
||||
config?: WorkflowInputConfig
|
||||
region_id?: string
|
||||
country_code?: string
|
||||
items?: CreateLineItemInputDTO[]
|
||||
context?: object
|
||||
sales_channel_id?: string
|
||||
shipping_address_id?: string
|
||||
billing_address_id?: string
|
||||
billing_address?: AddressDTO
|
||||
shipping_address?: AddressDTO
|
||||
customer_id?: string
|
||||
email?: string
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./create-cart"
|
||||
@@ -1,2 +1,3 @@
|
||||
export * as ProductWorkflow from "./product"
|
||||
export * as CartWorkflow from "./cart"
|
||||
export * as CommonWorkflow from "./common"
|
||||
export * as ProductWorkflow from "./product"
|
||||
|
||||
@@ -88,10 +88,6 @@ export interface CreateProductInputDTO {
|
||||
metadata?: Record<string, unknown>
|
||||
|
||||
sales_channels?: CreateProductSalesChannelInputDTO[]
|
||||
listConfig: {
|
||||
select: string[]
|
||||
relations: string[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface CreateProductsWorkflowInputDTO {
|
||||
|
||||
Reference in New Issue
Block a user