feat(order): bundled actions (#7133)

This commit is contained in:
Carlos R. L. Rodrigues
2024-04-25 07:06:23 -03:00
committed by GitHub
parent e4898fb00d
commit d02905cefa
23 changed files with 1114 additions and 232 deletions
+58 -1
View File
@@ -52,7 +52,9 @@ export interface UpdateOrderDTO {
region_id?: string
customer_id?: string
sales_channel_id?: string
status?: string
items?: CreateOrderLineItemDTO[]
shipping_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
billing_address?: CreateOrderAddressDTO | UpdateOrderAddressDTO
email?: string
no_notification?: boolean
metadata?: Record<string, unknown>
@@ -199,6 +201,7 @@ export interface UpdateOrderLineItemDTO
export interface CreateOrderShippingMethodDTO {
name: string
order_id: string
version?: number
amount: BigNumberInput
shipping_option_id?: string
data?: Record<string, unknown>
@@ -289,10 +292,12 @@ export interface ConfirmOrderChangeDTO {
export interface CreateOrderChangeActionDTO {
order_change_id?: string
version?: number
reference?: string
reference_id?: string
action: string
internal_note?: string
amount?: BigNumberInput
details?: Record<string, unknown>
}
@@ -344,3 +349,55 @@ export interface UpdateOrderItemWithSelectorDTO {
}
/** ORDER DETAIL END */
/** ORDER bundled action flows */
export interface RegisterOrderFulfillmentDTO {
order_id: string
description?: string
internal_note?: string
reference?: string
reference_id?: string
created_by?: string
items: {
id: string
quantity: BigNumberInput
internal_note?: string
metadata?: Record<string, unknown>
}[]
metadata?: Record<string, unknown>
}
export interface RegisterOrderShipmentDTO {
order_id: string
description?: string
internal_note?: string
reference?: string
created_by?: string
shipping_method: Omit<CreateOrderShippingMethodDTO, "order_id"> | string
items: {
id: string
quantity: BigNumberInput
internal_note?: string
metadata?: Record<string, unknown>
}[]
metadata?: Record<string, unknown>
}
export interface CreateOrderReturnDTO {
order_id: string
description?: string
reference?: string
internal_note?: string
created_by?: string
shipping_method: Omit<CreateOrderShippingMethodDTO, "order_id"> | string
items: {
id: string
quantity: BigNumberInput
internal_note?: string
metadata?: Record<string, unknown>
}[]
metadata?: Record<string, unknown>
}
/** ORDER bundled action flows */
+40 -7
View File
@@ -34,10 +34,13 @@ import {
CreateOrderLineItemDTO,
CreateOrderLineItemForOrderDTO,
CreateOrderLineItemTaxLineDTO,
CreateOrderReturnDTO,
CreateOrderShippingMethodAdjustmentDTO,
CreateOrderShippingMethodDTO,
CreateOrderShippingMethodTaxLineDTO,
DeclineOrderChangeDTO,
RegisterOrderFulfillmentDTO,
RegisterOrderShipmentDTO,
UpdateOrderAddressDTO,
UpdateOrderDTO,
UpdateOrderItemDTO,
@@ -1130,12 +1133,15 @@ export interface IOrderModuleService extends IModuleService {
* ```
*
*/
confirmOrderChange(orderId: string, sharedContext?: Context): Promise<void>
confirmOrderChange(
orderChangeId: string,
sharedContext?: Context
): Promise<void>
/**
* This method Represents the completion of an asynchronous operation
*
* @param {string[]} orderId - The order's ID.
* @param {string[]} orderChangeId - The order change's ID.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when {summary}
*
@@ -1145,7 +1151,10 @@ export interface IOrderModuleService extends IModuleService {
* ```
*
*/
confirmOrderChange(orderId: string[], sharedContext?: Context): Promise<void>
confirmOrderChange(
orderChangeId: string[],
sharedContext?: Context
): Promise<void>
/**
* This method Represents the completion of an asynchronous operation
@@ -1192,7 +1201,7 @@ export interface IOrderModuleService extends IModuleService {
/**
* This method Represents the completion of an asynchronous operation
*
* @param {string} orderId - The order's ID.
* @param {string} orderChangeId - The order change's ID.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when {summary}
*
@@ -1202,12 +1211,15 @@ export interface IOrderModuleService extends IModuleService {
* ```
*
*/
declineOrderChange(orderId: string, sharedContext?: Context): Promise<void>
declineOrderChange(
orderChangeId: string,
sharedContext?: Context
): Promise<void>
/**
* This method Represents the completion of an asynchronous operation
*
* @param {string[]} orderId - The order's ID.
* @param {string[]} orderChangeId - The order change's ID.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when {summary}
*
@@ -1217,7 +1229,10 @@ export interface IOrderModuleService extends IModuleService {
* ```
*
*/
declineOrderChange(orderId: string[], sharedContext?: Context): Promise<void>
declineOrderChange(
orderChangeId: string[],
sharedContext?: Context
): Promise<void>
/**
* This method Represents the completion of an asynchronous operation
@@ -1371,4 +1386,22 @@ export interface IOrderModuleService extends IModuleService {
config?: RestoreReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<TReturnableLinkableKeys, string[]> | void>
revertLastVersion(orderId: string, sharedContext?: Context): Promise<void>
// Bundled flows
registerFulfillment(
data: RegisterOrderFulfillmentDTO,
sharedContext?: Context
): Promise<void>
registerShipment(
data: RegisterOrderShipmentDTO,
sharedContext?: Context
): Promise<void>
createReturn(
returnData: CreateOrderReturnDTO,
sharedContext?: Context
): Promise<void>
}