feat(cart): Item tax lines + shipping method tax lines (#6136)

This commit is contained in:
Oli Juhl
2024-01-24 11:42:27 +00:00
committed by GitHub
parent 43205914cb
commit 2b35700dbc
17 changed files with 1245 additions and 145 deletions
+33 -1
View File
@@ -103,13 +103,21 @@ export interface ShippingMethodTaxLineDTO extends TaxLineDTO {
* The associated shipping method
*/
shipping_method: CartShippingMethodDTO
/**
* The ID of the associated shipping method
*/
shipping_method_id: string
}
export interface LineItemTaxLineDTO extends TaxLineDTO {
/**
* The associated line item
*/
line_item: CartLineItemDTO
item: CartLineItemDTO
/**
* The ID of the associated line item
*/
item_id: string
}
export interface CartAddressDTO {
@@ -513,6 +521,7 @@ export interface FilterableLineItemAdjustmentProps
item_id?: string | string[]
promotion_id?: string | string[]
provider_id?: string | string[]
item?: FilterableLineItemProps
}
export interface FilterableShippingMethodProps
extends BaseFilterable<FilterableShippingMethodProps> {
@@ -528,6 +537,29 @@ export interface FilterableShippingMethodAdjustmentProps
shipping_method_id?: string | string[]
promotion_id?: string | string[]
provider_id?: string | string[]
shipping_method?: FilterableShippingMethodProps
}
export interface FilterableLineItemTaxLineProps
extends BaseFilterable<FilterableLineItemTaxLineProps> {
id?: string | string[]
description?: string
code?: string | string[]
tax_rate_id?: string | string[]
provider_id?: string | string[]
item_id?: string | string[]
item?: FilterableLineItemProps
}
export interface FilterableShippingMethodTaxLineProps
extends BaseFilterable<FilterableShippingMethodTaxLineProps> {
id?: string | string[]
description?: string
code?: string | string[]
tax_rate_id?: string | string[]
provider_id?: string | string[]
shipping_method_id?: string | string[]
shipping_method?: FilterableShippingMethodProps
}
/**
+31 -23
View File
@@ -60,30 +60,9 @@ export interface UpdateCartDTO {
/** CART END */
/** TAXLINES START */
export interface CreateTaxLineDTO {
description?: string
tax_rate_id?: string
code: string
rate: number
provider_id?: string
}
export interface UpdateTaxLineDTO {
id: string
description?: string
tax_rate_id?: string
code?: string
rate?: number
provider_id?: string
}
/** TAXLINES END */
/** ADJUSTMENT START */
export interface CreateAdjustmentDTO {
item_id: string
code?: string
code: string
amount: number
description?: string
promotion_id?: string
@@ -117,7 +96,36 @@ export interface UpsertLineItemAdjustmentDTO {
provider_id?: string
}
/** ADJUSTMENT START */
/** ADJUSTMENTS END */
/** TAX LINES START */
export interface CreateTaxLineDTO {
description?: string
tax_rate_id?: string
code: string
rate: number
provider_id?: string
}
export interface UpdateTaxLineDTO {
id: string
description?: string
tax_rate_id?: string
code?: string
rate?: number
provider_id?: string
}
export interface CreateShippingMethodTaxLineDTO extends CreateTaxLineDTO {}
export interface UpdateShippingMethodTaxLineDTO extends UpdateTaxLineDTO {}
export interface CreateLineItemTaxLineDTO extends CreateTaxLineDTO {}
export interface UpdateLineItemTaxLineDTO extends UpdateTaxLineDTO {}
/** TAX LINES END */
/** LINE ITEMS START */
export interface CreateLineItemDTO {
+85
View File
@@ -10,10 +10,14 @@ import {
FilterableCartProps,
FilterableLineItemAdjustmentProps,
FilterableLineItemProps,
FilterableLineItemTaxLineProps,
FilterableShippingMethodAdjustmentProps,
FilterableShippingMethodProps,
FilterableShippingMethodTaxLineProps,
LineItemAdjustmentDTO,
LineItemTaxLineDTO,
ShippingMethodAdjustmentDTO,
ShippingMethodTaxLineDTO,
} from "./common"
import {
CreateAddressDTO,
@@ -21,14 +25,18 @@ import {
CreateCartDTO,
CreateLineItemDTO,
CreateLineItemForCartDTO,
CreateLineItemTaxLineDTO,
CreateShippingMethodAdjustmentDTO,
CreateShippingMethodDTO,
CreateShippingMethodForSingleCartDTO,
CreateShippingMethodTaxLineDTO,
UpdateAddressDTO,
UpdateCartDTO,
UpdateLineItemDTO,
UpdateLineItemTaxLineDTO,
UpdateLineItemWithSelectorDTO,
UpdateShippingMethodAdjustmentDTO,
UpdateShippingMethodTaxLineDTO,
UpsertLineItemAdjustmentDTO,
} from "./mutations"
@@ -234,4 +242,81 @@ export interface ICartModuleService extends IModuleService {
selector: Partial<ShippingMethodAdjustmentDTO>,
sharedContext?: Context
): Promise<void>
listLineItemTaxLines(
filters: FilterableLineItemTaxLineProps,
config?: FindConfig<LineItemTaxLineDTO>,
sharedContext?: Context
): Promise<LineItemTaxLineDTO[]>
addLineItemTaxLines(
taxLines: CreateLineItemTaxLineDTO[]
): Promise<LineItemTaxLineDTO[]>
addLineItemTaxLines(
taxLine: CreateLineItemTaxLineDTO
): Promise<LineItemTaxLineDTO>
addLineItemTaxLines(
cartId: string,
taxLines: CreateLineItemTaxLineDTO[] | CreateLineItemTaxLineDTO,
sharedContext?: Context
): Promise<LineItemTaxLineDTO[]>
setLineItemTaxLines(
cartId: string,
taxLines: (CreateLineItemTaxLineDTO | UpdateLineItemTaxLineDTO)[],
sharedContext?: Context
): Promise<LineItemTaxLineDTO[]>
removeLineItemTaxLines(
taxLineIds: string[],
sharedContext?: Context
): Promise<void>
removeLineItemTaxLines(
taxLineIds: string,
sharedContext?: Context
): Promise<void>
removeLineItemTaxLines(
selector: FilterableLineItemTaxLineProps,
sharedContext?: Context
): Promise<void>
listShippingMethodTaxLines(
filters: FilterableShippingMethodTaxLineProps,
config?: FindConfig<ShippingMethodTaxLineDTO>,
sharedContext?: Context
): Promise<ShippingMethodTaxLineDTO[]>
addShippingMethodTaxLines(
taxLines: CreateShippingMethodTaxLineDTO[]
): Promise<ShippingMethodTaxLineDTO[]>
addShippingMethodTaxLines(
taxLine: CreateShippingMethodTaxLineDTO
): Promise<ShippingMethodTaxLineDTO>
addShippingMethodTaxLines(
cartId: string,
taxLines: CreateShippingMethodTaxLineDTO[] | CreateShippingMethodTaxLineDTO,
sharedContext?: Context
): Promise<ShippingMethodTaxLineDTO[]>
setShippingMethodTaxLines(
cartId: string,
taxLines: (
| CreateShippingMethodTaxLineDTO
| UpdateShippingMethodTaxLineDTO
)[],
sharedContext?: Context
): Promise<ShippingMethodTaxLineDTO[]>
removeShippingMethodTaxLines(
taxLineIds: string[],
sharedContext?: Context
): Promise<void>
removeShippingMethodTaxLines(
taxLineIds: string,
sharedContext?: Context
): Promise<void>
removeShippingMethodTaxLines(
selector: FilterableShippingMethodTaxLineProps,
sharedContext?: Context
): Promise<void>
}