feat(order): module foundation (#6399)
What: Initial Order module foundation. Basic models and methods to manage entites like in Cart Module
This commit is contained in:
1 parent
811a004c03
commit
339a946f38
77 files changed
+3998
-93
No files matched your search
@@ -10,6 +10,7 @@ export * as FulfillmentTypes from "./fulfillment"
|
||||
export * as InventoryTypes from "./inventory"
|
||||
export * as LoggerTypes from "./logger"
|
||||
export * as ModulesSdkTypes from "./modules-sdk"
|
||||
export * as OrderTypes from "./order"
|
||||
export * as PricingTypes from "./pricing"
|
||||
export * as ProductTypes from "./product"
|
||||
export * as PromotionTypes from "./promotion"
|
||||
@@ -20,4 +21,3 @@ export * as StockLocationTypes from "./stock-location"
|
||||
export * as TransactionBaseTypes from "./transaction-base"
|
||||
export * as UserTypes from "./user"
|
||||
export * as WorkflowTypes from "./workflow"
|
||||
|
||||
@@ -8,13 +8,14 @@ export * from "./customer"
|
||||
export * from "./dal"
|
||||
export * from "./event-bus"
|
||||
export * from "./feature-flag"
|
||||
export * from "./fulfillment"
|
||||
export * from "./file-service"
|
||||
export * from "./fulfillment"
|
||||
export * from "./inventory"
|
||||
export * from "./joiner"
|
||||
export * from "./link-modules"
|
||||
export * from "./logger"
|
||||
export * from "./modules-sdk"
|
||||
export * from "./order"
|
||||
export * from "./payment"
|
||||
export * from "./pricing"
|
||||
export * from "./product"
|
||||
@@ -30,4 +31,3 @@ export * from "./totals"
|
||||
export * from "./transaction-base"
|
||||
export * from "./user"
|
||||
export * from "./workflow"
|
||||
|
||||
@@ -0,0 +1,570 @@
|
||||
import { BaseFilterable } from "../dal"
|
||||
import { OperatorMap } from "../dal/utils"
|
||||
|
||||
export interface OrderAdjustmentLineDTO {
|
||||
/**
|
||||
* The ID of the adjustment line
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The code of the adjustment line
|
||||
*/
|
||||
code?: string
|
||||
/**
|
||||
* The amount of the adjustment line
|
||||
*/
|
||||
amount: number
|
||||
/**
|
||||
* The ID of the associated order
|
||||
*/
|
||||
order_id: string
|
||||
/**
|
||||
* The description of the adjustment line
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* The ID of the associated promotion
|
||||
*/
|
||||
promotion_id?: string
|
||||
/**
|
||||
* The ID of the associated provider
|
||||
*/
|
||||
provider_id?: string
|
||||
/**
|
||||
* When the adjustment line was created
|
||||
*/
|
||||
created_at: Date | string
|
||||
/**
|
||||
* When the adjustment line was updated
|
||||
*/
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
export interface OrderShippingMethodAdjustmentDTO
|
||||
extends OrderAdjustmentLineDTO {
|
||||
/**
|
||||
* The associated shipping method
|
||||
*/
|
||||
shipping_method: OrderShippingMethodDTO
|
||||
/**
|
||||
* The ID of the associated shipping method
|
||||
*/
|
||||
shipping_method_id: string
|
||||
}
|
||||
|
||||
export interface OrderLineItemAdjustmentDTO extends OrderAdjustmentLineDTO {
|
||||
/**
|
||||
* The associated line item
|
||||
* @expandable
|
||||
*/
|
||||
item: OrderLineItemDTO
|
||||
/**
|
||||
* The associated line item
|
||||
*/
|
||||
item_id: string
|
||||
}
|
||||
|
||||
export interface OrderTaxLineDTO {
|
||||
/**
|
||||
* The ID of the tax line
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The description of the tax line
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* The ID of the associated tax rate
|
||||
*/
|
||||
tax_rate_id?: string
|
||||
/**
|
||||
* The code of the tax line
|
||||
*/
|
||||
code: string
|
||||
/**
|
||||
* The rate of the tax line
|
||||
*/
|
||||
rate: number
|
||||
/**
|
||||
* The ID of the associated provider
|
||||
*/
|
||||
provider_id?: string
|
||||
/**
|
||||
* When the tax line was created
|
||||
*/
|
||||
created_at: Date | string
|
||||
/**
|
||||
* When the tax line was updated
|
||||
*/
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
export interface OrderShippingMethodTaxLineDTO extends OrderTaxLineDTO {
|
||||
/**
|
||||
* The associated shipping method
|
||||
*/
|
||||
shipping_method: OrderShippingMethodDTO
|
||||
/**
|
||||
* The ID of the associated shipping method
|
||||
*/
|
||||
shipping_method_id: string
|
||||
}
|
||||
|
||||
export interface OrderLineItemTaxLineDTO extends OrderTaxLineDTO {
|
||||
/**
|
||||
* The associated line item
|
||||
*/
|
||||
item: OrderLineItemDTO
|
||||
/**
|
||||
* The ID of the associated line item
|
||||
*/
|
||||
item_id: string
|
||||
}
|
||||
|
||||
export interface OrderAddressDTO {
|
||||
/**
|
||||
* The ID of the address
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The customer ID of the address
|
||||
*/
|
||||
customer_id?: string
|
||||
/**
|
||||
* The first name of the address
|
||||
*/
|
||||
first_name?: string
|
||||
/**
|
||||
* The last name of the address
|
||||
*/
|
||||
last_name?: string
|
||||
/**
|
||||
* The phone number of the address
|
||||
*/
|
||||
phone?: string
|
||||
/**
|
||||
* The company of the address
|
||||
*/
|
||||
company?: string
|
||||
/**
|
||||
* The first address line of the address
|
||||
*/
|
||||
address_1?: string
|
||||
/**
|
||||
* The second address line of the address
|
||||
*/
|
||||
address_2?: string
|
||||
/**
|
||||
* The city of the address
|
||||
*/
|
||||
city?: string
|
||||
/**
|
||||
* The country code of the address
|
||||
*/
|
||||
country_code?: string
|
||||
/**
|
||||
* The province/state of the address
|
||||
*/
|
||||
province?: string
|
||||
/**
|
||||
* The postal code of the address
|
||||
*/
|
||||
postal_code?: string
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
/**
|
||||
* When the address was created.
|
||||
*/
|
||||
created_at: Date | string
|
||||
/**
|
||||
* When the address was updated.
|
||||
*/
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
export interface OrderShippingMethodDTO {
|
||||
/**
|
||||
* The ID of the shipping method
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The ID of the associated order
|
||||
*/
|
||||
order_id: string
|
||||
|
||||
/**
|
||||
* The name of the shipping method
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* The description of the shipping method
|
||||
*/
|
||||
description?: string
|
||||
|
||||
/**
|
||||
* The price of the shipping method
|
||||
*/
|
||||
unit_price: number
|
||||
|
||||
/**
|
||||
* Whether the shipping method price is tax inclusive or not
|
||||
*/
|
||||
is_tax_inclusive: boolean
|
||||
|
||||
/**
|
||||
* The ID of the shipping option the method was created from
|
||||
*/
|
||||
shipping_option_id?: string
|
||||
|
||||
/**
|
||||
* Additional data needed for fulfillment.
|
||||
*/
|
||||
data?: Record<string, unknown>
|
||||
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
|
||||
/**
|
||||
* The associated tax lines.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
tax_lines?: OrderShippingMethodTaxLineDTO[]
|
||||
/**
|
||||
* The associated adjustments.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
adjustments?: OrderShippingMethodAdjustmentDTO[]
|
||||
|
||||
/**
|
||||
* When the shipping method was created.
|
||||
*/
|
||||
created_at: Date | string
|
||||
/**
|
||||
* When the shipping method was updated.
|
||||
*/
|
||||
updated_at: Date | string
|
||||
|
||||
original_total: number
|
||||
original_subtotal: number
|
||||
original_tax_total: number
|
||||
|
||||
total: number
|
||||
subtotal: number
|
||||
tax_total: number
|
||||
discount_total: number
|
||||
discount_tax_total: number
|
||||
}
|
||||
|
||||
export interface OrderLineItemTotalsDTO {
|
||||
original_total: number
|
||||
original_subtotal: number
|
||||
original_tax_total: number
|
||||
|
||||
item_total: number
|
||||
item_subtotal: number
|
||||
item_tax_total: number
|
||||
|
||||
total: number
|
||||
subtotal: number
|
||||
tax_total: number
|
||||
discount_total: number
|
||||
discount_tax_total: number
|
||||
}
|
||||
|
||||
export interface OrderLineItemDTO extends OrderLineItemTotalsDTO {
|
||||
/**
|
||||
* The ID of the line item.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The title of the line item.
|
||||
*/
|
||||
title: string
|
||||
/**
|
||||
* The subtitle of the line item.
|
||||
*/
|
||||
subtitle?: string
|
||||
/**
|
||||
* The url of the line item thumbnail.
|
||||
*/
|
||||
thumbnail?: string
|
||||
/**
|
||||
* The line item quantity
|
||||
*/
|
||||
quantity: number
|
||||
/**
|
||||
* The product ID of the line item.
|
||||
*/
|
||||
product_id?: string
|
||||
/**
|
||||
* The product title of the line item.
|
||||
*/
|
||||
product_title?: string
|
||||
/**
|
||||
* The product description of the line item.
|
||||
*/
|
||||
product_description?: string
|
||||
/**
|
||||
* The product subtitle of the line item.
|
||||
*/
|
||||
product_subtitle?: string
|
||||
/**
|
||||
* The product type of the line item.
|
||||
*/
|
||||
product_type?: string
|
||||
/**
|
||||
* The product collection of the line item.
|
||||
*/
|
||||
product_collection?: string
|
||||
/**
|
||||
* The product handle of the line item.
|
||||
*/
|
||||
product_handle?: string
|
||||
/**
|
||||
* The variant ID of the line item.
|
||||
*/
|
||||
variant_id?: string
|
||||
/**
|
||||
* The variant sku of the line item.
|
||||
*/
|
||||
variant_sku?: string
|
||||
/**
|
||||
* The variant barcode of the line item.
|
||||
*/
|
||||
variant_barcode?: string
|
||||
/**
|
||||
* The variant title of the line item.
|
||||
*/
|
||||
variant_title?: string
|
||||
/**
|
||||
* The variant option values of the line item.
|
||||
*/
|
||||
variant_option_values?: Record<string, unknown>
|
||||
/**
|
||||
* Whether the line item requires shipping or not
|
||||
*/
|
||||
requires_shipping: boolean
|
||||
/**
|
||||
* Whether the line item is discountable or not
|
||||
*/
|
||||
is_discountable: boolean
|
||||
/**
|
||||
* Whether the line item price is tax inclusive or not
|
||||
*/
|
||||
is_tax_inclusive: boolean
|
||||
/**
|
||||
* The original price of the item before an adjustment or a sale.
|
||||
*/
|
||||
compare_at_unit_price?: number
|
||||
/**
|
||||
* The price of the item
|
||||
*/
|
||||
unit_price: number
|
||||
/**
|
||||
* The associated tax lines.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
tax_lines?: OrderLineItemTaxLineDTO[]
|
||||
/**
|
||||
* The associated adjustments.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
adjustments?: OrderLineItemAdjustmentDTO[]
|
||||
/**
|
||||
* The associated order.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
order: OrderDTO
|
||||
/**
|
||||
* The ID of the associated order.
|
||||
*/
|
||||
order_id: string
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
/**
|
||||
* When the line item was created.
|
||||
*/
|
||||
created_at?: Date
|
||||
/**
|
||||
* When the line item was updated.
|
||||
*/
|
||||
updated_at?: Date
|
||||
}
|
||||
|
||||
export interface OrderDTO {
|
||||
/**
|
||||
* The ID of the order.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The ID of the region the order belongs to.
|
||||
*/
|
||||
region_id?: string
|
||||
/**
|
||||
* The ID of the customer on the order.
|
||||
*/
|
||||
customer_id?: string
|
||||
/**
|
||||
* The ID of the sales channel the order belongs to.
|
||||
*/
|
||||
sales_channel_id?: string
|
||||
/**
|
||||
* The email of the order.
|
||||
*/
|
||||
email?: string
|
||||
/**
|
||||
* The currency of the order
|
||||
*/
|
||||
currency_code: string
|
||||
/**
|
||||
* The associated shipping address.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
shipping_address?: OrderAddressDTO
|
||||
/**
|
||||
* The associated billing address.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
billing_address?: OrderAddressDTO
|
||||
/**
|
||||
* The associated line items.
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
items?: OrderLineItemDTO[]
|
||||
/**
|
||||
* The associated shipping methods
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
shipping_methods?: OrderShippingMethodDTO[]
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
/**
|
||||
* When the order was created.
|
||||
*/
|
||||
created_at?: string | Date
|
||||
/**
|
||||
* When the order was updated.
|
||||
*/
|
||||
updated_at?: string | Date
|
||||
|
||||
original_item_total: number
|
||||
original_item_subtotal: number
|
||||
original_item_tax_total: number
|
||||
|
||||
item_total: number
|
||||
item_subtotal: number
|
||||
item_tax_total: number
|
||||
|
||||
original_total: number
|
||||
original_subtotal: number
|
||||
original_tax_total: number
|
||||
|
||||
total: number
|
||||
subtotal: number
|
||||
tax_total: number
|
||||
discount_total: number
|
||||
raw_discount_total: any
|
||||
discount_tax_total: number
|
||||
|
||||
gift_card_total: number
|
||||
gift_card_tax_total: number
|
||||
|
||||
shipping_total: number
|
||||
shipping_subtotal: number
|
||||
shipping_tax_total: number
|
||||
|
||||
original_shipping_total: number
|
||||
original_shipping_subtotal: number
|
||||
original_shipping_tax_total: number
|
||||
}
|
||||
|
||||
export interface FilterableOrderProps
|
||||
extends BaseFilterable<FilterableOrderProps> {
|
||||
id?: string | string[]
|
||||
|
||||
sales_channel_id?: string | string[] | OperatorMap<string>
|
||||
customer_id?: string | string[] | OperatorMap<string>
|
||||
region_id?: string | string[] | OperatorMap<string>
|
||||
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface FilterableOrderAddressProps
|
||||
extends BaseFilterable<FilterableOrderAddressProps> {
|
||||
id?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableOrderLineItemProps
|
||||
extends BaseFilterable<FilterableOrderLineItemProps> {
|
||||
id?: string | string[]
|
||||
order_id?: string | string[]
|
||||
title?: string
|
||||
variant_id?: string | string[]
|
||||
product_id?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableOrderLineItemAdjustmentProps
|
||||
extends BaseFilterable<FilterableOrderLineItemAdjustmentProps> {
|
||||
id?: string | string[]
|
||||
item_id?: string | string[]
|
||||
promotion_id?: string | string[]
|
||||
provider_id?: string | string[]
|
||||
item?: FilterableOrderLineItemProps
|
||||
}
|
||||
export interface FilterableOrderShippingMethodProps
|
||||
extends BaseFilterable<FilterableOrderShippingMethodProps> {
|
||||
id?: string | string[]
|
||||
order_id?: string | string[]
|
||||
name?: string
|
||||
shipping_option_id?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableOrderShippingMethodAdjustmentProps
|
||||
extends BaseFilterable<FilterableOrderShippingMethodAdjustmentProps> {
|
||||
id?: string | string[]
|
||||
shipping_method_id?: string | string[]
|
||||
promotion_id?: string | string[]
|
||||
provider_id?: string | string[]
|
||||
shipping_method?: FilterableOrderShippingMethodProps
|
||||
}
|
||||
|
||||
export interface FilterableOrderLineItemTaxLineProps
|
||||
extends BaseFilterable<FilterableOrderLineItemTaxLineProps> {
|
||||
id?: string | string[]
|
||||
description?: string
|
||||
code?: string | string[]
|
||||
tax_rate_id?: string | string[]
|
||||
provider_id?: string | string[]
|
||||
item_id?: string | string[]
|
||||
item?: FilterableOrderLineItemProps
|
||||
}
|
||||
|
||||
export interface FilterableOrderShippingMethodTaxLineProps
|
||||
extends BaseFilterable<FilterableOrderShippingMethodTaxLineProps> {
|
||||
id?: string | string[]
|
||||
description?: string
|
||||
code?: string | string[]
|
||||
tax_rate_id?: string | string[]
|
||||
provider_id?: string | string[]
|
||||
shipping_method_id?: string | string[]
|
||||
shipping_method?: FilterableOrderShippingMethodProps
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./common"
|
||||
export * from "./mutations"
|
||||
export * from "./service"
|
||||
@@ -0,0 +1,241 @@
|
||||
import { OrderLineItemDTO } from "./common"
|
||||
|
||||
/** ADDRESS START */
|
||||
export interface UpsertOrderAddressDTO {
|
||||
customer_id?: string
|
||||
company?: string
|
||||
first_name?: string
|
||||
last_name?: string
|
||||
address_1?: string
|
||||
address_2?: string
|
||||
city?: string
|
||||
country_code?: string
|
||||
province?: string
|
||||
postal_code?: string
|
||||
phone?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdateOrderAddressDTO extends UpsertOrderAddressDTO {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface CreateOrderAddressDTO extends UpsertOrderAddressDTO {}
|
||||
|
||||
/** ADDRESS END */
|
||||
|
||||
/** ORDER START */
|
||||
export interface CreateOrderDTO {
|
||||
region_id?: string
|
||||
customer_id?: string
|
||||
sales_channel_id?: string
|
||||
status?: string
|
||||
email?: string
|
||||
currency_code: string
|
||||
shipping_address_id?: string
|
||||
billing_address_id?: string
|
||||
shipping_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
|
||||
billing_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
|
||||
items?: CreateOrderLineItemDTO[]
|
||||
}
|
||||
|
||||
export interface UpdateOrderDTO {
|
||||
id: string
|
||||
region_id?: string
|
||||
customer_id?: string
|
||||
sales_channel_id?: string
|
||||
status?: string
|
||||
email?: string
|
||||
currency_code?: string
|
||||
shipping_address_id?: string
|
||||
billing_address_id?: string
|
||||
billing_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
|
||||
shipping_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
/** ORDER END */
|
||||
|
||||
/** ADJUSTMENT START */
|
||||
export interface CreateOrderAdjustmentDTO {
|
||||
code: string
|
||||
amount: number
|
||||
description?: string
|
||||
promotion_id?: string
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderAdjustmentDTO {
|
||||
id: string
|
||||
code?: string
|
||||
amount: number
|
||||
description?: string
|
||||
promotion_id?: string
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface CreateOrderLineItemAdjustmentDTO
|
||||
extends CreateOrderAdjustmentDTO {
|
||||
item_id: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderLineItemAdjustmentDTO
|
||||
extends UpdateOrderAdjustmentDTO {
|
||||
item_id: string
|
||||
}
|
||||
|
||||
export interface UpsertOrderLineItemAdjustmentDTO {
|
||||
id?: string
|
||||
item_id: string
|
||||
code?: string
|
||||
amount?: number
|
||||
description?: string
|
||||
promotion_id?: string
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
/** ADJUSTMENTS END */
|
||||
|
||||
/** TAX LINES START */
|
||||
|
||||
export interface CreateOrderTaxLineDTO {
|
||||
description?: string
|
||||
tax_rate_id?: string
|
||||
code: string
|
||||
rate: number
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderTaxLineDTO {
|
||||
id: string
|
||||
description?: string
|
||||
tax_rate_id?: string
|
||||
code?: string
|
||||
rate?: number
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface CreateOrderShippingMethodTaxLineDTO
|
||||
extends CreateOrderTaxLineDTO {}
|
||||
|
||||
export interface UpdateOrderShippingMethodTaxLineDTO
|
||||
extends UpdateOrderTaxLineDTO {}
|
||||
|
||||
export interface CreateOrderLineItemTaxLineDTO extends CreateOrderTaxLineDTO {}
|
||||
|
||||
export interface UpdateOrderLineItemTaxLineDTO extends UpdateOrderTaxLineDTO {}
|
||||
|
||||
/** TAX LINES END */
|
||||
|
||||
/** LINE ITEMS START */
|
||||
export interface CreateOrderLineItemDTO {
|
||||
title: string
|
||||
subtitle?: string
|
||||
thumbnail?: string
|
||||
|
||||
order_id?: string
|
||||
|
||||
quantity: number
|
||||
|
||||
product_id?: string
|
||||
product_title?: string
|
||||
product_description?: string
|
||||
product_subtitle?: string
|
||||
product_type?: string
|
||||
product_collection?: string
|
||||
product_handle?: string
|
||||
|
||||
variant_id?: string
|
||||
variant_sku?: string
|
||||
variant_barcode?: string
|
||||
variant_title?: string
|
||||
variant_option_values?: Record<string, unknown>
|
||||
|
||||
requires_shipping?: boolean
|
||||
is_discountable?: boolean
|
||||
is_tax_inclusive?: boolean
|
||||
|
||||
compare_at_unit_price?: number
|
||||
unit_price: number | string
|
||||
|
||||
tax_lines?: CreateOrderTaxLineDTO[]
|
||||
adjustments?: CreateOrderAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface CreateOrderLineItemForOrderDTO extends CreateOrderLineItemDTO {
|
||||
order_id: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderLineItemWithSelectorDTO {
|
||||
selector: Partial<OrderLineItemDTO>
|
||||
data: Partial<UpdateOrderLineItemDTO>
|
||||
}
|
||||
|
||||
export interface UpdateOrderLineItemDTO
|
||||
extends Omit<
|
||||
CreateOrderLineItemDTO,
|
||||
"tax_lines" | "adjustments" | "title" | "quantity" | "unit_price"
|
||||
> {
|
||||
id: string
|
||||
|
||||
title?: string
|
||||
quantity?: number
|
||||
unit_price?: number
|
||||
|
||||
tax_lines?: UpdateOrderTaxLineDTO[] | CreateOrderTaxLineDTO[]
|
||||
adjustments?: UpdateOrderAdjustmentDTO[] | CreateOrderAdjustmentDTO[]
|
||||
}
|
||||
|
||||
/** LINE ITEMS END */
|
||||
|
||||
/** SHIPPING METHODS START */
|
||||
|
||||
export interface CreateOrderShippingMethodDTO {
|
||||
name: string
|
||||
order_id: string
|
||||
amount: number
|
||||
data?: Record<string, unknown>
|
||||
tax_lines?: CreateOrderTaxLineDTO[]
|
||||
adjustments?: CreateOrderAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface CreateOrderShippingMethodForSingleOrderDTO {
|
||||
name: string
|
||||
amount: number
|
||||
data?: Record<string, unknown>
|
||||
tax_lines?: CreateOrderTaxLineDTO[]
|
||||
adjustments?: CreateOrderAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface UpdateOrderShippingMethodDTO {
|
||||
id: string
|
||||
name?: string
|
||||
amount?: number
|
||||
data?: Record<string, unknown>
|
||||
tax_lines?: UpdateOrderTaxLineDTO[] | CreateOrderTaxLineDTO[]
|
||||
adjustments?: CreateOrderAdjustmentDTO[] | UpdateOrderAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface CreateOrderShippingMethodAdjustmentDTO {
|
||||
shipping_method_id: string
|
||||
code: string
|
||||
amount: number
|
||||
description?: string
|
||||
promotion_id?: string
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderShippingMethodAdjustmentDTO {
|
||||
id: string
|
||||
code?: string
|
||||
amount?: number
|
||||
description?: string
|
||||
promotion_id?: string
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
/** SHIPPING METHODS END */
|
||||
@@ -0,0 +1,328 @@
|
||||
import { FindConfig } from "../common"
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import {
|
||||
FilterableOrderAddressProps,
|
||||
FilterableOrderLineItemAdjustmentProps,
|
||||
FilterableOrderLineItemProps,
|
||||
FilterableOrderLineItemTaxLineProps,
|
||||
FilterableOrderProps,
|
||||
FilterableOrderShippingMethodAdjustmentProps,
|
||||
FilterableOrderShippingMethodProps,
|
||||
FilterableOrderShippingMethodTaxLineProps,
|
||||
OrderAddressDTO,
|
||||
OrderDTO,
|
||||
OrderLineItemAdjustmentDTO,
|
||||
OrderLineItemDTO,
|
||||
OrderLineItemTaxLineDTO,
|
||||
OrderShippingMethodAdjustmentDTO,
|
||||
OrderShippingMethodDTO,
|
||||
OrderShippingMethodTaxLineDTO,
|
||||
} from "./common"
|
||||
import {
|
||||
CreateOrderAddressDTO,
|
||||
CreateOrderAdjustmentDTO,
|
||||
CreateOrderDTO,
|
||||
CreateOrderLineItemDTO,
|
||||
CreateOrderLineItemForOrderDTO,
|
||||
CreateOrderLineItemTaxLineDTO,
|
||||
CreateOrderShippingMethodAdjustmentDTO,
|
||||
CreateOrderShippingMethodDTO,
|
||||
CreateOrderShippingMethodForSingleOrderDTO,
|
||||
CreateOrderShippingMethodTaxLineDTO,
|
||||
UpdateOrderAddressDTO,
|
||||
UpdateOrderDTO,
|
||||
UpdateOrderLineItemDTO,
|
||||
UpdateOrderLineItemTaxLineDTO,
|
||||
UpdateOrderLineItemWithSelectorDTO,
|
||||
UpdateOrderShippingMethodAdjustmentDTO,
|
||||
UpdateOrderShippingMethodTaxLineDTO,
|
||||
UpsertOrderLineItemAdjustmentDTO,
|
||||
} from "./mutations"
|
||||
|
||||
export interface IOrderModuleService extends IModuleService {
|
||||
retrieve(
|
||||
orderId: string,
|
||||
config?: FindConfig<OrderDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderDTO>
|
||||
|
||||
list(
|
||||
filters?: FilterableOrderProps,
|
||||
config?: FindConfig<OrderDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderDTO[]>
|
||||
|
||||
listAndCount(
|
||||
filters?: FilterableOrderProps,
|
||||
config?: FindConfig<OrderDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<[OrderDTO[], number]>
|
||||
|
||||
create(data: CreateOrderDTO[], sharedContext?: Context): Promise<OrderDTO[]>
|
||||
create(data: CreateOrderDTO, sharedContext?: Context): Promise<OrderDTO>
|
||||
|
||||
update(data: UpdateOrderDTO[], sharedContext?: Context): Promise<OrderDTO[]>
|
||||
update(data: UpdateOrderDTO, sharedContext?: Context): Promise<OrderDTO>
|
||||
|
||||
delete(orderIds: string[], sharedContext?: Context): Promise<void>
|
||||
delete(orderId: string, sharedContext?: Context): Promise<void>
|
||||
|
||||
listAddresses(
|
||||
filters?: FilterableOrderAddressProps,
|
||||
config?: FindConfig<OrderAddressDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderAddressDTO[]>
|
||||
|
||||
createAddresses(
|
||||
data: CreateOrderAddressDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderAddressDTO[]>
|
||||
createAddresses(
|
||||
data: CreateOrderAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderAddressDTO>
|
||||
|
||||
updateAddresses(
|
||||
data: UpdateOrderAddressDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderAddressDTO[]>
|
||||
updateAddresses(
|
||||
data: UpdateOrderAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderAddressDTO>
|
||||
|
||||
deleteAddresses(ids: string[], sharedContext?: Context): Promise<void>
|
||||
deleteAddresses(ids: string, sharedContext?: Context): Promise<void>
|
||||
|
||||
retrieveLineItem(
|
||||
itemId: string,
|
||||
config?: FindConfig<OrderLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemDTO>
|
||||
|
||||
listLineItems(
|
||||
filters: FilterableOrderLineItemProps,
|
||||
config?: FindConfig<OrderLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
|
||||
addLineItems(
|
||||
data: CreateOrderLineItemForOrderDTO
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
addLineItems(
|
||||
data: CreateOrderLineItemForOrderDTO[]
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
addLineItems(
|
||||
orderId: string,
|
||||
items: CreateOrderLineItemDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
|
||||
updateLineItems(
|
||||
data: UpdateOrderLineItemWithSelectorDTO[]
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
updateLineItems(
|
||||
selector: Partial<OrderLineItemDTO>,
|
||||
data: Partial<UpdateOrderLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemDTO[]>
|
||||
updateLineItems(
|
||||
lineId: string,
|
||||
data: Partial<UpdateOrderLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemDTO>
|
||||
|
||||
removeLineItems(itemIds: string[], sharedContext?: Context): Promise<void>
|
||||
removeLineItems(itemIds: string, sharedContext?: Context): Promise<void>
|
||||
removeLineItems(
|
||||
selector: Partial<OrderLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listShippingMethods(
|
||||
filters: FilterableOrderShippingMethodProps,
|
||||
config: FindConfig<OrderShippingMethodDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodDTO[]>
|
||||
|
||||
addShippingMethods(
|
||||
data: CreateOrderShippingMethodDTO
|
||||
): Promise<OrderShippingMethodDTO>
|
||||
addShippingMethods(
|
||||
data: CreateOrderShippingMethodDTO[]
|
||||
): Promise<OrderShippingMethodDTO[]>
|
||||
addShippingMethods(
|
||||
orderId: string,
|
||||
methods: CreateOrderShippingMethodForSingleOrderDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodDTO[]>
|
||||
|
||||
removeShippingMethods(
|
||||
methodIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethods(
|
||||
methodIds: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethods(
|
||||
selector: Partial<OrderShippingMethodDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listLineItemAdjustments(
|
||||
filters: FilterableOrderLineItemAdjustmentProps,
|
||||
config?: FindConfig<OrderLineItemAdjustmentDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemAdjustmentDTO[]>
|
||||
|
||||
addLineItemAdjustments(
|
||||
data: CreateOrderAdjustmentDTO[]
|
||||
): Promise<OrderLineItemAdjustmentDTO[]>
|
||||
addLineItemAdjustments(
|
||||
data: CreateOrderAdjustmentDTO
|
||||
): Promise<OrderLineItemAdjustmentDTO[]>
|
||||
addLineItemAdjustments(
|
||||
orderId: string,
|
||||
data: CreateOrderAdjustmentDTO[]
|
||||
): Promise<OrderLineItemAdjustmentDTO[]>
|
||||
|
||||
setLineItemAdjustments(
|
||||
orderId: string,
|
||||
data: UpsertOrderLineItemAdjustmentDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemAdjustmentDTO[]>
|
||||
|
||||
removeLineItemAdjustments(
|
||||
adjustmentIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeLineItemAdjustments(
|
||||
adjustmentIds: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeLineItemAdjustments(
|
||||
selector: Partial<OrderLineItemAdjustmentDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listShippingMethodAdjustments(
|
||||
filters: FilterableOrderShippingMethodAdjustmentProps,
|
||||
config?: FindConfig<OrderShippingMethodAdjustmentDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodAdjustmentDTO[]>
|
||||
|
||||
addShippingMethodAdjustments(
|
||||
data: CreateOrderShippingMethodAdjustmentDTO[]
|
||||
): Promise<OrderShippingMethodAdjustmentDTO[]>
|
||||
addShippingMethodAdjustments(
|
||||
data: CreateOrderShippingMethodAdjustmentDTO
|
||||
): Promise<OrderShippingMethodAdjustmentDTO>
|
||||
addShippingMethodAdjustments(
|
||||
orderId: string,
|
||||
data: CreateOrderShippingMethodAdjustmentDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodAdjustmentDTO[]>
|
||||
|
||||
setShippingMethodAdjustments(
|
||||
orderId: string,
|
||||
data: (
|
||||
| CreateOrderShippingMethodAdjustmentDTO
|
||||
| UpdateOrderShippingMethodAdjustmentDTO
|
||||
)[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodAdjustmentDTO[]>
|
||||
|
||||
removeShippingMethodAdjustments(
|
||||
adjustmentIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethodAdjustments(
|
||||
adjustmentId: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethodAdjustments(
|
||||
selector: Partial<OrderShippingMethodAdjustmentDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listLineItemTaxLines(
|
||||
filters: FilterableOrderLineItemTaxLineProps,
|
||||
config?: FindConfig<OrderLineItemTaxLineDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemTaxLineDTO[]>
|
||||
|
||||
addLineItemTaxLines(
|
||||
taxLines: CreateOrderLineItemTaxLineDTO[]
|
||||
): Promise<OrderLineItemTaxLineDTO[]>
|
||||
addLineItemTaxLines(
|
||||
taxLine: CreateOrderLineItemTaxLineDTO
|
||||
): Promise<OrderLineItemTaxLineDTO>
|
||||
addLineItemTaxLines(
|
||||
orderId: string,
|
||||
taxLines: CreateOrderLineItemTaxLineDTO[] | CreateOrderLineItemTaxLineDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemTaxLineDTO[]>
|
||||
|
||||
setLineItemTaxLines(
|
||||
orderId: string,
|
||||
taxLines: (CreateOrderLineItemTaxLineDTO | UpdateOrderLineItemTaxLineDTO)[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderLineItemTaxLineDTO[]>
|
||||
|
||||
removeLineItemTaxLines(
|
||||
taxLineIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeLineItemTaxLines(
|
||||
taxLineIds: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeLineItemTaxLines(
|
||||
selector: FilterableOrderLineItemTaxLineProps,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listShippingMethodTaxLines(
|
||||
filters: FilterableOrderShippingMethodTaxLineProps,
|
||||
config?: FindConfig<OrderShippingMethodTaxLineDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodTaxLineDTO[]>
|
||||
|
||||
addShippingMethodTaxLines(
|
||||
taxLines: CreateOrderShippingMethodTaxLineDTO[]
|
||||
): Promise<OrderShippingMethodTaxLineDTO[]>
|
||||
addShippingMethodTaxLines(
|
||||
taxLine: CreateOrderShippingMethodTaxLineDTO
|
||||
): Promise<OrderShippingMethodTaxLineDTO>
|
||||
addShippingMethodTaxLines(
|
||||
orderId: string,
|
||||
taxLines:
|
||||
| CreateOrderShippingMethodTaxLineDTO[]
|
||||
| CreateOrderShippingMethodTaxLineDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodTaxLineDTO[]>
|
||||
|
||||
setShippingMethodTaxLines(
|
||||
orderId: string,
|
||||
taxLines: (
|
||||
| CreateOrderShippingMethodTaxLineDTO
|
||||
| UpdateOrderShippingMethodTaxLineDTO
|
||||
)[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderShippingMethodTaxLineDTO[]>
|
||||
|
||||
removeShippingMethodTaxLines(
|
||||
taxLineIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethodTaxLines(
|
||||
taxLineIds: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethodTaxLines(
|
||||
selector: FilterableOrderShippingMethodTaxLineProps,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
}
|
||||
@@ -5,8 +5,4 @@ export type BigNumberRawValue = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type BigNumberRawPriceInput =
|
||||
| BigNumberRawValue
|
||||
| number
|
||||
| string
|
||||
| BigNumber
|
||||
export type BigNumberInput = BigNumberRawValue | number | string | BigNumber
|
||||
Reference in new issue
Block a user