feat(cart): Shipping methods (#6101)
This commit is contained in:
@@ -168,6 +168,11 @@ export interface CartShippingMethodDTO {
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The ID of the associated cart
|
||||
*/
|
||||
cart_id: string
|
||||
|
||||
/**
|
||||
* The name of the shipping method
|
||||
*/
|
||||
@@ -489,8 +494,16 @@ export interface FilterableLineItemProps
|
||||
product_id?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableShippingMethodProps
|
||||
extends BaseFilterable<FilterableShippingMethodProps> {
|
||||
id?: string | string[]
|
||||
cart_id?: string | string[]
|
||||
name?: string
|
||||
shipping_option_id?: string | string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Remove this in favor of CartDTO, when module is released
|
||||
* TODO: Remove this in favor of CartDTO, when module is released
|
||||
* @deprecated Use CartDTO instead
|
||||
*/
|
||||
export type legacy_CartDTO = {
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface UpdateCartDTO {
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface CreateLineItemTaxLineDTO {
|
||||
export interface CreateTaxLineDTO {
|
||||
description?: string
|
||||
tax_rate_id?: string
|
||||
code: string
|
||||
@@ -64,7 +64,7 @@ export interface CreateLineItemTaxLineDTO {
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface CreateLineItemAdjustmentDTO {
|
||||
export interface CreateAdjustmentDTO {
|
||||
code: string
|
||||
amount: number
|
||||
description?: string
|
||||
@@ -72,7 +72,7 @@ export interface CreateLineItemAdjustmentDTO {
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateLineItemTaxLineDTO {
|
||||
export interface UpdateTaxLineDTO {
|
||||
id: string
|
||||
description?: string
|
||||
tax_rate_id?: string
|
||||
@@ -81,7 +81,7 @@ export interface UpdateLineItemTaxLineDTO {
|
||||
provider_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateLineItemAdjustmentDTO {
|
||||
export interface UpdateAdjustmentDTO {
|
||||
id: string
|
||||
code?: string
|
||||
amount?: number
|
||||
@@ -120,8 +120,8 @@ export interface CreateLineItemDTO {
|
||||
compare_at_unit_price?: number
|
||||
unit_price: number
|
||||
|
||||
tax_lines?: CreateLineItemTaxLineDTO[]
|
||||
adjustments?: CreateLineItemAdjustmentDTO[]
|
||||
tax_lines?: CreateTaxLineDTO[]
|
||||
adjustments?: CreateAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface CreateLineItemForCartDTO extends CreateLineItemDTO {
|
||||
@@ -144,6 +144,29 @@ export interface UpdateLineItemDTO
|
||||
quantity?: number
|
||||
unit_price?: number
|
||||
|
||||
tax_lines?: UpdateLineItemTaxLineDTO[] | CreateLineItemTaxLineDTO[]
|
||||
adjustments?: UpdateLineItemAdjustmentDTO[] | CreateLineItemAdjustmentDTO[]
|
||||
tax_lines?: UpdateTaxLineDTO[] | CreateTaxLineDTO[]
|
||||
adjustments?: UpdateAdjustmentDTO[] | CreateAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface CreateShippingMethodDTO {
|
||||
name: string
|
||||
|
||||
cart_id: string
|
||||
|
||||
amount: number
|
||||
data?: Record<string, unknown>
|
||||
|
||||
tax_lines?: CreateTaxLineDTO[]
|
||||
adjustments?: CreateAdjustmentDTO[]
|
||||
}
|
||||
|
||||
export interface UpdateShippingMethodDTO {
|
||||
id: string
|
||||
name?: string
|
||||
|
||||
amount?: number
|
||||
data?: Record<string, unknown>
|
||||
|
||||
tax_lines?: UpdateTaxLineDTO[] | CreateTaxLineDTO[]
|
||||
adjustments?: UpdateAdjustmentDTO[] | CreateAdjustmentDTO[]
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ import {
|
||||
CartAddressDTO,
|
||||
CartDTO,
|
||||
CartLineItemDTO,
|
||||
CartShippingMethodDTO,
|
||||
FilterableAddressProps,
|
||||
FilterableCartProps,
|
||||
FilterableShippingMethodProps,
|
||||
} from "./common"
|
||||
import {
|
||||
CreateAddressDTO,
|
||||
CreateCartDTO,
|
||||
CreateLineItemDTO,
|
||||
CreateLineItemForCartDTO,
|
||||
CreateShippingMethodDTO,
|
||||
UpdateAddressDTO,
|
||||
UpdateCartDTO,
|
||||
UpdateLineItemDTO,
|
||||
@@ -102,4 +105,35 @@ export interface ICartModuleService extends IModuleService {
|
||||
selector: Partial<CartLineItemDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
listShippingMethods(
|
||||
filters: FilterableShippingMethodProps,
|
||||
config: FindConfig<CartShippingMethodDTO>,
|
||||
sharedContext: Context
|
||||
): Promise<CartShippingMethodDTO[]>
|
||||
|
||||
addShippingMethods(
|
||||
data: CreateShippingMethodDTO
|
||||
): Promise<CartShippingMethodDTO>
|
||||
addShippingMethods(
|
||||
data: CreateShippingMethodDTO[]
|
||||
): Promise<CartShippingMethodDTO[]>
|
||||
addShippingMethods(
|
||||
cartId: string,
|
||||
methods: CreateShippingMethodDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CartShippingMethodDTO[]>
|
||||
|
||||
removeShippingMethods(
|
||||
methodIds: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethods(
|
||||
methodIds: string,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
removeShippingMethods(
|
||||
selector: Partial<CartShippingMethodDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user