chore(order): Paid Total and Refunded Total (#7373)
This commit is contained in:
1 parent
025536e2a5
commit
f57dc98c7a
24 files changed
+340
-175
No files matched your search
@@ -2,19 +2,19 @@ import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { IOrderModuleService } from "@medusajs/types"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CompleteOrdersStepInput = {
|
||||
order_ids: string[]
|
||||
type ArchiveOrdersStepInput = {
|
||||
orderIds: string[]
|
||||
}
|
||||
|
||||
export const archiveOrdersStepId = "archive-orders"
|
||||
export const archiveOrdersStep = createStep(
|
||||
archiveOrdersStepId,
|
||||
async (data: CompleteOrdersStepInput, { container }) => {
|
||||
async (data: ArchiveOrdersStepInput, { container }) => {
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
const archived = await service.archive(data.order_ids)
|
||||
const archived = await service.archive(data.orderIds)
|
||||
return new StepResponse(
|
||||
archived,
|
||||
archived.map((store) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { IOrderModuleService } from "@medusajs/types"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CompleteOrdersStepInput = {
|
||||
order_ids: string[]
|
||||
orderIds: string[]
|
||||
}
|
||||
|
||||
export const completeOrdersStepId = "complete-orders"
|
||||
@@ -14,7 +14,7 @@ export const completeOrdersStep = createStep(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
const completed = await service.completeOrder(data.order_ids)
|
||||
const completed = await service.completeOrder(data.orderIds)
|
||||
return new StepResponse(
|
||||
completed,
|
||||
completed.map((store) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
||||
import { archiveOrdersStep } from "../steps"
|
||||
|
||||
type ArchiveOrdersStepInput = {
|
||||
order_ids: string[]
|
||||
orderIds: string[]
|
||||
}
|
||||
|
||||
export const archiveOrderWorkflowId = "archive-order-workflow"
|
||||
|
||||
@@ -3,7 +3,7 @@ import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
|
||||
import { completeOrdersStep } from "../steps"
|
||||
|
||||
type CompleteOrdersStepInput = {
|
||||
order_ids: string[]
|
||||
orderIds: string[]
|
||||
}
|
||||
|
||||
export const completeOrderWorkflowId = "complete-order-workflow"
|
||||
|
||||
@@ -20,6 +20,8 @@ interface OrderSummary {
|
||||
future_projected_total: number
|
||||
balance: number
|
||||
future_balance: number
|
||||
paid_total: number
|
||||
refunded_total: number
|
||||
}
|
||||
|
||||
interface OrderAdjustmentLine {
|
||||
|
||||
@@ -38,6 +38,9 @@ export type OrderSummaryDTO = {
|
||||
|
||||
balance: BigNumberValue
|
||||
future_balance: BigNumberValue
|
||||
|
||||
paid_total: BigNumberValue
|
||||
refunded_total: BigNumberValue
|
||||
}
|
||||
|
||||
export interface OrderAdjustmentLineDTO {
|
||||
@@ -1266,10 +1269,6 @@ export interface OrderTransactionDTO {
|
||||
* The ID of the reference
|
||||
*/
|
||||
reference_id: string
|
||||
/**
|
||||
* The metadata of the transaction
|
||||
*/
|
||||
metadata: Record<string, unknown> | null
|
||||
/**
|
||||
* When the transaction was created
|
||||
*/
|
||||
|
||||
@@ -317,7 +317,7 @@ export interface UpdateOrderChangeActionDTO {
|
||||
export interface CreateOrderTransactionDTO {
|
||||
order_id: string
|
||||
description?: string
|
||||
reference_type?: string
|
||||
reference?: string
|
||||
reference_id?: string
|
||||
internal_note?: string
|
||||
created_by?: string
|
||||
|
||||
@@ -59,8 +59,6 @@ import {
|
||||
UpdateOrderReturnReasonWithSelectorDTO,
|
||||
UpdateOrderShippingMethodAdjustmentDTO,
|
||||
UpdateOrderShippingMethodTaxLineDTO,
|
||||
UpdateOrderTransactionDTO,
|
||||
UpdateOrderTransactionWithSelectorDTO,
|
||||
UpsertOrderLineItemAdjustmentDTO,
|
||||
} from "./mutations"
|
||||
|
||||
@@ -1400,14 +1398,8 @@ export interface IOrderModuleService extends IModuleService {
|
||||
|
||||
revertLastVersion(orderId: string, sharedContext?: Context): Promise<void>
|
||||
|
||||
retrieveTransaction(
|
||||
id: string,
|
||||
config?: FindConfig<OrderTransactionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTransactionDTO>
|
||||
|
||||
listTransactions(
|
||||
filters: FilterableOrderTransactionProps,
|
||||
filters?: FilterableOrderTransactionProps,
|
||||
config?: FindConfig<OrderTransactionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTransactionDTO[]>
|
||||
@@ -1422,33 +1414,19 @@ export interface IOrderModuleService extends IModuleService {
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTransactionDTO[]>
|
||||
|
||||
updateTransactions(
|
||||
data: UpdateOrderTransactionWithSelectorDTO[]
|
||||
): Promise<OrderTransactionDTO[]>
|
||||
updateTransactions(
|
||||
selector: Partial<FilterableOrderTransactionProps>,
|
||||
data: Partial<UpdateOrderTransactionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTransactionDTO[]>
|
||||
updateTransactions(
|
||||
id: string,
|
||||
data: Partial<UpdateOrderTransactionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTransactionDTO>
|
||||
|
||||
deleteTransactions(
|
||||
returnReasonIds: string[],
|
||||
transactionIds: string | object | string[] | object[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
|
||||
softDeleteTransactions<TReturnableLinkableKeys extends string = string>(
|
||||
storeIds: string[],
|
||||
transactionIds: string[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
restoreTransactions<TReturnableLinkableKeys extends string = string>(
|
||||
storeIds: string[],
|
||||
transactionIds: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
Reference in new issue
Block a user