Feat(order): post purchase support (#7666)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-06-10 18:44:51 -03:00
1 parent 39ddba2491
commit 37426939da
43 files changed
+1645 -476

No files matched your search

+6
View File
@@ -1109,6 +1109,12 @@ export interface OrderDTO {
raw_original_shipping_tax_total: BigNumberRawValue
}
type ReturnStatus = "requested" | "received" | "partially_received" | "canceled"
export interface ReturnDTO extends Omit<OrderDTO, "status" | "version"> {
status: ReturnStatus
}
export type PaymentStatus =
| "not_paid"
| "awaiting"
+32 -11
View File
@@ -249,6 +249,9 @@ export interface UpdateOrderShippingMethodAdjustmentDTO {
export interface CreateOrderChangeDTO {
order_id: string
return_id?: string
claim_id?: string
exchange_id?: string
description?: string
internal_note?: string
requested_by?: string
@@ -298,6 +301,10 @@ export interface ConfirmOrderChangeDTO {
export interface CreateOrderChangeActionDTO {
order_change_id?: string
order_id?: string
return_id?: string
claim_id?: string
exchange_id?: string
version?: number
reference?: string
reference_id?: string
@@ -368,39 +375,53 @@ export interface UpdateOrderItemWithSelectorDTO {
/** ORDER bundled action flows */
interface BaseOrderBundledItemActionsDTO {
id: string
quantity: BigNumberInput
internal_note?: string
metadata?: Record<string, unknown> | null
}
interface BaseOrderBundledActionsDTO {
order_id: string
return_id?: string
claim_id?: string
exchange_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> | null
}[]
metadata?: Record<string, unknown> | null
}
export interface RegisterOrderFulfillmentDTO
extends BaseOrderBundledActionsDTO {}
extends BaseOrderBundledActionsDTO {
items: BaseOrderBundledItemActionsDTO[]
}
export interface CancelOrderFulfillmentDTO extends BaseOrderBundledActionsDTO {}
export interface CancelOrderFulfillmentDTO extends BaseOrderBundledActionsDTO {
items: BaseOrderBundledItemActionsDTO[]
}
export interface RegisterOrderShipmentDTO extends BaseOrderBundledActionsDTO {}
export interface RegisterOrderShipmentDTO extends BaseOrderBundledActionsDTO {
items: BaseOrderBundledItemActionsDTO[]
}
export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
items: BaseOrderBundledItemActionsDTO[]
shipping_method: Omit<CreateOrderShippingMethodDTO, "order_id"> | string
}
export interface CancelOrderReturnDTO {
order_id: string
return_id: string
}
export interface ReceiveOrderReturnDTO extends BaseOrderBundledActionsDTO {}
export interface ReceiveOrderReturnDTO
extends Omit<BaseOrderBundledActionsDTO, "order_id"> {
items: BaseOrderBundledItemActionsDTO[]
return_id: string
}
/** ORDER bundled action flows */
+21 -2
View File
@@ -26,6 +26,7 @@ import {
OrderShippingMethodDTO,
OrderShippingMethodTaxLineDTO,
OrderTransactionDTO,
ReturnDTO,
} from "./common"
import {
CancelOrderChangeDTO,
@@ -130,6 +131,24 @@ export interface IOrderModuleService extends IModuleService {
sharedContext?: Context
): Promise<[OrderDTO[], number]>
retrieveReturn(
returnId: string,
config?: FindConfig<ReturnDTO>,
sharedContext?: Context
): Promise<ReturnDTO>
listReturns(
filters?: FilterableOrderProps,
config?: FindConfig<ReturnDTO>,
sharedContext?: Context
): Promise<ReturnDTO[]>
listAndCountReturns(
filters?: FilterableOrderProps,
config?: FindConfig<ReturnDTO>,
sharedContext?: Context
): Promise<[ReturnDTO[], number]>
/**
* This method creates {return type}(s)
*
@@ -1513,7 +1532,7 @@ export interface IOrderModuleService extends IModuleService {
createReturn(
returnData: CreateOrderReturnDTO,
sharedContext?: Context
): Promise<void>
): Promise<any> // TODO: ReturnDTO
/*
cancelReturn(
@@ -1525,5 +1544,5 @@ export interface IOrderModuleService extends IModuleService {
receiveReturn(
returnData: ReceiveOrderReturnDTO,
sharedContext?: Context
): Promise<void>
): Promise<any> // TODO: ReturnDTO
}
+10 -14
View File
@@ -33,27 +33,23 @@ export enum OrderStatus {
/**
* @enum
*
* The order change's status.
* The return's status.
*/
export enum OrderChangeStatus {
export enum ReturnStatus {
/**
* The order change is confirmed.
*/
CONFIRMED = "confirmed",
/**
* The order change is declined.
*/
DECLINED = "declined",
/**
* The order change is requested.
* The return is requested.
*/
REQUESTED = "requested",
/**
* The order change is pending.
* The return is received.
*/
PENDING = "pending",
RECEIVED = "received",
/**
* The order change is canceled.
* The return is partially received.
*/
PARTIALLY_RECEIVED = "partially_received",
/**
* The return is canceled.
*/
CANCELED = "canceled",
}