chore(order): Paid Total and Refunded Total (#7373)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-05-20 15:48:57 -03:00
1 parent 025536e2a5
commit f57dc98c7a
24 files changed
+340 -175

No files matched your search

@@ -14,7 +14,7 @@ export const POST = async (
const { id } = req.params
const { errors } = await archiveOrderWorkflow(req.scope).run({
input: { order_ids: [req.validatedBody.order_id] },
input: { orderIds: [req.validatedBody.order_id] },
throwOnError: false,
})
@@ -14,7 +14,7 @@ export const POST = async (
const { id } = req.params
const { errors } = await completeOrderWorkflow(req.scope).run({
input: { order_ids: [req.validatedBody.order_id] },
input: { orderIds: [req.validatedBody.order_id] },
throwOnError: false,
})
@@ -1,19 +0,0 @@
import { remoteQueryObjectFromString } from "@medusajs/utils"
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
export const GET = async (req: MedusaRequest, res: MedusaResponse) => {
const remoteQuery = req.scope.resolve("remoteQuery")
const variables = { id: req.params.id }
// TODO: refund payment - v1.x - packages/medusa/src/api/routes/admin/orders/refund-payment.ts
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
res.status(200).json({ order })
}
@@ -12,7 +12,7 @@ export const POST = async (
const variables = { id: req.params.id }
// TODO: Workflow fulfill items, create fulfillments and adjust inventory - v1.x - packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts
// TODO: Workflow fulfill items, create fulfillments - v1.x - packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
@@ -7,14 +7,14 @@ import {
MedusaResponse,
} from "../../../../../types/routing"
export const GET = async (
export const POST = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse
) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
entryPoint: "return",
variables: {
filters: {
...req.filterableFields,
@@ -7,18 +7,17 @@ import {
MedusaResponse,
} from "../../../../../types/routing"
export const GET = async (
export const POST = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse
) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
entryPoint: "return",
variables: {
filters: {
...req.filterableFields,
is_draft_order: false,
},
...req.remoteQueryConfig.pagination,
},
@@ -14,7 +14,7 @@ export const GET = async (
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
entryPoint: "return",
variables: {
filters: {
...req.filterableFields,
@@ -32,7 +32,6 @@ export const StorePostReturnsReqSchema = z.object({
return_shipping: ReturnShippingSchema,
note: z.string().optional(),
receive_now: z.boolean().optional(),
refund_amount: z.number().optional(),
location_id: z.string().optional(),
})
export type StorePostReturnsReqSchemaType = z.infer<