feat(*): shipping options update API (#6987)
**What** - Update the `updateShippingOptions` module service API to follow the newest convention - Add upsert support for shipping options - update shipping options workflow - update shipping options api end point and validation - update shipping options all integration tests FIXES CORE-1926
This commit is contained in:
1 parent
f65fbff535
commit
f132929c7e
20 files changed
+916
-74
No files matched your search
@@ -14,7 +14,7 @@ export interface CreateShippingOptionDTO {
|
||||
}
|
||||
|
||||
export interface UpdateShippingOptionDTO {
|
||||
id: string
|
||||
id?: string
|
||||
name?: string
|
||||
price_type?: ShippingOptionPriceType
|
||||
service_zone_id?: string
|
||||
@@ -27,3 +27,7 @@ export interface UpdateShippingOptionDTO {
|
||||
| { id: string }
|
||||
)[]
|
||||
}
|
||||
|
||||
export interface UpsertShippingOptionDTO extends UpdateShippingOptionDTO {
|
||||
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
UpdateShippingOptionRuleDTO,
|
||||
UpdateShippingProfileDTO,
|
||||
UpsertServiceZoneDTO,
|
||||
UpsertShippingOptionDTO,
|
||||
} from "./mutations"
|
||||
import { CreateFulfillmentDTO } from "./mutations/fulfillment"
|
||||
import { CreateShippingProfileDTO } from "./mutations/shipping-profile"
|
||||
@@ -376,19 +377,35 @@ export interface IFulfillmentModuleService extends IModuleService {
|
||||
data: CreateShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO>
|
||||
|
||||
/**
|
||||
* Update a shipping option
|
||||
* @param id
|
||||
* @param data
|
||||
* @param sharedContext
|
||||
*/
|
||||
updateShippingOptions(
|
||||
data: UpdateShippingOptionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO[]>
|
||||
updateShippingOptions(
|
||||
id: string,
|
||||
data: UpdateShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO>
|
||||
updateShippingOptions(
|
||||
selector: FilterableShippingOptionProps,
|
||||
data: UpdateShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO[]>
|
||||
|
||||
/**
|
||||
* Upsert a shipping option
|
||||
*/
|
||||
upsertShippingOptions(
|
||||
data: UpsertShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO>
|
||||
upsertShippingOptions(
|
||||
data: UpsertShippingOptionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ShippingOptionDTO[]>
|
||||
/**
|
||||
* Delete a shippingOption
|
||||
* @param ids
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./create-shipping-options"
|
||||
export * from "./update-shipping-options"
|
||||
export * from "./service-zones"
|
||||
@@ -0,0 +1,36 @@
|
||||
import { ShippingOptionPriceType } from "../../fulfillment"
|
||||
import { RuleOperatorType } from "../../common"
|
||||
|
||||
export interface UpdateShippingOptionsWorkflowInput {
|
||||
id: string
|
||||
name?: string
|
||||
service_zone_id?: string
|
||||
shipping_profile_id?: string
|
||||
data?: Record<string, unknown>
|
||||
price_type?: ShippingOptionPriceType
|
||||
provider_id?: string
|
||||
type?: {
|
||||
label: string
|
||||
description: string
|
||||
code: string
|
||||
}
|
||||
prices?: (
|
||||
| {
|
||||
currency_code: string
|
||||
amount: number
|
||||
}
|
||||
| {
|
||||
region_id: string
|
||||
amount: number
|
||||
}
|
||||
)[]
|
||||
rules?: {
|
||||
attribute: string
|
||||
operator: RuleOperatorType
|
||||
value: string | string[]
|
||||
}[]
|
||||
}
|
||||
|
||||
export type UpdateShippingOptionsWorkflowOutput = {
|
||||
id: string
|
||||
}[]
|
||||
Reference in new issue
Block a user