feat(sdk): Type all store endpoints in the SDK (#7375)
The typings will need further refinement, but we can do that once closer to a public release
This commit is contained in:
1 parent
f57dc98c7a
commit
2371626198
16 files changed
+1447
-302
No files matched your search
@@ -3,6 +3,7 @@ import {
|
|||||||
HttpTypes,
|
HttpTypes,
|
||||||
PaginatedResponse,
|
PaginatedResponse,
|
||||||
SelectParams,
|
SelectParams,
|
||||||
|
DeleteResponse,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { Client } from "../client"
|
import { Client } from "../client"
|
||||||
import { ClientHeaders } from "../types"
|
import { ClientHeaders } from "../types"
|
||||||
@@ -47,7 +48,7 @@ export class Store {
|
|||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<
|
return this.client.fetch<
|
||||||
PaginatedResponse<{ collections: HttpTypes.StoreCollection }>
|
PaginatedResponse<{ collections: HttpTypes.StoreCollection[] }>
|
||||||
>(`/store/collections`, {
|
>(`/store/collections`, {
|
||||||
query,
|
query,
|
||||||
headers,
|
headers,
|
||||||
@@ -74,7 +75,9 @@ export class Store {
|
|||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<
|
return this.client.fetch<
|
||||||
PaginatedResponse<{ categories: HttpTypes.StoreProductCategory }>
|
PaginatedResponse<{
|
||||||
|
product_categories: HttpTypes.StoreProductCategory[]
|
||||||
|
}>
|
||||||
>(`/store/product-categories`, {
|
>(`/store/product-categories`, {
|
||||||
query,
|
query,
|
||||||
headers,
|
headers,
|
||||||
@@ -85,13 +88,12 @@ export class Store {
|
|||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<{ category: HttpTypes.StoreProductCategory }>(
|
return this.client.fetch<{
|
||||||
`/store/product-categories/${id}`,
|
product_category: HttpTypes.StoreProductCategory
|
||||||
{
|
}>(`/store/product-categories/${id}`, {
|
||||||
query,
|
query,
|
||||||
headers,
|
headers,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +103,7 @@ export class Store {
|
|||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<
|
return this.client.fetch<
|
||||||
PaginatedResponse<{ products: HttpTypes.StoreProduct }>
|
PaginatedResponse<{ products: HttpTypes.StoreProduct[] }>
|
||||||
>(`/store/products`, {
|
>(`/store/products`, {
|
||||||
query,
|
query,
|
||||||
headers,
|
headers,
|
||||||
@@ -122,26 +124,13 @@ export class Store {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
public order = {
|
|
||||||
retrieve: async (
|
|
||||||
id: string,
|
|
||||||
query?: SelectParams,
|
|
||||||
headers?: ClientHeaders
|
|
||||||
) => {
|
|
||||||
return this.client.fetch<any>(`/store/orders/${id}`, {
|
|
||||||
query,
|
|
||||||
headers,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
public cart = {
|
public cart = {
|
||||||
create: async (
|
create: async (
|
||||||
body: any,
|
body: HttpTypes.StoreCreateCart,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts`, {
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(`/store/carts`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
body,
|
body,
|
||||||
@@ -150,48 +139,57 @@ export class Store {
|
|||||||
},
|
},
|
||||||
update: async (
|
update: async (
|
||||||
id: string,
|
id: string,
|
||||||
body: any,
|
body: HttpTypes.StoreUpdateCart,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts/${id}`, {
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(
|
||||||
method: "POST",
|
`/store/carts/${id}`,
|
||||||
headers,
|
{
|
||||||
body,
|
method: "POST",
|
||||||
query,
|
headers,
|
||||||
})
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
retrieve: async (
|
retrieve: async (
|
||||||
id: string,
|
id: string,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts/${id}`, {
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(
|
||||||
headers,
|
`/store/carts/${id}`,
|
||||||
query,
|
{
|
||||||
})
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
createLineItem: async (
|
createLineItem: async (
|
||||||
cartId: string,
|
cartId: string,
|
||||||
body: any,
|
body: HttpTypes.StoreAddCartLineItem,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts/${cartId}/line-items`, {
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(
|
||||||
method: "POST",
|
`/store/carts/${cartId}/line-items`,
|
||||||
headers,
|
{
|
||||||
body,
|
method: "POST",
|
||||||
query,
|
headers,
|
||||||
})
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
updateLineItem: async (
|
updateLineItem: async (
|
||||||
cartId: string,
|
cartId: string,
|
||||||
lineItemId: string,
|
lineItemId: string,
|
||||||
body: any,
|
body: HttpTypes.StoreUpdateCartLineItem,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(
|
||||||
`/store/carts/${cartId}/line-items/${lineItemId}`,
|
`/store/carts/${cartId}/line-items/${lineItemId}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -206,33 +204,46 @@ export class Store {
|
|||||||
lineItemId: string,
|
lineItemId: string,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(
|
return this.client.fetch<
|
||||||
`/store/carts/${cartId}/line-items/${lineItemId}`,
|
DeleteResponse<"line-item", HttpTypes.StoreCart>
|
||||||
{
|
>(`/store/carts/${cartId}/line-items/${lineItemId}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers,
|
headers,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
},
|
},
|
||||||
addShippingMethod: async (
|
addShippingMethod: async (
|
||||||
cartId: string,
|
cartId: string,
|
||||||
body: any,
|
body: HttpTypes.StoreAddCartShippingMethods,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts/${cartId}/shipping-methods`, {
|
return this.client.fetch<{ cart: HttpTypes.StoreCart }>(
|
||||||
method: "POST",
|
`/store/carts/${cartId}/shipping-methods`,
|
||||||
headers,
|
{
|
||||||
body,
|
method: "POST",
|
||||||
query,
|
headers,
|
||||||
})
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
complete: async (
|
complete: async (
|
||||||
cartId: string,
|
cartId: string,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/carts/${cartId}/complete`, {
|
return this.client.fetch<
|
||||||
|
| { type: "order"; order: HttpTypes.StoreOrder }
|
||||||
|
| {
|
||||||
|
type: "cart"
|
||||||
|
cart: HttpTypes.StoreCart
|
||||||
|
error: {
|
||||||
|
message: string
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>(`/store/carts/${cartId}/complete`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
query,
|
query,
|
||||||
@@ -241,30 +252,33 @@ export class Store {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fulfillment = {
|
public fulfillment = {
|
||||||
|
// TODO: Finalize typings for list options
|
||||||
listCartOptions: async (
|
listCartOptions: async (
|
||||||
query?: Record<string, any>,
|
query?: FindParams & { cart_id: string },
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/shipping-options`, {
|
return this.client.fetch<any>(`/store/shipping-options`, {
|
||||||
query,
|
|
||||||
headers,
|
headers,
|
||||||
|
query,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
public payment = {
|
public payment = {
|
||||||
listPaymentProviders: async (
|
listPaymentProviders: async (
|
||||||
query?: Record<string, any>,
|
query?: FindParams & HttpTypes.StorePaymentProviderFilters,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) => {
|
) => {
|
||||||
return this.client.fetch<any>(`/store/payment-providers`, {
|
return this.client.fetch<{
|
||||||
query,
|
payment_providers: HttpTypes.StorePaymentProvider[]
|
||||||
|
}>(`/store/payment-providers`, {
|
||||||
headers,
|
headers,
|
||||||
|
query,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
initiatePaymentSession: async (
|
initiatePaymentSession: async (
|
||||||
cart: any,
|
cart: HttpTypes.StoreCart,
|
||||||
body: Record<string, any>,
|
body: Record<string, any>,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
@@ -278,7 +292,9 @@ export class Store {
|
|||||||
amount: cart.total,
|
amount: cart.total,
|
||||||
}
|
}
|
||||||
paymentCollectionId = (
|
paymentCollectionId = (
|
||||||
await this.client.fetch<any>(`/store/payment-collections`, {
|
await this.client.fetch<{
|
||||||
|
payment_collection: HttpTypes.StorePaymentCollection
|
||||||
|
}>(`/store/payment-collections`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
body: collectionBody,
|
body: collectionBody,
|
||||||
@@ -286,12 +302,27 @@ export class Store {
|
|||||||
).payment_collection.id
|
).payment_collection.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.client.fetch<any>(
|
return this.client.fetch<{
|
||||||
`/store/payment-collections/${paymentCollectionId}/payment-sessions`,
|
payment_collection: HttpTypes.StorePaymentCollection
|
||||||
|
}>(`/store/payment-collections/${paymentCollectionId}/payment-sessions`, {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
public order = {
|
||||||
|
retrieve: async (
|
||||||
|
id: string,
|
||||||
|
query?: SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) => {
|
||||||
|
return this.client.fetch<{ order: HttpTypes.StoreOrder }>(
|
||||||
|
`/store/orders/${id}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
|
||||||
headers,
|
headers,
|
||||||
body,
|
|
||||||
query,
|
query,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ export type Config = {
|
|||||||
|
|
||||||
export type FetchParams = Parameters<typeof fetch>
|
export type FetchParams = Parameters<typeof fetch>
|
||||||
|
|
||||||
export type ClientHeaders = Record<string, string>
|
export type ClientHeaders =
|
||||||
|
// The `tags` header is specifically added for nextJS, as they follow a non-standard header format
|
||||||
|
Record<string, string | { tags: string[] }>
|
||||||
|
|
||||||
export type FetchInput = FetchParams[0]
|
export type FetchInput = FetchParams[0]
|
||||||
|
|
||||||
|
|||||||
@@ -1260,135 +1260,3 @@ export interface FilterableShippingMethodTaxLineProps
|
|||||||
*/
|
*/
|
||||||
shipping_method?: FilterableShippingMethodProps
|
shipping_method?: FilterableShippingMethodProps
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Remove this in favor of CartDTO, when module is released
|
|
||||||
*
|
|
||||||
* @deprecated Use CartDTO instead
|
|
||||||
*/
|
|
||||||
export type legacy_CartDTO = {
|
|
||||||
/**
|
|
||||||
* The ID of the cart.
|
|
||||||
*/
|
|
||||||
id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The email of the cart.
|
|
||||||
*/
|
|
||||||
email?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated billing address's ID.
|
|
||||||
*/
|
|
||||||
billing_address_id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated shipping address's ID.
|
|
||||||
*/
|
|
||||||
shipping_address_id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated region's ID.
|
|
||||||
*/
|
|
||||||
region_id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated customer's ID.
|
|
||||||
*/
|
|
||||||
customer_id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated payment's ID.
|
|
||||||
*/
|
|
||||||
payment_id?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated date.
|
|
||||||
*/
|
|
||||||
completed_at?: Date
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated date.
|
|
||||||
*/
|
|
||||||
payment_authorized_at?: Date
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The idempotency key of the cart.
|
|
||||||
*/
|
|
||||||
idempotency_key?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The context of the cart.
|
|
||||||
*/
|
|
||||||
context?: Record<string, unknown>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holds custom data in key-value pairs.
|
|
||||||
*/
|
|
||||||
metadata?: Record<string, unknown>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The associated sales channel's ID.
|
|
||||||
*/
|
|
||||||
sales_channel_id?: string | null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The shipping total of the cart.
|
|
||||||
*/
|
|
||||||
shipping_total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The discount total of the cart.
|
|
||||||
*/
|
|
||||||
discount_total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The raw discount total of the cart.
|
|
||||||
*/
|
|
||||||
raw_discount_total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The item tax total of the cart.
|
|
||||||
*/
|
|
||||||
item_tax_total?: number | null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The shipping tax total of the cart.
|
|
||||||
*/
|
|
||||||
shipping_tax_total?: number | null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The tax total of the cart.
|
|
||||||
*/
|
|
||||||
tax_total?: number | null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The refunded total of the cart.
|
|
||||||
*/
|
|
||||||
refunded_total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The total of the cart.
|
|
||||||
*/
|
|
||||||
total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The subtotal of the cart.
|
|
||||||
*/
|
|
||||||
subtotal?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The refundable amount of the cart.
|
|
||||||
*/
|
|
||||||
refundable_amount?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The gift card total of the cart.
|
|
||||||
*/
|
|
||||||
gift_card_total?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The gift card tax total of the cart.
|
|
||||||
*/
|
|
||||||
gift_card_tax_total?: number
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,776 @@
|
|||||||
|
import { BigNumberValue } from "../../totals"
|
||||||
|
|
||||||
|
export interface BaseCart {
|
||||||
|
/**
|
||||||
|
* The ID of the cart.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the region the cart belongs to.
|
||||||
|
*/
|
||||||
|
region_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated customer
|
||||||
|
*/
|
||||||
|
customer_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the sales channel the cart belongs to.
|
||||||
|
*/
|
||||||
|
sales_channel_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The email of the customer that owns the cart.
|
||||||
|
*/
|
||||||
|
email?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currency of the cart
|
||||||
|
*/
|
||||||
|
currency_code: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated shipping address.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
shipping_address?: BaseCartAddress
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated billing address.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
billing_address?: BaseCartAddress
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated line items.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
items?: BaseCartLineItem[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated shipping methods
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
shipping_methods?: BaseCartShippingMethod[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds custom data in key-value pairs.
|
||||||
|
*/
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the cart was created.
|
||||||
|
*/
|
||||||
|
created_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the cart was updated.
|
||||||
|
*/
|
||||||
|
updated_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original item total of the cart.
|
||||||
|
*/
|
||||||
|
original_item_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original item subtotal of the cart.
|
||||||
|
*/
|
||||||
|
original_item_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original item tax total of the cart.
|
||||||
|
*/
|
||||||
|
original_item_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item total of the cart.
|
||||||
|
*/
|
||||||
|
item_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item subtotal of the cart.
|
||||||
|
*/
|
||||||
|
item_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item tax total of the cart.
|
||||||
|
*/
|
||||||
|
item_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original total of the cart.
|
||||||
|
*/
|
||||||
|
original_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original subtotal of the cart.
|
||||||
|
*/
|
||||||
|
original_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original tax total of the cart.
|
||||||
|
*/
|
||||||
|
original_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total of the cart.
|
||||||
|
*/
|
||||||
|
total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtotal of the cart. (Excluding taxes)
|
||||||
|
*/
|
||||||
|
subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tax total of the cart.
|
||||||
|
*/
|
||||||
|
tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount total of the cart.
|
||||||
|
*/
|
||||||
|
discount_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount tax total of the cart.
|
||||||
|
*/
|
||||||
|
discount_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The gift card total of the cart.
|
||||||
|
*/
|
||||||
|
gift_card_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The gift card tax total of the cart.
|
||||||
|
*/
|
||||||
|
gift_card_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The shipping total of the cart.
|
||||||
|
*/
|
||||||
|
shipping_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The shipping subtotal of the cart.
|
||||||
|
*/
|
||||||
|
shipping_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The shipping tax total of the cart.
|
||||||
|
*/
|
||||||
|
shipping_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original shipping total of the cart.
|
||||||
|
*/
|
||||||
|
original_shipping_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original shipping subtotal of the cart.
|
||||||
|
*/
|
||||||
|
original_shipping_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original shipping tax total of the cart.
|
||||||
|
*/
|
||||||
|
original_shipping_tax_total: BigNumberValue
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseCartAddress {
|
||||||
|
/**
|
||||||
|
* The ID of the address.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The customer ID of the address.
|
||||||
|
*/
|
||||||
|
customer_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first name of the address.
|
||||||
|
*/
|
||||||
|
first_name?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last name of the address.
|
||||||
|
*/
|
||||||
|
last_name?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The phone number of the address.
|
||||||
|
*/
|
||||||
|
phone?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The company of the address.
|
||||||
|
*/
|
||||||
|
company?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first address line of the address.
|
||||||
|
*/
|
||||||
|
address_1?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The second address line of the address.
|
||||||
|
*/
|
||||||
|
address_2?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The city of the address.
|
||||||
|
*/
|
||||||
|
city?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The country code of the address.
|
||||||
|
*/
|
||||||
|
country_code?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The province/state of the address.
|
||||||
|
*/
|
||||||
|
province?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The postal code of the address.
|
||||||
|
*/
|
||||||
|
postal_code?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds custom data in key-value pairs.
|
||||||
|
*/
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the address was created.
|
||||||
|
*/
|
||||||
|
created_at: Date | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the address was updated.
|
||||||
|
*/
|
||||||
|
updated_at: Date | string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cart shipping method details.
|
||||||
|
*/
|
||||||
|
export interface BaseCartShippingMethod {
|
||||||
|
/**
|
||||||
|
* The ID of the shipping method.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated cart.
|
||||||
|
*/
|
||||||
|
cart_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the shipping method.
|
||||||
|
*/
|
||||||
|
name: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of the shipping method.
|
||||||
|
*/
|
||||||
|
description?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The price of the shipping method.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the shipping method price is tax inclusive.
|
||||||
|
*/
|
||||||
|
is_tax_inclusive: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the shipping option the method was created from.
|
||||||
|
*/
|
||||||
|
shipping_option_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional data needed for fulfillment.
|
||||||
|
*/
|
||||||
|
data?: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds custom data in key-value pairs.
|
||||||
|
*/
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated tax lines.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
tax_lines?: BaseShippingMethodTaxLine[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated adjustments.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
adjustments?: BaseShippingMethodAdjustment[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the shipping method was created.
|
||||||
|
*/
|
||||||
|
created_at: Date | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the shipping method was updated.
|
||||||
|
*/
|
||||||
|
updated_at: Date | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
original_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original subtotal of the cart shipping method.
|
||||||
|
*/
|
||||||
|
original_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original tax total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
original_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtotal of the cart shipping method.
|
||||||
|
*/
|
||||||
|
subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tax total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
discount_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount tax total of the cart shipping method.
|
||||||
|
*/
|
||||||
|
discount_tax_total: BigNumberValue
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cart line item details.
|
||||||
|
*/
|
||||||
|
export interface BaseCartLineItem extends BaseCartLineItemTotals {
|
||||||
|
/**
|
||||||
|
* The ID of the line item.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the line item.
|
||||||
|
*/
|
||||||
|
title: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtitle of the line item.
|
||||||
|
*/
|
||||||
|
subtitle?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The line item's thumbnail.
|
||||||
|
*/
|
||||||
|
thumbnail?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The line item's quantity in the cart.
|
||||||
|
*/
|
||||||
|
quantity: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated product.
|
||||||
|
*/
|
||||||
|
product_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the associated product.
|
||||||
|
*/
|
||||||
|
product_title?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of the associated product.
|
||||||
|
*/
|
||||||
|
product_description?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtitle of the associated product.
|
||||||
|
*/
|
||||||
|
product_subtitle?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the associated product.
|
||||||
|
*/
|
||||||
|
product_type?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The collection of the associated product.
|
||||||
|
*/
|
||||||
|
product_collection?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The handle of the associated product.
|
||||||
|
*/
|
||||||
|
product_handle?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated variant's ID of the line item.
|
||||||
|
*/
|
||||||
|
variant_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sku of the associated variant.
|
||||||
|
*/
|
||||||
|
variant_sku?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The barcode of the associated variant.
|
||||||
|
*/
|
||||||
|
variant_barcode?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the associated variant.
|
||||||
|
*/
|
||||||
|
variant_title?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The option values of the associated variant.
|
||||||
|
*/
|
||||||
|
variant_option_values?: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the line item requires shipping.
|
||||||
|
*/
|
||||||
|
requires_shipping: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the line item is discountable.
|
||||||
|
*/
|
||||||
|
is_discountable: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the line item price is tax inclusive.
|
||||||
|
*/
|
||||||
|
is_tax_inclusive: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calculated price of the line item.
|
||||||
|
*/
|
||||||
|
compare_at_unit_price?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unit price of the item.
|
||||||
|
*/
|
||||||
|
unit_price: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated tax lines.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
tax_lines?: BaseLineItemTaxLine[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated adjustments.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
adjustments?: BaseLineItemAdjustment[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated cart.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
cart: BaseCart
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated cart.
|
||||||
|
*/
|
||||||
|
cart_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds custom data in key-value pairs.
|
||||||
|
*/
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the line item was created.
|
||||||
|
*/
|
||||||
|
created_at?: Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the line item was updated.
|
||||||
|
*/
|
||||||
|
updated_at?: Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the line item was deleted.
|
||||||
|
*/
|
||||||
|
deleted_at?: Date
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cart line item totals details.
|
||||||
|
*/
|
||||||
|
export interface BaseCartLineItemTotals {
|
||||||
|
/**
|
||||||
|
* The original total of the cart line item.
|
||||||
|
*/
|
||||||
|
original_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original subtotal of the cart line item.
|
||||||
|
*/
|
||||||
|
original_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The original tax total of the cart line item.
|
||||||
|
*/
|
||||||
|
original_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item total of the cart line item.
|
||||||
|
*/
|
||||||
|
item_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item subtotal of the cart line item.
|
||||||
|
*/
|
||||||
|
item_subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item tax total of the cart line item.
|
||||||
|
*/
|
||||||
|
item_tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total of the cart line item.
|
||||||
|
*/
|
||||||
|
total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtotal of the cart line item.
|
||||||
|
*/
|
||||||
|
subtotal: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tax total of the cart line item.
|
||||||
|
*/
|
||||||
|
tax_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount total of the cart line item.
|
||||||
|
*/
|
||||||
|
discount_total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discount tax total of the cart line item.
|
||||||
|
*/
|
||||||
|
discount_tax_total: BigNumberValue
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The adjustment line details.
|
||||||
|
*/
|
||||||
|
export interface BaseAdjustmentLine {
|
||||||
|
/**
|
||||||
|
* The ID of the adjustment line
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The code of the promotion that lead to
|
||||||
|
* this adjustment.
|
||||||
|
*/
|
||||||
|
code?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount to adjust the original amount with.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated cart.
|
||||||
|
*/
|
||||||
|
cart_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of the adjustment line.
|
||||||
|
*/
|
||||||
|
description?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated promotion.
|
||||||
|
*/
|
||||||
|
promotion_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated provider.
|
||||||
|
*/
|
||||||
|
provider_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the adjustment line was created.
|
||||||
|
*/
|
||||||
|
created_at: Date | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the adjustment line was updated.
|
||||||
|
*/
|
||||||
|
updated_at: Date | string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The shipping method adjustment details.
|
||||||
|
*/
|
||||||
|
export interface BaseShippingMethodAdjustment extends BaseAdjustmentLine {
|
||||||
|
/**
|
||||||
|
* The associated shipping method.
|
||||||
|
*/
|
||||||
|
shipping_method: BaseCartShippingMethod
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated shipping method.
|
||||||
|
*/
|
||||||
|
shipping_method_id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The line item adjustment details.
|
||||||
|
*/
|
||||||
|
export interface BaseLineItemAdjustment extends BaseAdjustmentLine {
|
||||||
|
/**
|
||||||
|
* The associated line item.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
item: BaseCartLineItem
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated line item.
|
||||||
|
*/
|
||||||
|
item_id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tax line details.
|
||||||
|
*/
|
||||||
|
export interface BaseTaxLine {
|
||||||
|
/**
|
||||||
|
* The ID of the tax line
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of the tax line
|
||||||
|
*/
|
||||||
|
description?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated tax rate.
|
||||||
|
*/
|
||||||
|
tax_rate_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The code of the tax line.
|
||||||
|
*/
|
||||||
|
code: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rate of the tax line.
|
||||||
|
*/
|
||||||
|
rate: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated provider.
|
||||||
|
*/
|
||||||
|
provider_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the tax line was created.
|
||||||
|
*/
|
||||||
|
created_at: Date | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the tax line was updated.
|
||||||
|
*/
|
||||||
|
updated_at: Date | string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The shipping method tax line details.
|
||||||
|
*/
|
||||||
|
export interface BaseShippingMethodTaxLine extends BaseTaxLine {
|
||||||
|
/**
|
||||||
|
* The associated shipping method.
|
||||||
|
*/
|
||||||
|
shipping_method: BaseCartShippingMethod
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated shipping method.
|
||||||
|
*/
|
||||||
|
shipping_method_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total tax relative to the shipping method.
|
||||||
|
*/
|
||||||
|
total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtotal tax relative to the shipping method.
|
||||||
|
*/
|
||||||
|
subtotal: BigNumberValue
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The line item tax line details.
|
||||||
|
*/
|
||||||
|
export interface BaseLineItemTaxLine extends BaseTaxLine {
|
||||||
|
/**
|
||||||
|
* The associated line item.
|
||||||
|
*/
|
||||||
|
item: BaseCartLineItem
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated line item.
|
||||||
|
*/
|
||||||
|
item_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total tax relative to the item.
|
||||||
|
*/
|
||||||
|
total: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subtotal tax relative to the item.
|
||||||
|
*/
|
||||||
|
subtotal: BigNumberValue
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./store"
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import {
|
||||||
|
BaseCart,
|
||||||
|
BaseCartAddress,
|
||||||
|
BaseCartLineItem,
|
||||||
|
BaseCartShippingMethod,
|
||||||
|
} from "./common"
|
||||||
|
|
||||||
|
export interface StoreCart extends BaseCart {}
|
||||||
|
export interface StoreCartLineItem extends BaseCartLineItem {}
|
||||||
|
export interface StoreCartAddress extends BaseCartAddress {}
|
||||||
|
export interface StoreCartShippingMethod extends BaseCartShippingMethod {}
|
||||||
|
|
||||||
|
export interface StoreCreateCart {
|
||||||
|
region_id?: string
|
||||||
|
shipping_address?: StoreCartAddress
|
||||||
|
billing_address?: StoreCartAddress
|
||||||
|
email?: string
|
||||||
|
currency_code?: string
|
||||||
|
items?: StoreCartLineItem[]
|
||||||
|
sales_channel_id?: string
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoreUpdateCart {
|
||||||
|
region_id?: string
|
||||||
|
shipping_address?: StoreCartAddress
|
||||||
|
billing_address?: StoreCartAddress
|
||||||
|
email?: string
|
||||||
|
sales_channel_id?: string
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
promo_codes?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoreAddCartLineItem {
|
||||||
|
variant_id: string
|
||||||
|
quantity: number
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoreUpdateCartLineItem {
|
||||||
|
quantity: number
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoreAddCartShippingMethods {
|
||||||
|
option_id: string
|
||||||
|
data?: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoreCompleteCart {
|
||||||
|
idempotency_key?: string
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ export * from "./product-category"
|
|||||||
export * from "./reservation"
|
export * from "./reservation"
|
||||||
export * from "./region"
|
export * from "./region"
|
||||||
export * from "./product"
|
export * from "./product"
|
||||||
|
export * from "./cart"
|
||||||
export * from "./payment"
|
export * from "./payment"
|
||||||
export * from "./collection"
|
export * from "./collection"
|
||||||
export * from "./common"
|
export * from "./common"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { BaseOrder } from "./common"
|
||||||
|
|
||||||
|
export interface AdminOrder extends BaseOrder {}
|
||||||
+34
-93
@@ -1,7 +1,4 @@
|
|||||||
import { BigNumberRawValue } from "../../../totals"
|
interface BaseOrderSummary {
|
||||||
import { PaginatedResponse } from "../../common"
|
|
||||||
|
|
||||||
interface OrderSummary {
|
|
||||||
total: number
|
total: number
|
||||||
subtotal: number
|
subtotal: number
|
||||||
total_tax: number
|
total_tax: number
|
||||||
@@ -24,7 +21,7 @@ interface OrderSummary {
|
|||||||
refunded_total: number
|
refunded_total: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderAdjustmentLine {
|
interface BaseOrderAdjustmentLine {
|
||||||
id: string
|
id: string
|
||||||
code?: string
|
code?: string
|
||||||
amount: number
|
amount: number
|
||||||
@@ -36,17 +33,17 @@ interface OrderAdjustmentLine {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderShippingMethodAdjustment extends OrderAdjustmentLine {
|
interface BaseOrderShippingMethodAdjustment extends BaseOrderAdjustmentLine {
|
||||||
shipping_method: OrderShippingMethod
|
shipping_method: BaseOrderShippingMethod
|
||||||
shipping_method_id: string
|
shipping_method_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderLineItemAdjustment extends OrderAdjustmentLine {
|
interface BaseOrderLineItemAdjustment extends BaseOrderAdjustmentLine {
|
||||||
item: OrderLineItem
|
item: BaseOrderLineItem
|
||||||
item_id: string
|
item_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderTaxLine {
|
interface BaseOrderTaxLine {
|
||||||
id: string
|
id: string
|
||||||
description?: string
|
description?: string
|
||||||
tax_rate_id?: string
|
tax_rate_id?: string
|
||||||
@@ -57,25 +54,21 @@ interface OrderTaxLine {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderShippingMethodTaxLine extends OrderTaxLine {
|
interface BaseOrderShippingMethodTaxLine extends BaseOrderTaxLine {
|
||||||
shipping_method: OrderShippingMethod
|
shipping_method: BaseOrderShippingMethod
|
||||||
shipping_method_id: string
|
shipping_method_id: string
|
||||||
total: number
|
total: number
|
||||||
subtotal: number
|
subtotal: number
|
||||||
raw_total?: BigNumberRawValue
|
|
||||||
raw_subtotal?: BigNumberRawValue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderLineItemTaxLine extends OrderTaxLine {
|
interface BaseOrderLineItemTaxLine extends BaseOrderTaxLine {
|
||||||
item: OrderLineItem
|
item: BaseOrderLineItem
|
||||||
item_id: string
|
item_id: string
|
||||||
total: number
|
total: number
|
||||||
subtotal: number
|
subtotal: number
|
||||||
raw_total?: BigNumberRawValue
|
|
||||||
raw_subtotal?: BigNumberRawValue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderAddress {
|
interface BaseOrderAddress {
|
||||||
id: string
|
id: string
|
||||||
customer_id?: string
|
customer_id?: string
|
||||||
first_name?: string
|
first_name?: string
|
||||||
@@ -93,24 +86,23 @@ interface OrderAddress {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderShippingMethod {
|
interface BaseOrderShippingMethod {
|
||||||
id: string
|
id: string
|
||||||
order_id: string
|
order_id: string
|
||||||
name: string
|
name: string
|
||||||
description?: string
|
description?: string
|
||||||
amount: number
|
amount: number
|
||||||
raw_amount?: BigNumberRawValue
|
|
||||||
is_tax_inclusive: boolean
|
is_tax_inclusive: boolean
|
||||||
shipping_option_id: string | null
|
shipping_option_id: string | null
|
||||||
data: Record<string, unknown> | null
|
data: Record<string, unknown> | null
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
tax_lines?: OrderShippingMethodTaxLine[]
|
tax_lines?: BaseOrderShippingMethodTaxLine[]
|
||||||
adjustments?: OrderShippingMethodAdjustment[]
|
adjustments?: BaseOrderShippingMethodAdjustment[]
|
||||||
created_at: Date | string
|
created_at: Date | string
|
||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderLineItem {
|
interface BaseOrderLineItem {
|
||||||
id: string
|
id: string
|
||||||
title: string
|
title: string
|
||||||
subtitle: string | null
|
subtitle: string | null
|
||||||
@@ -131,14 +123,11 @@ interface OrderLineItem {
|
|||||||
is_discountable: boolean
|
is_discountable: boolean
|
||||||
is_tax_inclusive: boolean
|
is_tax_inclusive: boolean
|
||||||
compare_at_unit_price?: number
|
compare_at_unit_price?: number
|
||||||
raw_compare_at_unit_price?: BigNumberRawValue
|
|
||||||
unit_price: number
|
unit_price: number
|
||||||
raw_unit_price?: BigNumberRawValue
|
|
||||||
quantity: number
|
quantity: number
|
||||||
raw_quantity?: BigNumberRawValue
|
tax_lines?: BaseOrderLineItemTaxLine[]
|
||||||
tax_lines?: OrderLineItemTaxLine[]
|
adjustments?: BaseOrderLineItemAdjustment[]
|
||||||
adjustments?: OrderLineItemAdjustment[]
|
detail: BaseOrderItemDetail
|
||||||
detail: OrderItemDetail
|
|
||||||
created_at: Date
|
created_at: Date
|
||||||
updated_at: Date
|
updated_at: Date
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
@@ -153,23 +142,12 @@ interface OrderLineItem {
|
|||||||
tax_total: number
|
tax_total: number
|
||||||
discount_total: number
|
discount_total: number
|
||||||
discount_tax_total: number
|
discount_tax_total: number
|
||||||
raw_original_total?: BigNumberRawValue
|
|
||||||
raw_original_subtotal?: BigNumberRawValue
|
|
||||||
raw_original_tax_total?: BigNumberRawValue
|
|
||||||
raw_item_total?: BigNumberRawValue
|
|
||||||
raw_item_subtotal?: BigNumberRawValue
|
|
||||||
raw_item_tax_total?: BigNumberRawValue
|
|
||||||
raw_total?: BigNumberRawValue
|
|
||||||
raw_subtotal?: BigNumberRawValue
|
|
||||||
raw_tax_total?: BigNumberRawValue
|
|
||||||
raw_discount_total?: BigNumberRawValue
|
|
||||||
raw_discount_tax_total?: BigNumberRawValue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderItemDetail {
|
interface BaseOrderItemDetail {
|
||||||
id: string
|
id: string
|
||||||
item_id: string
|
item_id: string
|
||||||
item: OrderLineItem
|
item: BaseOrderLineItem
|
||||||
quantity: number
|
quantity: number
|
||||||
fulfilled_quantity: number
|
fulfilled_quantity: number
|
||||||
shipped_quantity: number
|
shipped_quantity: number
|
||||||
@@ -177,22 +155,15 @@ interface OrderItemDetail {
|
|||||||
return_received_quantity: number
|
return_received_quantity: number
|
||||||
return_dismissed_quantity: number
|
return_dismissed_quantity: number
|
||||||
written_off_quantity: number
|
written_off_quantity: number
|
||||||
raw_quantity?: BigNumberRawValue
|
|
||||||
raw_fulfilled_quantity?: BigNumberRawValue
|
|
||||||
raw_shipped_quantity?: BigNumberRawValue
|
|
||||||
raw_return_requested_quantity?: BigNumberRawValue
|
|
||||||
raw_return_received_quantity?: BigNumberRawValue
|
|
||||||
raw_return_dismissed_quantity?: BigNumberRawValue
|
|
||||||
raw_written_off_quantity?: BigNumberRawValue
|
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
created_at: Date
|
created_at: Date
|
||||||
updated_at: Date
|
updated_at: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderChange {
|
interface BaseOrderChange {
|
||||||
id: string
|
id: string
|
||||||
order_id: string
|
order_id: string
|
||||||
actions: OrderChangeAction[]
|
actions: BaseOrderChangeAction[]
|
||||||
status: string
|
status: string
|
||||||
requested_by: string | null
|
requested_by: string | null
|
||||||
requested_at: Date | string | null
|
requested_at: Date | string | null
|
||||||
@@ -208,10 +179,10 @@ interface OrderChange {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderChangeAction {
|
interface BaseOrderChangeAction {
|
||||||
id: string
|
id: string
|
||||||
order_change_id: string | null
|
order_change_id: string | null
|
||||||
order_change: OrderChange | null
|
order_change: BaseOrderChange | null
|
||||||
order_id: string | null
|
order_id: string | null
|
||||||
reference: string
|
reference: string
|
||||||
reference_id: string
|
reference_id: string
|
||||||
@@ -222,11 +193,10 @@ interface OrderChangeAction {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrderTransaction {
|
interface BaseOrderTransaction {
|
||||||
id: string
|
id: string
|
||||||
order_id: string
|
order_id: string
|
||||||
amount: number
|
amount: number
|
||||||
raw_amount?: BigNumberRawValue
|
|
||||||
currency_code: string
|
currency_code: string
|
||||||
reference: string
|
reference: string
|
||||||
reference_id: string
|
reference_id: string
|
||||||
@@ -235,7 +205,7 @@ interface OrderTransaction {
|
|||||||
updated_at: Date | string
|
updated_at: Date | string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderResponse {
|
export interface BaseOrder {
|
||||||
id: string
|
id: string
|
||||||
version: number
|
version: number
|
||||||
region_id: string | null
|
region_id: string | null
|
||||||
@@ -243,12 +213,13 @@ export interface OrderResponse {
|
|||||||
sales_channel_id: string | null
|
sales_channel_id: string | null
|
||||||
email: string | null
|
email: string | null
|
||||||
currency_code: string
|
currency_code: string
|
||||||
shipping_address?: OrderAddress
|
display_id?: string
|
||||||
billing_address?: OrderAddress
|
shipping_address?: BaseOrderAddress
|
||||||
items: OrderLineItem[] | null
|
billing_address?: BaseOrderAddress
|
||||||
shipping_methods: OrderShippingMethod[] | null
|
items: BaseOrderLineItem[] | null
|
||||||
transactions?: OrderTransaction[]
|
shipping_methods: BaseOrderShippingMethod[] | null
|
||||||
summary: OrderSummary
|
transactions?: BaseOrderTransaction[]
|
||||||
|
summary: BaseOrderSummary
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
created_at: string | Date
|
created_at: string | Date
|
||||||
updated_at: string | Date
|
updated_at: string | Date
|
||||||
@@ -274,34 +245,4 @@ export interface OrderResponse {
|
|||||||
original_shipping_total: number
|
original_shipping_total: number
|
||||||
original_shipping_subtotal: number
|
original_shipping_subtotal: number
|
||||||
original_shipping_tax_total: number
|
original_shipping_tax_total: number
|
||||||
raw_original_item_total?: BigNumberRawValue
|
|
||||||
raw_original_item_subtotal?: BigNumberRawValue
|
|
||||||
raw_original_item_tax_total?: BigNumberRawValue
|
|
||||||
raw_item_total?: BigNumberRawValue
|
|
||||||
raw_item_subtotal?: BigNumberRawValue
|
|
||||||
raw_item_tax_total?: BigNumberRawValue
|
|
||||||
raw_original_total?: BigNumberRawValue
|
|
||||||
raw_original_subtotal?: BigNumberRawValue
|
|
||||||
raw_original_tax_total?: BigNumberRawValue
|
|
||||||
raw_total?: BigNumberRawValue
|
|
||||||
raw_subtotal?: BigNumberRawValue
|
|
||||||
raw_tax_total?: BigNumberRawValue
|
|
||||||
raw_discount_total?: BigNumberRawValue
|
|
||||||
raw_discount_tax_total?: BigNumberRawValue
|
|
||||||
raw_gift_card_total?: BigNumberRawValue
|
|
||||||
raw_gift_card_tax_total?: BigNumberRawValue
|
|
||||||
raw_shipping_total?: BigNumberRawValue
|
|
||||||
raw_shipping_subtotal?: BigNumberRawValue
|
|
||||||
raw_shipping_tax_total?: BigNumberRawValue
|
|
||||||
raw_original_shipping_total?: BigNumberRawValue
|
|
||||||
raw_original_shipping_subtotal?: BigNumberRawValue
|
|
||||||
raw_original_shipping_tax_total?: BigNumberRawValue
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AdminOrderListResponse = PaginatedResponse<{
|
|
||||||
orders: OrderResponse[]
|
|
||||||
}>
|
|
||||||
|
|
||||||
export interface AdminOrderResponse {
|
|
||||||
order: OrderResponse
|
|
||||||
}
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from "./admin"
|
export * from "./admin"
|
||||||
|
export * from "./store"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { BaseOrder } from "./common"
|
||||||
|
|
||||||
|
export interface StoreOrder extends BaseOrder {}
|
||||||
@@ -1,5 +1,23 @@
|
|||||||
import { BasePaymentProvider } from "./common"
|
import {
|
||||||
|
BasePaymentCollection,
|
||||||
|
BasePaymentCollectionFilters,
|
||||||
|
BasePaymentProvider,
|
||||||
|
BasePaymentProviderFilters,
|
||||||
|
BasePaymentSession,
|
||||||
|
BasePaymentSessionFilters,
|
||||||
|
} from "./common"
|
||||||
|
|
||||||
export interface AdminPaymentProvider extends BasePaymentProvider {
|
export interface AdminPaymentProvider extends BasePaymentProvider {
|
||||||
is_enabled: boolean
|
is_enabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {}
|
||||||
@@ -1,3 +1,422 @@
|
|||||||
|
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||||
|
import { BigNumberValue } from "../../totals"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment collection's status.
|
||||||
|
*/
|
||||||
|
export type BasePaymentCollectionStatus =
|
||||||
|
| "not_paid"
|
||||||
|
| "awaiting"
|
||||||
|
| "authorized"
|
||||||
|
| "partially_authorized"
|
||||||
|
| "canceled"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* The status of a payment session.
|
||||||
|
*/
|
||||||
|
export type BasePaymentSessionStatus =
|
||||||
|
| "authorized"
|
||||||
|
| "pending"
|
||||||
|
| "requires_more"
|
||||||
|
| "error"
|
||||||
|
| "canceled"
|
||||||
|
|
||||||
export interface BasePaymentProvider {
|
export interface BasePaymentProvider {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment collection details.
|
||||||
|
*/
|
||||||
|
export interface BasePaymentCollection {
|
||||||
|
/**
|
||||||
|
* The ID of the payment collection.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ISO 3 character currency code of the payment sessions and payments associated with payment collection.
|
||||||
|
*/
|
||||||
|
currency_code: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the associated region.
|
||||||
|
*/
|
||||||
|
region_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total amount to be authorized and captured.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount authorized within the associated payment sessions.
|
||||||
|
*/
|
||||||
|
authorized_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount refunded within the associated payments.
|
||||||
|
*/
|
||||||
|
refunded_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment collection was completed.
|
||||||
|
*/
|
||||||
|
completed_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment collection was created.
|
||||||
|
*/
|
||||||
|
created_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment collection was updated.
|
||||||
|
*/
|
||||||
|
updated_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds custom data in key-value pairs.
|
||||||
|
*/
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The status of the payment collection.
|
||||||
|
*/
|
||||||
|
status: BasePaymentCollectionStatus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment provider used to process the associated payment sessions and payments.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment_providers: BasePaymentProvider[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated payment sessions.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment_sessions?: BasePaymentSession[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated payments.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payments?: BasePayment[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BasePayment {
|
||||||
|
/**
|
||||||
|
* The ID of the payment.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment's total amount.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The authorized amount of the payment.
|
||||||
|
*/
|
||||||
|
authorized_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ISO 3 character currency code of the payment.
|
||||||
|
*/
|
||||||
|
currency_code: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated payment provider.
|
||||||
|
*/
|
||||||
|
provider_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated cart.
|
||||||
|
*/
|
||||||
|
cart_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated order.
|
||||||
|
*/
|
||||||
|
order_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated order edit.
|
||||||
|
*/
|
||||||
|
order_edit_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated customer.
|
||||||
|
*/
|
||||||
|
customer_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data relevant for the payment provider to process the payment.
|
||||||
|
*/
|
||||||
|
data?: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment was created.
|
||||||
|
*/
|
||||||
|
created_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment was updated.
|
||||||
|
*/
|
||||||
|
updated_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment was captured.
|
||||||
|
*/
|
||||||
|
captured_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment was canceled.
|
||||||
|
*/
|
||||||
|
canceled_at?: string | Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sum of the associated captures' amounts.
|
||||||
|
*/
|
||||||
|
captured_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sum of the associated refunds' amounts.
|
||||||
|
*/
|
||||||
|
refunded_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated captures.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
captures?: BaseCapture[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated refunds.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
refunds?: BaseRefund[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated payment collection.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment_collection?: BasePaymentCollection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment session from which the payment is created.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment_session?: BasePaymentSession
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The capture details.
|
||||||
|
*/
|
||||||
|
export interface BaseCapture {
|
||||||
|
/**
|
||||||
|
* The ID of the capture.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The captured amount.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The creation date of the capture.
|
||||||
|
*/
|
||||||
|
created_at: Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Who the capture was created by. For example,
|
||||||
|
* the ID of a user.
|
||||||
|
*/
|
||||||
|
created_by?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated payment.
|
||||||
|
*/
|
||||||
|
payment: BasePayment
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The refund details.
|
||||||
|
*/
|
||||||
|
export interface BaseRefund {
|
||||||
|
/**
|
||||||
|
* The ID of the refund
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The refunded amount.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The creation date of the refund.
|
||||||
|
*/
|
||||||
|
created_at: Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Who created the refund. For example,
|
||||||
|
* the user's ID.
|
||||||
|
*/
|
||||||
|
created_by?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated payment.
|
||||||
|
*/
|
||||||
|
payment: BasePayment
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment session details.
|
||||||
|
*/
|
||||||
|
export interface BasePaymentSession {
|
||||||
|
/**
|
||||||
|
* The ID of the payment session.
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount to authorize.
|
||||||
|
*/
|
||||||
|
amount: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The 3 character currency code of the payment session.
|
||||||
|
*/
|
||||||
|
currency_code: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the associated payment provider.
|
||||||
|
*/
|
||||||
|
provider_id: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data necessary for the payment provider to process the payment session.
|
||||||
|
*/
|
||||||
|
data: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The context necessary for the payment provider.
|
||||||
|
*/
|
||||||
|
context?: Record<string, unknown>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The status of the payment session.
|
||||||
|
*/
|
||||||
|
status: BasePaymentSessionStatus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the payment session was authorized.
|
||||||
|
*/
|
||||||
|
authorized_at?: Date
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment collection the session is associated with.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment_collection?: BasePaymentCollection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The payment created from the session.
|
||||||
|
*
|
||||||
|
* @expandable
|
||||||
|
*/
|
||||||
|
payment?: BasePayment
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The filters to apply on the retrieved payment collection.
|
||||||
|
*/
|
||||||
|
export interface BasePaymentCollectionFilters
|
||||||
|
extends BaseFilterable<BasePaymentCollectionFilters> {
|
||||||
|
/**
|
||||||
|
* The IDs to filter the payment collection by.
|
||||||
|
*/
|
||||||
|
id?: string | string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter by associated region's ID.
|
||||||
|
*/
|
||||||
|
region_id?: string | string[] | OperatorMap<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter payment collections by created date.
|
||||||
|
*/
|
||||||
|
created_at?: OperatorMap<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter payment collections by updated date.
|
||||||
|
*/
|
||||||
|
updated_at?: OperatorMap<string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The filters to apply on the retrieved payment sessions.
|
||||||
|
*/
|
||||||
|
export interface BasePaymentSessionFilters
|
||||||
|
extends BaseFilterable<BasePaymentSessionFilters> {
|
||||||
|
/**
|
||||||
|
* The IDs to filter the payment sessions by.
|
||||||
|
*/
|
||||||
|
id?: string | string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by their currency code.
|
||||||
|
*/
|
||||||
|
currency_code?: string | string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by their amount.
|
||||||
|
*/
|
||||||
|
amount?: BigNumberValue | OperatorMap<BigNumberValue>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by the ID of their associated payment provider.
|
||||||
|
*/
|
||||||
|
provider_id?: string | string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by the ID of their associated payment collection.
|
||||||
|
*/
|
||||||
|
payment_collection_id?: string | string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by the ID of their associated region.
|
||||||
|
*/
|
||||||
|
region_id?: string | string[] | OperatorMap<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by their creation date.
|
||||||
|
*/
|
||||||
|
created_at?: OperatorMap<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by their update date.
|
||||||
|
*/
|
||||||
|
updated_at?: OperatorMap<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the payment sessions by their deletion date.
|
||||||
|
*/
|
||||||
|
deleted_at?: OperatorMap<string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BasePaymentProviderFilters
|
||||||
|
extends BaseFilterable<BasePaymentProviderFilters> {
|
||||||
|
id?: string | string[]
|
||||||
|
region_id?: string | string[]
|
||||||
|
}
|
||||||
@@ -1,3 +1,18 @@
|
|||||||
import { BasePaymentProvider } from "./common"
|
import {
|
||||||
|
BasePaymentCollection,
|
||||||
|
BasePaymentCollectionFilters,
|
||||||
|
BasePaymentProvider,
|
||||||
|
BasePaymentProviderFilters,
|
||||||
|
BasePaymentSession,
|
||||||
|
BasePaymentSessionFilters,
|
||||||
|
} from "./common"
|
||||||
|
|
||||||
export interface StorePaymentProvider extends BasePaymentProvider {}
|
export interface StorePaymentProvider extends BasePaymentProvider {}
|
||||||
|
export interface StorePaymentCollection extends BasePaymentCollection {}
|
||||||
|
export interface StorePaymentSession extends BasePaymentSession {}
|
||||||
|
|
||||||
|
export interface StorePaymentProviderFilters
|
||||||
|
extends BasePaymentProviderFilters {}
|
||||||
|
export interface StorePaymentCollectionFilters
|
||||||
|
extends BasePaymentCollectionFilters {}
|
||||||
|
export interface StorePaymentSessionFilters extends BasePaymentSessionFilters {}
|
||||||
@@ -24,10 +24,15 @@ export interface StoreProductOption extends BaseProductOption {}
|
|||||||
export interface StoreProductImage extends BaseProductImage {}
|
export interface StoreProductImage extends BaseProductImage {}
|
||||||
export interface StoreProductOptionValue extends BaseProductOptionValue {}
|
export interface StoreProductOptionValue extends BaseProductOptionValue {}
|
||||||
|
|
||||||
export interface StoreProductFilters extends BaseProductFilters {}
|
|
||||||
export interface StoreProductTagFilters extends BaseProductTagFilters {}
|
export interface StoreProductTagFilters extends BaseProductTagFilters {}
|
||||||
export interface StoreProductTypeFilters extends BaseProductTypeFilters {}
|
export interface StoreProductTypeFilters extends BaseProductTypeFilters {}
|
||||||
export interface StoreProductOptionFilters extends BaseProductOptionFilters {}
|
export interface StoreProductOptionFilters extends BaseProductOptionFilters {}
|
||||||
export interface StoreProductVariantFilters extends BaseProductVariantFilters {}
|
export interface StoreProductVariantFilters extends BaseProductVariantFilters {}
|
||||||
|
export interface StoreProductFilters extends BaseProductFilters {
|
||||||
|
// The region ID and currency_code are not filters, but are used for the pricing context. Maybe move to separate type definition.
|
||||||
|
region_id?: string
|
||||||
|
currency_code?: string
|
||||||
|
variants?: StoreProductVariantFilters
|
||||||
|
}
|
||||||
export interface StoreProductCategoryFilters
|
export interface StoreProductCategoryFilters
|
||||||
extends BaseProductCategoryFilters {}
|
extends BaseProductCategoryFilters {}
|
||||||
@@ -7,6 +7,7 @@ import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing"
|
|||||||
import { refetchCart } from "../../../helpers"
|
import { refetchCart } from "../../../helpers"
|
||||||
import { StoreUpdateCartLineItemType } from "../../../validators"
|
import { StoreUpdateCartLineItemType } from "../../../validators"
|
||||||
import { prepareListQuery } from "../../../../../../utils/get-query-config"
|
import { prepareListQuery } from "../../../../../../utils/get-query-config"
|
||||||
|
import { DeleteResponse } from "@medusajs/types"
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: MedusaRequest<StoreUpdateCartLineItemType>,
|
req: MedusaRequest<StoreUpdateCartLineItemType>,
|
||||||
@@ -62,7 +63,10 @@ export const POST = async (
|
|||||||
res.status(200).json({ cart: updatedCart })
|
res.status(200).json({ cart: updatedCart })
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DELETE = async (req: MedusaRequest, res: MedusaResponse) => {
|
export const DELETE = async (
|
||||||
|
req: MedusaRequest,
|
||||||
|
res: MedusaResponse<DeleteResponse<"line-item">>
|
||||||
|
) => {
|
||||||
const id = req.params.line_id
|
const id = req.params.line_id
|
||||||
|
|
||||||
const { errors } = await deleteLineItemsWorkflow(req.scope).run({
|
const { errors } = await deleteLineItemsWorkflow(req.scope).run({
|
||||||
@@ -80,5 +84,10 @@ export const DELETE = async (req: MedusaRequest, res: MedusaResponse) => {
|
|||||||
req.remoteQueryConfig.fields
|
req.remoteQueryConfig.fields
|
||||||
)
|
)
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({
|
||||||
|
id: id,
|
||||||
|
object: "line-item",
|
||||||
|
deleted: true,
|
||||||
|
parent: cart,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user