fix(types, medusa): fixes to HTTP types (#9273)
### types - Remove `is_internal` and `is_active` from `StoreProductCategory` - Add missing status, reference, and action enums from `BaseOrderChange` and `BaseOrderChangeAction` - Remove unused totals from `BaseOrderSummary`. - Fix references to base types from admin / store types - Other general fixes ### medusa - Use HTTP types for create / update return reason routes - Remove type arguments from the calculate taxes route since it's a `POST` API route but the type argument for the select query parameters only. - Add `metadata` to the list of cart's fields. - Add type casting for order previews in response
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { StorePaymentCollection } from "../../payment"
|
||||
import { StoreProduct, StoreProductVariant } from "../../product"
|
||||
import { StoreRegion } from "../../region"
|
||||
import {
|
||||
BaseCart,
|
||||
BaseCartAddress,
|
||||
@@ -5,7 +8,18 @@ import {
|
||||
BaseCartShippingMethod,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreCart extends BaseCart {}
|
||||
export interface StoreCartLineItem extends BaseCartLineItem {}
|
||||
export interface StoreCart extends Omit<BaseCart, "items"> {
|
||||
shipping_address?: StoreCartAddress
|
||||
billing_address?: StoreCartAddress
|
||||
items?: StoreCartLineItem[]
|
||||
shipping_methods?: StoreCartShippingMethod[]
|
||||
payment_collection?: StorePaymentCollection
|
||||
region?: StoreRegion
|
||||
}
|
||||
export interface StoreCartLineItem extends Omit<BaseCartLineItem, "product" | "variant" | "cart"> {
|
||||
product?: StoreProduct
|
||||
variant?: StoreProductVariant
|
||||
cart: StoreCart
|
||||
}
|
||||
export interface StoreCartAddress extends BaseCartAddress {}
|
||||
export interface StoreCartShippingMethod extends BaseCartShippingMethod {}
|
||||
@@ -1,3 +1,9 @@
|
||||
import { AdminOrder, AdminOrderShippingMethod } from "../../order"
|
||||
import { AdminReturn } from "../../return"
|
||||
import { BaseClaim } from "../common"
|
||||
|
||||
export interface AdminClaim extends BaseClaim {}
|
||||
export interface AdminClaim extends BaseClaim {
|
||||
order: AdminOrder
|
||||
return: AdminReturn
|
||||
shipping_methods?: AdminOrderShippingMethod[]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { OrderDTO, OrderPreviewDTO } from "../../../order"
|
||||
import { OrderDTO } from "../../../order"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminOrderPreview } from "../../order"
|
||||
import { AdminReturn } from "../../return"
|
||||
import { AdminClaim } from "./entities"
|
||||
|
||||
@@ -18,12 +19,12 @@ export interface AdminClaimOrderResponse {
|
||||
}
|
||||
|
||||
export interface AdminClaimPreviewResponse {
|
||||
order_preview: OrderPreviewDTO
|
||||
order_preview: AdminOrderPreview
|
||||
claim: AdminClaim
|
||||
}
|
||||
|
||||
export interface AdminClaimReturnPreviewResponse {
|
||||
order_preview: OrderPreviewDTO
|
||||
order_preview: AdminOrderPreview
|
||||
return: AdminReturn
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { OrderDTO, OrderPreviewDTO } from "../../../order"
|
||||
import { OrderDTO } from "../../../order"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminOrderPreview } from "../../order"
|
||||
import { AdminReturn } from "../../return"
|
||||
import { AdminExchange } from "./entities"
|
||||
|
||||
@@ -17,7 +18,7 @@ export interface AdminExchangeOrderResponse {
|
||||
}
|
||||
|
||||
export interface AdminExchangePreviewResponse {
|
||||
order_preview: OrderPreviewDTO
|
||||
order_preview: AdminOrderPreview
|
||||
exchange: AdminExchange
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ export interface AdminExchangeRequestResponse
|
||||
}
|
||||
|
||||
export interface AdminExchangeReturnResponse {
|
||||
order_preview: OrderPreviewDTO
|
||||
order_preview: AdminOrderPreview
|
||||
return: AdminReturn
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { OrderChangeDTO, OrderPreviewDTO } from "../../../order"
|
||||
import { DeleteResponse } from "../../common"
|
||||
import { AdminOrderChange, AdminOrderPreview } from "../../order/admin"
|
||||
|
||||
export interface AdminOrderEditPreviewResponse {
|
||||
order_preview: OrderPreviewDTO
|
||||
order_preview: AdminOrderPreview
|
||||
}
|
||||
|
||||
export interface AdminOrderEditResponse {
|
||||
order_change: OrderChangeDTO
|
||||
order_change: AdminOrderChange
|
||||
}
|
||||
|
||||
export type AdminOrderEditDeleteResponse = DeleteResponse<"order-edit">
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { AdminClaim } from "../../claim"
|
||||
import { AdminCustomer } from "../../customer"
|
||||
import { AdminExchange } from "../../exchange"
|
||||
import { AdminPaymentCollection } from "../../payment/admin"
|
||||
import { AdminProductVariant } from "../../product"
|
||||
import { AdminProduct, AdminProductVariant } from "../../product"
|
||||
import { AdminRegionCountry } from "../../region"
|
||||
import { AdminReturn } from "../../return"
|
||||
import { AdminSalesChannel } from "../../sales-channel"
|
||||
import {
|
||||
BaseOrder,
|
||||
@@ -13,24 +16,37 @@ import {
|
||||
BaseOrderShippingMethod,
|
||||
} from "../common"
|
||||
|
||||
export interface AdminOrder extends BaseOrder {
|
||||
export interface AdminOrder extends Omit<BaseOrder, "items"> {
|
||||
payment_collections: AdminPaymentCollection[]
|
||||
fulfillments?: BaseOrderFulfillment[]
|
||||
fulfillments?: AdminOrderFulfillment[]
|
||||
sales_channel?: AdminSalesChannel
|
||||
customer?: AdminCustomer
|
||||
shipping_address?: AdminOrderAddress | null
|
||||
billing_address?: AdminOrderAddress | null
|
||||
items: AdminOrderLineItem[]
|
||||
shipping_methods: AdminOrderShippingMethod[]
|
||||
}
|
||||
|
||||
export interface AdminOrderLineItem extends BaseOrderLineItem {
|
||||
variant?: AdminProductVariant
|
||||
export interface AdminOrderChange extends
|
||||
Omit<BaseOrderChange, "order" | "claim" | "return_order" | "exchange" | "actions"> {
|
||||
order: AdminOrder
|
||||
claim: AdminClaim
|
||||
return_order: AdminReturn
|
||||
exchange: AdminExchange
|
||||
actions: AdminOrderChangeAction[]
|
||||
}
|
||||
|
||||
export interface AdminOrderChangeAction extends Omit<BaseOrderChangeAction, "order_change" | "order"> {
|
||||
order_change: AdminOrderChange
|
||||
order: AdminOrder | null
|
||||
}
|
||||
export interface AdminOrderChange extends BaseOrderChange {}
|
||||
|
||||
export interface AdminOrderFulfillment extends BaseOrderFulfillment {}
|
||||
|
||||
export interface AdminOrderLineItem extends BaseOrderLineItem {}
|
||||
export interface AdminOrderLineItem extends Omit<BaseOrderLineItem, "variant" | "product"> {
|
||||
variant?: AdminProductVariant
|
||||
product?: AdminProduct
|
||||
}
|
||||
|
||||
export interface AdminOrderAddress extends BaseOrderAddress {
|
||||
country?: AdminRegionCountry
|
||||
@@ -41,9 +57,9 @@ export interface AdminOrderShippingMethod extends BaseOrderShippingMethod {}
|
||||
export interface AdminOrderPreview
|
||||
extends Omit<AdminOrder, "items" | "shipping_methods"> {
|
||||
return_requested_total: number
|
||||
order_change: BaseOrderChange
|
||||
items: (BaseOrderLineItem & { actions?: BaseOrderChangeAction[] })[]
|
||||
shipping_methods: (BaseOrderShippingMethod & {
|
||||
actions?: BaseOrderChangeAction[]
|
||||
order_change: AdminOrderChange
|
||||
items: (AdminOrderLineItem & { actions?: AdminOrderChangeAction[] })[]
|
||||
shipping_methods: (AdminOrderShippingMethod & {
|
||||
actions?: AdminOrderChangeAction[]
|
||||
})[]
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { BaseOrderChange } from "../common"
|
||||
import { AdminOrder, AdminOrderPreview } from "./entities"
|
||||
import { AdminOrder, AdminOrderChange, AdminOrderPreview } from "./entities"
|
||||
|
||||
export interface AdminOrderResponse {
|
||||
order: AdminOrder
|
||||
}
|
||||
|
||||
export interface AdminOrderChangesResponse {
|
||||
order_changes: BaseOrderChange[]
|
||||
order_changes: AdminOrderChange[]
|
||||
}
|
||||
|
||||
export type AdminOrderListResponse = PaginatedResponse<{
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||
import { ChangeActionType, OrderChangeStatus } from "../../order"
|
||||
import { BaseClaim } from "../claim/common"
|
||||
import { FindParams } from "../common"
|
||||
import { BaseExchange } from "../exchange/common"
|
||||
import { BasePaymentCollection } from "../payment/common"
|
||||
import { BaseProduct, BaseProductVariant } from "../product/common"
|
||||
import { BaseReturn } from "../return/common"
|
||||
|
||||
export interface BaseOrderSummary {
|
||||
total: number
|
||||
@@ -13,11 +16,6 @@ export interface BaseOrderSummary {
|
||||
returned_total: number
|
||||
return_request_total: number
|
||||
write_off_total: number
|
||||
projected_total: number
|
||||
net_total: number
|
||||
net_subtotal: number
|
||||
net_total_tax: number
|
||||
balance: number
|
||||
paid_total: number
|
||||
refunded_total: number
|
||||
}
|
||||
@@ -180,52 +178,19 @@ export interface BaseOrderShippingDetail {
|
||||
id: string
|
||||
shipping_method_id: string
|
||||
shipping_method: BaseOrderShippingMethod
|
||||
claim_id: string
|
||||
exchange_id: string
|
||||
return_id: string
|
||||
claim_id?: string
|
||||
exchange_id?: string
|
||||
return_id?: string
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
}
|
||||
|
||||
export interface BaseOrderChange {
|
||||
id: string
|
||||
order_id: string
|
||||
actions: BaseOrderChangeAction[]
|
||||
status: string
|
||||
requested_by: string | null
|
||||
requested_at: Date | string | null
|
||||
confirmed_by: string | null
|
||||
confirmed_at: Date | string | null
|
||||
declined_by: string | null
|
||||
declined_reason: string | null
|
||||
metadata: Record<string, unknown> | null
|
||||
declined_at: Date | string | null
|
||||
canceled_by: string | null
|
||||
canceled_at: Date | string | null
|
||||
created_at: Date | string
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
export interface BaseOrderChangeAction {
|
||||
id: string
|
||||
order_change_id: string | null
|
||||
order_change: BaseOrderChange | null
|
||||
order_id: string | null
|
||||
reference: string
|
||||
reference_id: string
|
||||
action: string
|
||||
details: Record<string, unknown> | null
|
||||
internal_note: string | null
|
||||
created_at: Date | string
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
export interface BaseOrderTransaction {
|
||||
id: string
|
||||
order_id: string
|
||||
amount: number
|
||||
currency_code: string
|
||||
reference: string
|
||||
reference: "capture" | "refund"
|
||||
reference_id: string
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date | string
|
||||
@@ -289,7 +254,7 @@ export interface BaseOrder {
|
||||
fulfillment_status: FulfillmentStatus
|
||||
transactions?: BaseOrderTransaction[]
|
||||
summary: BaseOrderSummary
|
||||
metadata: Record<string, unknown> | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
created_at: string | Date
|
||||
updated_at: string | Date
|
||||
original_item_total: number
|
||||
@@ -378,14 +343,14 @@ export interface BaseOrderChange {
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
return_order: any
|
||||
return_order: BaseReturn
|
||||
|
||||
/**
|
||||
* The associated exchange order
|
||||
*
|
||||
* @expandable
|
||||
*/
|
||||
exchange: any
|
||||
exchange: BaseExchange
|
||||
|
||||
/**
|
||||
* The associated claim order
|
||||
@@ -404,7 +369,7 @@ export interface BaseOrderChange {
|
||||
/**
|
||||
* The status of the order change
|
||||
*/
|
||||
status: string
|
||||
status: OrderChangeStatus
|
||||
|
||||
/**
|
||||
* The requested by of the order change
|
||||
@@ -414,7 +379,7 @@ export interface BaseOrderChange {
|
||||
/**
|
||||
* When the order change was requested
|
||||
*/
|
||||
requested_at: Date | string | null
|
||||
requested_at: Date | null
|
||||
|
||||
/**
|
||||
* The confirmed by of the order change
|
||||
@@ -424,7 +389,7 @@ export interface BaseOrderChange {
|
||||
/**
|
||||
* When the order change was confirmed
|
||||
*/
|
||||
confirmed_at: Date | string | null
|
||||
confirmed_at: Date | null
|
||||
|
||||
/**
|
||||
* The declined by of the order change
|
||||
@@ -444,7 +409,7 @@ export interface BaseOrderChange {
|
||||
/**
|
||||
* When the order change was declined
|
||||
*/
|
||||
declined_at: Date | string | null
|
||||
declined_at: Date | null
|
||||
|
||||
/**
|
||||
* The canceled by of the order change
|
||||
@@ -454,7 +419,7 @@ export interface BaseOrderChange {
|
||||
/**
|
||||
* When the order change was canceled
|
||||
*/
|
||||
canceled_at: Date | string | null
|
||||
canceled_at: Date | null
|
||||
|
||||
/**
|
||||
* When the order change was created
|
||||
@@ -518,7 +483,7 @@ export interface BaseOrderChangeAction {
|
||||
/**
|
||||
* The reference of the order change action
|
||||
*/
|
||||
reference: string
|
||||
reference: "claim" | "exchange" | "return" | "order_shipping_method"
|
||||
|
||||
/**
|
||||
* The ID of the reference
|
||||
@@ -528,7 +493,7 @@ export interface BaseOrderChangeAction {
|
||||
/**
|
||||
* The action of the order change action
|
||||
*/
|
||||
action: string
|
||||
action: ChangeActionType
|
||||
|
||||
/**
|
||||
* The details of the order change action
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
import { StoreCustomer } from "../../customer"
|
||||
import { StorePaymentCollection } from "../../payment"
|
||||
import { StoreProduct, StoreProductVariant } from "../../product"
|
||||
import { StoreRegionCountry } from "../../region"
|
||||
import {
|
||||
BaseOrder,
|
||||
BaseOrderAddress,
|
||||
BaseOrderFulfillment,
|
||||
BaseOrderLineItem,
|
||||
BaseOrderShippingMethod,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreOrder extends BaseOrder {}
|
||||
export interface StoreOrderLineItem extends BaseOrderLineItem {}
|
||||
export interface StoreOrderAddress extends BaseOrderAddress {}
|
||||
export interface StoreOrder extends Omit<BaseOrder, "items"> {
|
||||
shipping_address?: StoreOrderAddress | null
|
||||
billing_address?: StoreOrderAddress | null
|
||||
items: StoreOrderLineItem[] | null
|
||||
shipping_methods: StoreOrderShippingMethod[] | null
|
||||
payment_collections?: StorePaymentCollection[]
|
||||
fulfillments?: StoreOrderFulfillment[]
|
||||
customer?: StoreCustomer
|
||||
}
|
||||
export interface StoreOrderLineItem extends Omit<BaseOrderLineItem, "product" | "variant"> {
|
||||
variant?: StoreProductVariant
|
||||
product?: StoreProduct
|
||||
}
|
||||
export interface StoreOrderAddress extends BaseOrderAddress {
|
||||
country?: StoreRegionCountry
|
||||
}
|
||||
export interface StoreOrderShippingMethod extends BaseOrderShippingMethod {}
|
||||
export interface StoreOrderFulfillment extends BaseOrderFulfillment {}
|
||||
@@ -11,8 +11,18 @@ export interface AdminPaymentProvider extends BasePaymentProvider {
|
||||
is_enabled: boolean
|
||||
}
|
||||
|
||||
export interface AdminPayment extends BasePayment {}
|
||||
export interface AdminPaymentCollection extends BasePaymentCollection {}
|
||||
export interface AdminPaymentSession extends BasePaymentSession {}
|
||||
export interface AdminPayment extends BasePayment {
|
||||
refunds?: AdminRefund[]
|
||||
payment_collection?: AdminPaymentCollection
|
||||
payment_session?: AdminPaymentSession
|
||||
}
|
||||
export interface AdminPaymentCollection extends BasePaymentCollection {
|
||||
payments?: AdminPayment[]
|
||||
payment_sessions?: AdminPaymentSession[]
|
||||
payment_providers: AdminPaymentProvider[]
|
||||
}
|
||||
export interface AdminPaymentSession extends BasePaymentSession {
|
||||
payment_collection?: AdminPaymentCollection
|
||||
}
|
||||
export interface AdminRefund extends BaseRefund {}
|
||||
export interface AdminRefundReason extends RefundReason {}
|
||||
@@ -5,5 +5,10 @@ import {
|
||||
} from "../common"
|
||||
|
||||
export interface StorePaymentProvider extends BasePaymentProvider {}
|
||||
export interface StorePaymentCollection extends BasePaymentCollection {}
|
||||
export interface StorePaymentSession extends BasePaymentSession {}
|
||||
export interface StorePaymentCollection extends BasePaymentCollection {
|
||||
payment_sessions?: StorePaymentSession[]
|
||||
payment_providers: StorePaymentProvider[]
|
||||
}
|
||||
export interface StorePaymentSession extends BasePaymentSession {
|
||||
payment_collection?: StorePaymentCollection
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import { StoreProduct } from "../../product/store"
|
||||
import { BaseProductCategory } from "../common"
|
||||
|
||||
export interface StoreProductCategory extends BaseProductCategory {
|
||||
export interface StoreProductCategory extends
|
||||
Omit<BaseProductCategory, "is_active" | "is_internal" | "products" | "parent_category" | "category_children"> {
|
||||
products?: StoreProduct[]
|
||||
parent_category: StoreProductCategory | null
|
||||
category_children: StoreProductCategory[]
|
||||
}
|
||||
|
||||
@@ -15,18 +15,27 @@ import {
|
||||
|
||||
export interface AdminProductVariant extends BaseProductVariant {
|
||||
prices: AdminPrice[] | null
|
||||
options: AdminProductOptionValue[] | null
|
||||
product?: AdminProduct | null
|
||||
}
|
||||
export interface AdminProductOption extends BaseProductOption {
|
||||
product?: AdminProduct | null
|
||||
values?: AdminProductOptionValue[]
|
||||
}
|
||||
export interface AdminProductOption extends BaseProductOption {}
|
||||
export interface AdminProductImage extends BaseProductImage {}
|
||||
export interface AdminProductOptionValue extends BaseProductOptionValue {}
|
||||
export interface AdminProductOptionValue extends BaseProductOptionValue {
|
||||
option?: AdminProductOption | null
|
||||
}
|
||||
export interface AdminProduct
|
||||
extends Omit<BaseProduct, "categories" | "variants"> {
|
||||
collection?: AdminCollection | null
|
||||
categories?: AdminProductCategory[] | null
|
||||
sales_channels?: AdminSalesChannel[] | null
|
||||
variants?: AdminProductVariant[] | null
|
||||
variants: AdminProductVariant[] | null
|
||||
type: AdminProductType | null
|
||||
tags?: AdminProductTag[] | null
|
||||
options: AdminProductOption[] | null
|
||||
images: AdminProductImage[] | null
|
||||
}
|
||||
export type AdminProductStatus = ProductStatus
|
||||
export interface AdminProductVariantInventoryLink {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { StoreCollection } from "../../collection"
|
||||
import { StoreProductCategory } from "../../product-category"
|
||||
import { StoreProductTag } from "../../product-tag"
|
||||
import { StoreProductType } from "../../product-type"
|
||||
import {
|
||||
BaseProduct,
|
||||
@@ -9,12 +11,25 @@ import {
|
||||
ProductStatus,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreProduct extends Omit<BaseProduct, "categories"> {
|
||||
export interface StoreProduct extends Omit<BaseProduct, "categories" | "sales_channels" | "variants" | "options"> {
|
||||
collection?: StoreCollection | null
|
||||
categories?: StoreProductCategory[] | null
|
||||
variants: StoreProductVariant[] | null
|
||||
type?: StoreProductType | null
|
||||
tags?: StoreProductTag[] | null
|
||||
options: StoreProductOption[] | null
|
||||
images: StoreProductImage[] | null
|
||||
}
|
||||
export interface StoreProductVariant extends Omit<BaseProductVariant, "product" | "options"> {
|
||||
options: StoreProductOptionValue[] | null
|
||||
product?: StoreProduct | null
|
||||
}
|
||||
export interface StoreProductOption extends Omit<BaseProductOption, "product" | "values"> {
|
||||
product?: StoreProduct | null
|
||||
values?: StoreProductOptionValue[]
|
||||
}
|
||||
export interface StoreProductVariant extends BaseProductVariant {}
|
||||
export interface StoreProductOption extends BaseProductOption {}
|
||||
export interface StoreProductImage extends BaseProductImage {}
|
||||
export interface StoreProductOptionValue extends BaseProductOptionValue {}
|
||||
export interface StoreProductOptionValue extends Omit<BaseProductOptionValue, "option"> {
|
||||
option?: StoreProductOption | null
|
||||
}
|
||||
export type StoreProductStatus = ProductStatus
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
BaseApplicationMethod,
|
||||
BasePromotion,
|
||||
BasePromotionRule,
|
||||
BaseRuleAttributeOptions,
|
||||
@@ -6,7 +7,15 @@ import {
|
||||
BaseRuleValueOptions
|
||||
} from "../common";
|
||||
|
||||
export interface AdminPromotion extends BasePromotion {}
|
||||
export interface AdminPromotion extends BasePromotion {
|
||||
application_method?: AdminApplicationMethod
|
||||
rules?: AdminPromotionRule[]
|
||||
}
|
||||
export interface AdminApplicationMethod extends BaseApplicationMethod {
|
||||
promotion?: AdminPromotion
|
||||
target_rules?: AdminPromotionRule[]
|
||||
buy_rules?: AdminPromotionRule[]
|
||||
}
|
||||
export interface AdminPromotionRule extends BasePromotionRule {}
|
||||
export interface AdminRuleAttributeOption extends BaseRuleAttributeOptions {}
|
||||
export interface AdminRuleOperatorOption extends BaseRuleOperatorOptions {}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { AdminReturnReason } from "./entities"
|
||||
|
||||
type AdminBaseReturnReasonPayload = Pick<
|
||||
AdminReturnReason,
|
||||
"value" | "label" | "description"
|
||||
>
|
||||
type AdminBaseReturnReasonPayload = {
|
||||
value: string
|
||||
label: string
|
||||
description?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface AdminCreateReturnReason extends AdminBaseReturnReasonPayload {
|
||||
metadata?: Record<string, unknown> | null
|
||||
parent_return_reason_id?: string
|
||||
}
|
||||
|
||||
export interface AdminUpdateReturnReason extends AdminBaseReturnReasonPayload {
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { BaseReturn, BaseReturnItem } from "../common";
|
||||
|
||||
export interface AdminReturnItem extends BaseReturnItem {}
|
||||
export interface AdminReturn extends BaseReturn {}
|
||||
export interface AdminReturn extends BaseReturn {
|
||||
items: AdminReturnItem[]
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { BaseReturn } from "../common";
|
||||
import { BaseReturn, BaseReturnItem } from "../common";
|
||||
|
||||
export interface StoreReturn extends BaseReturn {}
|
||||
export interface StoreReturn extends BaseReturn {
|
||||
items: StoreReturnItem[]
|
||||
}
|
||||
export interface StoreReturnItem extends BaseReturnItem {}
|
||||
|
||||
@@ -25,6 +25,8 @@ export type ChangeActionType =
|
||||
| "WRITE_OFF_ITEM"
|
||||
| "REINSTATE_ITEM"
|
||||
|
||||
export type OrderChangeStatus = "confirmed" | "declined" | "requested" | "pending" | "canceled"
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
@@ -1093,12 +1095,12 @@ export interface OrderDTO {
|
||||
/**
|
||||
* When the order was created.
|
||||
*/
|
||||
created_at?: string | Date
|
||||
created_at: string | Date
|
||||
|
||||
/**
|
||||
* When the order was updated.
|
||||
*/
|
||||
updated_at?: string | Date
|
||||
updated_at: string | Date
|
||||
|
||||
/**
|
||||
* The original item total of the order.
|
||||
@@ -1801,7 +1803,7 @@ export interface OrderChangeDTO {
|
||||
/**
|
||||
* The status of the order change
|
||||
*/
|
||||
status: string
|
||||
status: OrderChangeStatus
|
||||
|
||||
/**
|
||||
* The requested by of the order change
|
||||
@@ -2699,4 +2701,5 @@ export interface OrderPreviewDTO
|
||||
shipping_methods: (OrderShippingMethodDTO & {
|
||||
actions?: OrderChangeActionDTO[]
|
||||
})[]
|
||||
return_requested_total: number
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ export interface PaymentProviderDTO {
|
||||
/**
|
||||
* Whether the payment provider is enabled.
|
||||
*/
|
||||
is_enabled: string
|
||||
is_enabled: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export const DELETE = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export const DELETE = async (
|
||||
)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export const DELETE = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export const DELETE = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export const DELETE = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const POST = async (
|
||||
const [orderClaim] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
claim: orderClaim,
|
||||
return: orderReturn,
|
||||
})
|
||||
|
||||
@@ -56,7 +56,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export const DELETE = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import {
|
||||
} from "../../../../../../../types/routing"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { AdminOrderPreview, HttpTypes } from "@medusajs/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesShippingActionReqSchemaType>,
|
||||
@@ -57,7 +57,7 @@ export const POST = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export const DELETE = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export const POST = async (
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
return: orderReturn,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export const POST = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export const DELETE = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export const POST = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ export const POST = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export const DELETE = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const POST = async (
|
||||
const [orderExchange] = await remoteQuery(queryObject)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
exchange: orderExchange,
|
||||
return: orderReturn,
|
||||
})
|
||||
|
||||
@@ -19,6 +19,6 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -44,6 +44,6 @@ export const DELETE = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export const POST = async (
|
||||
)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ export const DELETE = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ export const POST = async (
|
||||
)
|
||||
|
||||
res.json({
|
||||
order_preview: result,
|
||||
order_preview: result as unknown as HttpTypes.AdminOrderPreview,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ export const POST = async (
|
||||
})
|
||||
|
||||
res.json({
|
||||
order_change: result,
|
||||
order_change: result as unknown as HttpTypes.AdminOrderChange,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,11 +2,7 @@ import {
|
||||
deleteReturnReasonsWorkflow,
|
||||
updateReturnReasonsWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import {
|
||||
AdminReturnReasonResponse,
|
||||
HttpTypes,
|
||||
UpdateOrderReturnReasonDTO,
|
||||
} from "@medusajs/types"
|
||||
import { AdminReturnReasonResponse, HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
MedusaError,
|
||||
@@ -40,7 +36,7 @@ export const GET = async (
|
||||
}
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<UpdateOrderReturnReasonDTO>,
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminUpdateReturnReason>,
|
||||
res: MedusaResponse<AdminReturnReasonResponse>
|
||||
) => {
|
||||
const workflow = updateReturnReasonsWorkflow(req.scope)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createReturnReasonsWorkflow } from "@medusajs/core-flows"
|
||||
import { CreateOrderReturnReasonDTO, HttpTypes } from "@medusajs/types"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
@@ -36,7 +36,7 @@ export const GET = async (
|
||||
}
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<CreateOrderReturnReasonDTO>,
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreateReturnReason>,
|
||||
res: MedusaResponse<HttpTypes.AdminReturnReasonResponse>
|
||||
) => {
|
||||
const workflow = createReturnReasonsWorkflow(req.scope)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { updateTaxLinesWorkflow } from "@medusajs/core-flows"
|
||||
import { MedusaRequest, MedusaResponse } from "../../../../../types/routing"
|
||||
import { refetchCart } from "../../helpers"
|
||||
import { StoreCalculateCartTaxesType } from "../../validators"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
|
||||
export const POST = async (
|
||||
req: MedusaRequest<StoreCalculateCartTaxesType>,
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse<HttpTypes.StoreCartResponse>
|
||||
) => {
|
||||
const workflow = updateTaxLinesWorkflow(req.scope)
|
||||
|
||||
@@ -25,6 +25,7 @@ export const defaultStoreCartFields = [
|
||||
"original_shipping_tax_total",
|
||||
"original_shipping_subtotal",
|
||||
"original_shipping_total",
|
||||
"metadata",
|
||||
"promotions.id",
|
||||
"promotions.code",
|
||||
"promotions.is_automatic",
|
||||
|
||||
Reference in New Issue
Block a user