feat(medusa): Claim customer orders (#2710)

This commit is contained in:
Philip Korsholm
2022-12-08 17:48:49 +01:00
committed by GitHub
parent 86f9455d00
commit a6243618fe
36 changed files with 872 additions and 107 deletions
+34 -1
View File
@@ -1,4 +1,9 @@
import { StoreGetOrdersParams, StoreOrdersRes } from "@medusajs/medusa"
import {
StoreGetOrdersParams,
StoreOrdersRes,
StorePostCustomersCustomerAcceptClaimReq,
StorePostCustomersCustomerOrderClaimReq,
} from "@medusajs/medusa"
import qs from "qs"
import { ResponsePromise } from "../typings"
import BaseResource from "./base"
@@ -49,6 +54,34 @@ class OrdersResource extends BaseResource {
return this.client.request("GET", path, payload, {}, customHeaders)
}
/**
* @description Request access to a list of orders
* @param {string[]} payload display ids of orders to request
* @param customHeaders
* @return {ResponsePromise}
*/
requestCustomerOrders(
payload: StorePostCustomersCustomerOrderClaimReq,
customHeaders: Record<string, any> = {}
): ResponsePromise {
const path = `/store/orders/batch/customer/token`
return this.client.request("POST", path, payload, {}, customHeaders)
}
/**
* @description Grant access to a list of orders
* @param {string} payload signed token to grant access
* @param customHeaders
* @return {ResponsePromise}
*/
confirmRequest(
payload: StorePostCustomersCustomerAcceptClaimReq,
customHeaders: Record<string, any> = {}
): ResponsePromise {
const path = `/store/orders/customer/confirm`
return this.client.request("POST", path, payload, {}, customHeaders)
}
}
export default OrdersResource