chore(medusa,types): [9] Add request types to API routes (#8566)
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
import { AdminPaymentCollection } from "../payment/admin"
|
||||
import {
|
||||
BaseOrder,
|
||||
BaseOrderAddress,
|
||||
BaseOrderChange,
|
||||
BaseOrderChangeAction,
|
||||
BaseOrderFilters,
|
||||
BaseOrderLineItem,
|
||||
BaseOrderShippingMethod,
|
||||
} from "./common"
|
||||
|
||||
export interface AdminOrder extends BaseOrder {
|
||||
payment_collections: AdminPaymentCollection[]
|
||||
}
|
||||
|
||||
export interface AdminOrderLineItem extends BaseOrderLineItem {}
|
||||
export interface AdminOrderFilters extends BaseOrderFilters {}
|
||||
export interface AdminOrderAddress extends BaseOrderAddress {}
|
||||
export interface AdminOrderShippingMethod extends BaseOrderShippingMethod {}
|
||||
|
||||
export interface AdminOrderResponse {
|
||||
order: AdminOrder
|
||||
}
|
||||
|
||||
export interface AdminOrdersResponse {
|
||||
orders: AdminOrder[]
|
||||
}
|
||||
|
||||
export interface AdminCreateOrderFulfillment {
|
||||
items: { id: string; quantity: number }[]
|
||||
location_id?: string
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface AdminCreateOrderShipment {
|
||||
items: { id: string; quantity: number }[]
|
||||
labels?: {
|
||||
tracking_number: string
|
||||
tracking_url: string
|
||||
label_url: string
|
||||
}[]
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface AdminCancelOrderFulfillment {
|
||||
no_notification?: boolean
|
||||
}
|
||||
|
||||
// Order Preview
|
||||
|
||||
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[]
|
||||
})[]
|
||||
}
|
||||
|
||||
export interface AdminOrderPreviewResponse {
|
||||
order: AdminOrderPreview
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { AdminPaymentCollection } from "../../payment/admin"
|
||||
import {
|
||||
BaseOrder,
|
||||
BaseOrderAddress,
|
||||
BaseOrderChange,
|
||||
BaseOrderChangeAction,
|
||||
BaseOrderLineItem,
|
||||
BaseOrderShippingMethod,
|
||||
} from "../common"
|
||||
|
||||
export interface AdminOrder extends BaseOrder {
|
||||
payment_collections: AdminPaymentCollection[]
|
||||
}
|
||||
|
||||
export interface AdminOrderLineItem extends BaseOrderLineItem {}
|
||||
export interface AdminOrderAddress extends BaseOrderAddress {}
|
||||
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[]
|
||||
})[]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./entities"
|
||||
export * from "./payload"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,21 @@
|
||||
export interface AdminCreateOrderFulfillment {
|
||||
items: { id: string; quantity: number }[]
|
||||
location_id?: string
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface AdminCreateOrderShipment {
|
||||
items: { id: string; quantity: number }[]
|
||||
labels?: {
|
||||
tracking_number: string
|
||||
tracking_url: string
|
||||
label_url: string
|
||||
}[]
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface AdminCancelOrderFulfillment {
|
||||
no_notification?: boolean
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { BaseOrderFilters } from "../common";
|
||||
|
||||
export interface AdminOrderFilters extends BaseOrderFilters {}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { AdminOrder, AdminOrderPreview } from "./entities"
|
||||
|
||||
export interface AdminOrderResponse {
|
||||
order: AdminOrder
|
||||
}
|
||||
|
||||
export type AdminOrderListResponse = PaginatedResponse<{
|
||||
orders: AdminOrder[]
|
||||
}>
|
||||
|
||||
export interface AdminOrderPreviewResponse {
|
||||
order: AdminOrderPreview
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import {
|
||||
BasePayment,
|
||||
BasePaymentCollection,
|
||||
BasePaymentCollectionFilters,
|
||||
BasePaymentFilters,
|
||||
BasePaymentProvider,
|
||||
BasePaymentProviderFilters,
|
||||
BasePaymentSession,
|
||||
BasePaymentSessionFilters,
|
||||
BaseRefund,
|
||||
RefundReason,
|
||||
} from "./common"
|
||||
|
||||
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 AdminPaymentProviderFilters
|
||||
extends BasePaymentProviderFilters {
|
||||
is_enabled?: boolean
|
||||
}
|
||||
export interface AdminPaymentCollectionFilters
|
||||
extends BasePaymentCollectionFilters {}
|
||||
export interface AdminPaymentSessionFilters extends BasePaymentSessionFilters {}
|
||||
|
||||
export interface AdminCapturePayment {
|
||||
amount?: number
|
||||
}
|
||||
|
||||
export interface AdminRefundPayment {
|
||||
amount?: number
|
||||
refund_reason_id?: string | null
|
||||
note?: string | null
|
||||
}
|
||||
|
||||
export interface AdminPaymentResponse {
|
||||
payment: AdminPayment
|
||||
}
|
||||
|
||||
export interface AdminPaymentsResponse {
|
||||
payments: AdminPayment[]
|
||||
}
|
||||
|
||||
export interface AdminPaymentFilters extends BasePaymentFilters {}
|
||||
|
||||
// Refund
|
||||
|
||||
export interface AdminRefund extends BaseRefund {}
|
||||
export interface RefundFilters extends BaseFilterable<AdminRefund> {
|
||||
id?: string | string[]
|
||||
}
|
||||
|
||||
export interface AdminRefundResponse {
|
||||
refund_reason: AdminRefund
|
||||
}
|
||||
|
||||
export interface AdminRefundsResponse {
|
||||
refund_reasons: AdminRefund[]
|
||||
}
|
||||
|
||||
// Refund reason
|
||||
|
||||
export interface AdminRefundReason extends RefundReason {}
|
||||
export interface RefundReasonFilters extends BaseFilterable<AdminRefundReason> {
|
||||
id?: string | string[]
|
||||
}
|
||||
|
||||
export interface RefundReasonResponse {
|
||||
refund_reason: AdminRefundReason
|
||||
}
|
||||
|
||||
export interface RefundReasonsResponse {
|
||||
refund_reasons: AdminRefundReason[]
|
||||
}
|
||||
|
||||
export interface AdminCreateRefundReason {
|
||||
label: string
|
||||
description?: string
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
BasePayment,
|
||||
BasePaymentCollection,
|
||||
BasePaymentProvider,
|
||||
BasePaymentSession,
|
||||
BaseRefund,
|
||||
RefundReason,
|
||||
} from "../common"
|
||||
|
||||
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 AdminRefund extends BaseRefund {}
|
||||
export interface AdminRefundReason extends RefundReason {}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,14 @@
|
||||
export interface AdminCapturePayment {
|
||||
amount?: number
|
||||
}
|
||||
|
||||
export interface AdminRefundPayment {
|
||||
amount?: number
|
||||
refund_reason_id?: string | null
|
||||
note?: string | null
|
||||
}
|
||||
|
||||
export interface AdminCreateRefundReason {
|
||||
label: string
|
||||
description?: string
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { BaseFilterable } from "../../../dal"
|
||||
import {
|
||||
BasePaymentCollectionFilters,
|
||||
BasePaymentFilters,
|
||||
BasePaymentProviderFilters,
|
||||
BasePaymentSessionFilters,
|
||||
} from "../common"
|
||||
import { AdminRefund, AdminRefundReason } from "./entities"
|
||||
|
||||
export interface AdminPaymentProviderFilters
|
||||
extends BasePaymentProviderFilters {
|
||||
is_enabled?: boolean
|
||||
}
|
||||
export interface AdminPaymentCollectionFilters
|
||||
extends BasePaymentCollectionFilters {}
|
||||
export interface AdminPaymentSessionFilters extends BasePaymentSessionFilters {}
|
||||
|
||||
export interface AdminPaymentFilters extends BasePaymentFilters {}
|
||||
|
||||
export interface RefundFilters extends BaseFilterable<AdminRefund> {
|
||||
id?: string | string[]
|
||||
}
|
||||
export interface RefundReasonFilters extends BaseFilterable<AdminRefundReason> {
|
||||
id?: string | string[]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { AdminPayment, AdminPaymentProvider, AdminRefund, AdminRefundReason } from "./entities"
|
||||
|
||||
export interface AdminPaymentResponse {
|
||||
payment: AdminPayment
|
||||
}
|
||||
|
||||
export type AdminPaymentsResponse = PaginatedResponse<{
|
||||
payments: AdminPayment[]
|
||||
}>
|
||||
|
||||
export interface AdminRefundResponse {
|
||||
refund_reason: AdminRefund
|
||||
}
|
||||
|
||||
export type AdminRefundsResponse = PaginatedResponse<{
|
||||
refund_reasons: AdminRefund[]
|
||||
}>
|
||||
|
||||
export interface RefundReasonResponse {
|
||||
refund_reason: AdminRefundReason
|
||||
}
|
||||
|
||||
export type RefundReasonsResponse = PaginatedResponse<{
|
||||
refund_reasons: AdminRefundReason[]
|
||||
}>
|
||||
|
||||
export type AdminPaymentProviderListResponse = PaginatedResponse<{
|
||||
payment_providers: AdminPaymentProvider[]
|
||||
}>
|
||||
Reference in New Issue
Block a user