fix: complete cart return type (#902)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import {
|
||||
StoreCartsRes,
|
||||
StoreOrdersRes,
|
||||
StoreCompleteCartRes,
|
||||
StorePostCartReq,
|
||||
StorePostCartsCartPaymentSessionReq,
|
||||
StorePostCartsCartPaymentSessionUpdateReq,
|
||||
StorePostCartsCartReq,
|
||||
StorePostCartsCartShippingMethodReq,
|
||||
StoreSwapsRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { ResponsePromise } from "../typings"
|
||||
import BaseResource from "./base"
|
||||
@@ -36,11 +35,9 @@ class CartsResource extends BaseResource {
|
||||
* The completion of a cart can be performed idempotently with a provided header Idempotency-Key.
|
||||
* If not provuided, we will generate one for the request.
|
||||
* @param {string} cart_id is required
|
||||
* @return {ResponsePromise<StoreCartsRes | StoreSwapsRes | StoreOrdersRes>}
|
||||
* @return {ResponsePromise<StoreCompleteCartRes>}
|
||||
*/
|
||||
complete(
|
||||
cart_id: string
|
||||
): ResponsePromise<StoreCartsRes | StoreSwapsRes | StoreOrdersRes> {
|
||||
complete(cart_id: string): ResponsePromise<StoreCompleteCartRes> {
|
||||
const path = `/store/carts/${cart_id}/complete`
|
||||
return this.client.request("POST", path)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Router } from "express"
|
||||
import "reflect-metadata"
|
||||
import { Cart } from "../../../../models/cart"
|
||||
import { Cart, Order, Swap } from "../../../../"
|
||||
import { DeleteResponse } from "../../../../types/common"
|
||||
import middlewares from "../../../middlewares"
|
||||
|
||||
const route = Router()
|
||||
|
||||
export default (app, container) => {
|
||||
@@ -127,6 +126,17 @@ export type StoreCartsRes = {
|
||||
cart: Omit<Cart, "refundable_amount" | "refunded_total">
|
||||
}
|
||||
|
||||
export type StoreCompleteCartRes = {
|
||||
type: "cart"
|
||||
data: Cart
|
||||
} | {
|
||||
type: "order"
|
||||
data: Order
|
||||
} | {
|
||||
type: "swap"
|
||||
data: Swap
|
||||
}
|
||||
|
||||
export type StoreCartsDeleteRes = DeleteResponse
|
||||
|
||||
export * from "./add-shipping-method"
|
||||
|
||||
Reference in New Issue
Block a user