docs: fix OAS generator + generate OAS (#11584)

This commit is contained in:
Shahed Nasser
2025-02-24 15:30:38 +02:00
committed by GitHub
parent 41f070be9a
commit be566ca6fb
44 changed files with 10904 additions and 8753 deletions
@@ -0,0 +1,2 @@
curl -X POST '{backend_url}/admin/draft-orders/{id}' \
-H 'Authorization: Bearer {access_token}'
@@ -1,2 +1,7 @@
curl -X POST '{backend_url}/admin/products/batch' \
-H 'Authorization: Bearer {access_token}'
-H 'Authorization: Bearer {access_token}' \
--data-raw '{
"delete": [
"prod_123"
]
}'
@@ -3,7 +3,6 @@ description: The product's details.
x-schemaName: AdminCreateProduct
required:
- title
- shipping_profile_id
- options
properties:
title:
@@ -0,0 +1,249 @@
type: object
description: The draft order's details.
x-schemaName: AdminDraftOrder
required:
- payment_collections
- items
- shipping_methods
- status
- currency_code
- id
- version
- region_id
- customer_id
- sales_channel_id
- email
- payment_status
- fulfillment_status
- summary
- created_at
- updated_at
- original_item_total
- original_item_subtotal
- original_item_tax_total
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- gift_card_total
- gift_card_tax_total
- shipping_total
- shipping_subtotal
- shipping_tax_total
- original_shipping_total
- original_shipping_subtotal
- original_shipping_tax_total
properties:
payment_collections:
type: array
description: The draft order's payment collections.
items:
$ref: ./AdminPaymentCollection.yaml
fulfillments:
type: array
description: The draft order's fulfillments.
items:
$ref: ./AdminOrderFulfillment.yaml
sales_channel:
$ref: ./AdminSalesChannel.yaml
customer:
$ref: ./AdminCustomer.yaml
shipping_address:
$ref: ./AdminOrderAddress.yaml
billing_address:
$ref: ./AdminOrderAddress.yaml
items:
type: array
description: The draft order's items.
items:
$ref: ./AdminOrderLineItem.yaml
shipping_methods:
type: array
description: The draft order's shipping methods.
items:
$ref: ./AdminOrderShippingMethod.yaml
status:
type: string
title: status
description: The draft order's status.
currency_code:
type: string
title: currency_code
description: The draft order's currency code.
example: usd
id:
type: string
title: id
description: The draft order's ID.
version:
type: number
title: version
description: The draft order's version.
region_id:
type: string
title: region_id
description: The ID of the region associated with the draft order.
customer_id:
type: string
title: customer_id
description: The ID of the customer that the draft order belongs to.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel that the draft order is placed in.
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
display_id:
type: number
title: display_id
description: The draft order's display ID.
payment_status:
type: string
description: The draft order's payment status.
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- canceled
- captured
- partially_captured
- partially_refunded
- refunded
- requires_action
fulfillment_status:
type: string
description: The draft order's fulfillment status.
enum:
- canceled
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_delivered
- delivered
transactions:
type: array
description: The draft order's transactions.
items:
$ref: ./BaseOrderTransaction.yaml
summary:
$ref: ./BaseOrderSummary.yaml
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the draft order was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the draft order was updated.
original_item_total:
type: number
title: original_item_total
description: >-
The total of the draft order's items including taxes, excluding
promotions.
original_item_subtotal:
type: number
title: original_item_subtotal
description: >-
The total of the draft order's items excluding taxes, including
promotions.
original_item_tax_total:
type: number
title: original_item_tax_total
description: The tax total of the draft order's items excluding promotions.
item_total:
type: number
title: item_total
description: The total of the draft order's items including taxes and promotions.
item_subtotal:
type: number
title: item_subtotal
description: >-
The total of the draft order's items excluding taxes, including
promotions.
item_tax_total:
type: number
title: item_tax_total
description: The tax total of the draft order's items including promotions.
original_total:
type: number
title: original_total
description: The draft order's total excluding promotions, including taxes.
original_subtotal:
type: number
title: original_subtotal
description: The draft order's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The draft order's tax total, excluding promotions.
total:
type: number
title: total
description: The draft order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The draft order's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The draft order's tax total including promotions.
discount_total:
type: number
title: discount_total
description: The draft order's discount or promotions total.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of draft order's discount or promotion.
gift_card_total:
type: number
title: gift_card_total
description: The draft order's gift card total.
gift_card_tax_total:
type: number
title: gift_card_tax_total
description: The tax total of the draft order's gift card.
shipping_total:
type: number
title: shipping_total
description: The draft order's shipping total including taxes and promotions.
shipping_subtotal:
type: number
title: shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
shipping_tax_total:
type: number
title: shipping_tax_total
description: The tax total of the draft order's shipping.
original_shipping_total:
type: number
title: original_shipping_total
description: The draft order's shipping total including taxes, excluding promotions.
original_shipping_subtotal:
type: number
title: original_shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
original_shipping_tax_total:
type: number
title: original_shipping_tax_total
description: The tax total of the draft order's shipping excluding promotions.
@@ -0,0 +1,26 @@
type: object
description: The list of draft orders with pagination fields.
x-schemaName: AdminDraftOrderListResponse
required:
- limit
- offset
- count
- draft_orders
properties:
limit:
type: number
title: limit
description: The maximum number of items retrieved.
offset:
type: number
title: offset
description: The number of items skipped before retrieving the returned items.
count:
type: number
title: count
description: The total count of items available.
draft_orders:
type: array
description: The list of draft orders.
items:
$ref: ./AdminDraftOrder.yaml
@@ -5,4 +5,4 @@ required:
- draft_order
properties:
draft_order:
$ref: ./AdminOrder.yaml
$ref: ./AdminDraftOrder.yaml
@@ -0,0 +1,108 @@
type: object
description: The data to update in the draft order.
x-schemaName: AdminUpdateDraftOrder
properties:
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
shipping_address:
type: object
description: The draft order's shipping address.
properties:
first_name:
type: string
title: first_name
description: The shipping address's first name.
last_name:
type: string
title: last_name
description: The shipping address's last name.
phone:
type: string
title: phone
description: The shipping address's phone.
company:
type: string
title: company
description: The shipping address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The shipping address's city.
country_code:
type: string
title: country_code
description: The shipping address's country code.
example: us
province:
type: string
title: province
description: The shipping address's province.
postal_code:
type: string
title: postal_code
description: The shipping address's postal code.
metadata:
type: object
description: The shipping address's metadata, can hold custom key-value pairs.
billing_address:
type: object
description: The draft order's billing address.
properties:
first_name:
type: string
title: first_name
description: The billing address's first name.
last_name:
type: string
title: last_name
description: The billing address's last name.
phone:
type: string
title: phone
description: The billing address's phone.
company:
type: string
title: company
description: The billing address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The billing address's city.
country_code:
type: string
title: country_code
description: The billing address's country code.
example: us
province:
type: string
title: province
description: The billing address's province.
postal_code:
type: string
title: postal_code
description: The billing address's postal code.
metadata:
type: object
description: The billing address's metadata, can hold custom key-value pairs.
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
@@ -2,49 +2,14 @@ type: object
description: The order's summary details.
x-schemaName: BaseOrderSummary
required:
- total
- subtotal
- total_tax
- ordered_total
- fulfilled_total
- returned_total
- return_request_total
- write_off_total
- pending_difference
- current_order_total
- original_order_total
- transaction_total
- paid_total
- refunded_total
- accounting_total
properties:
total:
type: number
title: total
description: The order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The order's total excluding taxes, including promotions.
total_tax:
type: number
title: total_tax
description: The order's total taxes.
ordered_total:
type: number
title: ordered_total
description: The order's total when it was placed.
fulfilled_total:
type: number
title: fulfilled_total
description: The total of the fulfilled items of the order.
returned_total:
type: number
title: returned_total
description: The total of the order's returned items.
return_request_total:
type: number
title: return_request_total
description: The total of the items requested to be returned.
write_off_total:
type: number
title: write_off_total
description: The total of the items removed from the order.
paid_total:
type: number
title: paid_total
@@ -53,3 +18,25 @@ properties:
type: number
title: refunded_total
description: The total amount refunded.
pending_difference:
type: number
title: pending_difference
description: >-
The difference pending to be processed. If negative, the customer needs a
refund. Otherwise, additional payment is required from the customer.
current_order_total:
type: number
title: current_order_total
description: The order's current total, could be the total after a change in the order.
original_order_total:
type: number
title: original_order_total
description: The order's original total.
transaction_total:
type: number
title: transaction_total
description: The total of the transactions made on the order.
accounting_total:
type: number
title: accounting_total
description: The order's total without the credit-line total.
@@ -59,6 +59,8 @@ properties:
- awaiting
- authorized
- partially_authorized
- completed
- failed
payment_providers:
type: array
description: >-
@@ -1,6 +1,13 @@
type: object
description: The payment session's details.
x-schemaName: BasePaymentSession
required:
- id
- amount
- currency_code
- provider_id
- data
- status
properties:
id:
type: string
@@ -26,7 +33,7 @@ properties:
payment.
externalDocs:
url: >-
https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-session#data-property
https://docs.medusajs.com/resources/commerce-modules/payment/payment-session#data-property
context:
type: object
description: The context around the payment, such as the customer's details.
@@ -37,12 +44,12 @@ properties:
type: string
description: The payment session's status.
enum:
- error
- authorized
- captured
- canceled
- captured
- pending
- requires_more
- error
authorized_at:
type: string
title: authorized_at
@@ -52,10 +59,3 @@ properties:
type: object
payment:
$ref: ./BasePayment.yaml
required:
- id
- amount
- currency_code
- provider_id
- data
- status
@@ -4,6 +4,7 @@ x-schemaName: OrderTransaction
required:
- id
- order_id
- version
- order
- amount
- currency_code
@@ -59,3 +60,7 @@ properties:
description: The date that the transaction was updated.
order:
type: object
version:
type: number
title: version
description: The order version that the transaction belongs to.
@@ -14,6 +14,7 @@ required:
- amount
- prices
- calculated_price
- insufficient_inventory
properties:
id:
type: string
@@ -101,3 +102,9 @@ properties:
$ref: ./StorePrice.yaml
calculated_price:
$ref: ./StoreCalculatedPrice.yaml
insufficient_inventory:
type: boolean
title: insufficient_inventory
description: >-
Whether the shipping option's location doesn't have sufficient quantity
for any of the cart's items.
@@ -91,6 +91,8 @@ tags:
externalDocs:
description: Learn more about the Order Module
url: https://docs.medusajs.com/v2/resources/commerce-modules/order
x-associatedSchema:
$ref: '#/components/schemas/AdminDraftOrder'
- name: Exchanges
description: |
An exchange is the replacement of an item that the customer ordered with another.
@@ -12985,33 +12987,7 @@ paths:
content:
application/json:
schema:
allOf:
- type: object
description: The paginated list of draft orders.
required:
- limit
- offset
- count
properties:
limit:
type: number
title: limit
description: The maximum number of items returned.
offset:
type: number
title: offset
description: The number of items skipped before retrieving the returned items.
count:
type: number
title: count
description: The total number of items.
- type: object
description: The paginated list of draft orders.
required:
- draft_orders
properties:
draft_orders:
$ref: '#/components/schemas/AdminOrder'
$ref: '#/components/schemas/AdminDraftOrderListResponse'
'400':
$ref: '#/components/responses/400_error'
'401':
@@ -13024,6 +13000,7 @@ paths:
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
x-workflow: getOrdersListWorkflow
post:
operationId: PostDraftOrders
summary: Create Draft Order
@@ -13394,6 +13371,19 @@ paths:
required: true
schema:
type: string
- name: fields
in: query
description: |-
Comma-separated fields that should be included in the returned data.
if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.
without prefix it will replace the entire default fields.
required: false
schema:
type: string
title: fields
description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. Without prefix it will replace the entire default fields.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
@@ -13425,6 +13415,69 @@ paths:
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
x-workflow: getOrderDetailWorkflow
post:
operationId: PostDraftOrdersId
summary: Update a Draft Order
description: Update a draft order's details.
x-authenticated: true
parameters:
- name: id
in: path
description: The draft order's ID.
required: true
schema:
type: string
- name: fields
in: query
description: |-
Comma-separated fields that should be included in the returned data.
if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.
without prefix it will replace the entire default fields.
required: false
schema:
type: string
title: fields
description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. Without prefix it will replace the entire default fields.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
- jwt_token: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUpdateDraftOrder'
x-codeSamples:
- lang: Shell
label: cURL
source: |-
curl -X POST '{backend_url}/admin/draft-orders/{id}' \
-H 'Authorization: Bearer {access_token}'
tags:
- Draft Orders
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrderResponse'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
x-workflow: updateOrderWorkflow
/admin/exchanges:
get:
operationId: GetExchanges
@@ -27060,7 +27113,12 @@ paths:
label: cURL
source: |-
curl -X POST '{backend_url}/admin/products/batch' \
-H 'Authorization: Bearer {access_token}'
-H 'Authorization: Bearer {access_token}' \
--data-raw '{
"delete": [
"prod_123"
]
}'
tags:
- Products
responses:
@@ -45107,7 +45165,6 @@ components:
x-schemaName: AdminCreateProduct
required:
- title
- shipping_profile_id
- options
properties:
title:
@@ -46963,6 +47020,277 @@ components:
type: boolean
title: deleted
description: Whether the object was deleted.
AdminDraftOrder:
type: object
description: The draft order's details.
x-schemaName: AdminDraftOrder
required:
- payment_collections
- items
- shipping_methods
- status
- currency_code
- id
- version
- region_id
- customer_id
- sales_channel_id
- email
- payment_status
- fulfillment_status
- summary
- created_at
- updated_at
- original_item_total
- original_item_subtotal
- original_item_tax_total
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- gift_card_total
- gift_card_tax_total
- shipping_total
- shipping_subtotal
- shipping_tax_total
- original_shipping_total
- original_shipping_subtotal
- original_shipping_tax_total
properties:
payment_collections:
type: array
description: The draft order's payment collections.
items:
$ref: '#/components/schemas/AdminPaymentCollection'
fulfillments:
type: array
description: The draft order's fulfillments.
items:
$ref: '#/components/schemas/AdminOrderFulfillment'
sales_channel:
$ref: '#/components/schemas/AdminSalesChannel'
customer:
$ref: '#/components/schemas/AdminCustomer'
shipping_address:
$ref: '#/components/schemas/AdminOrderAddress'
billing_address:
$ref: '#/components/schemas/AdminOrderAddress'
items:
type: array
description: The draft order's items.
items:
$ref: '#/components/schemas/AdminOrderLineItem'
shipping_methods:
type: array
description: The draft order's shipping methods.
items:
$ref: '#/components/schemas/AdminOrderShippingMethod'
status:
type: string
title: status
description: The draft order's status.
currency_code:
type: string
title: currency_code
description: The draft order's currency code.
example: usd
id:
type: string
title: id
description: The draft order's ID.
version:
type: number
title: version
description: The draft order's version.
region_id:
type: string
title: region_id
description: The ID of the region associated with the draft order.
customer_id:
type: string
title: customer_id
description: The ID of the customer that the draft order belongs to.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel that the draft order is placed in.
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
display_id:
type: number
title: display_id
description: The draft order's display ID.
payment_status:
type: string
description: The draft order's payment status.
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- canceled
- captured
- partially_captured
- partially_refunded
- refunded
- requires_action
fulfillment_status:
type: string
description: The draft order's fulfillment status.
enum:
- canceled
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_delivered
- delivered
transactions:
type: array
description: The draft order's transactions.
items:
$ref: '#/components/schemas/BaseOrderTransaction'
summary:
$ref: '#/components/schemas/BaseOrderSummary'
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the draft order was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the draft order was updated.
original_item_total:
type: number
title: original_item_total
description: The total of the draft order's items including taxes, excluding promotions.
original_item_subtotal:
type: number
title: original_item_subtotal
description: The total of the draft order's items excluding taxes, including promotions.
original_item_tax_total:
type: number
title: original_item_tax_total
description: The tax total of the draft order's items excluding promotions.
item_total:
type: number
title: item_total
description: The total of the draft order's items including taxes and promotions.
item_subtotal:
type: number
title: item_subtotal
description: The total of the draft order's items excluding taxes, including promotions.
item_tax_total:
type: number
title: item_tax_total
description: The tax total of the draft order's items including promotions.
original_total:
type: number
title: original_total
description: The draft order's total excluding promotions, including taxes.
original_subtotal:
type: number
title: original_subtotal
description: The draft order's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The draft order's tax total, excluding promotions.
total:
type: number
title: total
description: The draft order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The draft order's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The draft order's tax total including promotions.
discount_total:
type: number
title: discount_total
description: The draft order's discount or promotions total.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of draft order's discount or promotion.
gift_card_total:
type: number
title: gift_card_total
description: The draft order's gift card total.
gift_card_tax_total:
type: number
title: gift_card_tax_total
description: The tax total of the draft order's gift card.
shipping_total:
type: number
title: shipping_total
description: The draft order's shipping total including taxes and promotions.
shipping_subtotal:
type: number
title: shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
shipping_tax_total:
type: number
title: shipping_tax_total
description: The tax total of the draft order's shipping.
original_shipping_total:
type: number
title: original_shipping_total
description: The draft order's shipping total including taxes, excluding promotions.
original_shipping_subtotal:
type: number
title: original_shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
original_shipping_tax_total:
type: number
title: original_shipping_tax_total
description: The tax total of the draft order's shipping excluding promotions.
AdminDraftOrderListResponse:
type: object
description: The list of draft orders with pagination fields.
x-schemaName: AdminDraftOrderListResponse
required:
- limit
- offset
- count
- draft_orders
properties:
limit:
type: number
title: limit
description: The maximum number of items retrieved.
offset:
type: number
title: offset
description: The number of items skipped before retrieving the returned items.
count:
type: number
title: count
description: The total count of items available.
draft_orders:
type: array
description: The list of draft orders.
items:
$ref: '#/components/schemas/AdminDraftOrder'
AdminDraftOrderResponse:
type: object
description: The draft order's details.
@@ -46971,7 +47299,7 @@ components:
- draft_order
properties:
draft_order:
$ref: '#/components/schemas/AdminOrder'
$ref: '#/components/schemas/AdminDraftOrder'
AdminExchange:
type: object
description: The exchange's details.
@@ -54065,6 +54393,115 @@ components:
metadata:
type: object
description: The customer group's metadata, can hold custom key-value pairs.
AdminUpdateDraftOrder:
type: object
description: The data to update in the draft order.
x-schemaName: AdminUpdateDraftOrder
properties:
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
shipping_address:
type: object
description: The draft order's shipping address.
properties:
first_name:
type: string
title: first_name
description: The shipping address's first name.
last_name:
type: string
title: last_name
description: The shipping address's last name.
phone:
type: string
title: phone
description: The shipping address's phone.
company:
type: string
title: company
description: The shipping address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The shipping address's city.
country_code:
type: string
title: country_code
description: The shipping address's country code.
example: us
province:
type: string
title: province
description: The shipping address's province.
postal_code:
type: string
title: postal_code
description: The shipping address's postal code.
metadata:
type: object
description: The shipping address's metadata, can hold custom key-value pairs.
billing_address:
type: object
description: The draft order's billing address.
properties:
first_name:
type: string
title: first_name
description: The billing address's first name.
last_name:
type: string
title: last_name
description: The billing address's last name.
phone:
type: string
title: phone
description: The billing address's phone.
company:
type: string
title: company
description: The billing address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The billing address's city.
country_code:
type: string
title: country_code
description: The billing address's country code.
example: us
province:
type: string
title: province
description: The billing address's province.
postal_code:
type: string
title: postal_code
description: The billing address's postal code.
metadata:
type: object
description: The billing address's metadata, can hold custom key-value pairs.
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
AdminUpdateOrder:
type: object
description: The details to update in the order.
@@ -57220,49 +57657,14 @@ components:
description: The order's summary details.
x-schemaName: BaseOrderSummary
required:
- total
- subtotal
- total_tax
- ordered_total
- fulfilled_total
- returned_total
- return_request_total
- write_off_total
- pending_difference
- current_order_total
- original_order_total
- transaction_total
- paid_total
- refunded_total
- accounting_total
properties:
total:
type: number
title: total
description: The order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The order's total excluding taxes, including promotions.
total_tax:
type: number
title: total_tax
description: The order's total taxes.
ordered_total:
type: number
title: ordered_total
description: The order's total when it was placed.
fulfilled_total:
type: number
title: fulfilled_total
description: The total of the fulfilled items of the order.
returned_total:
type: number
title: returned_total
description: The total of the order's returned items.
return_request_total:
type: number
title: return_request_total
description: The total of the items requested to be returned.
write_off_total:
type: number
title: write_off_total
description: The total of the items removed from the order.
paid_total:
type: number
title: paid_total
@@ -57271,6 +57673,26 @@ components:
type: number
title: refunded_total
description: The total amount refunded.
pending_difference:
type: number
title: pending_difference
description: The difference pending to be processed. If negative, the customer needs a refund. Otherwise, additional payment is required from the customer.
current_order_total:
type: number
title: current_order_total
description: The order's current total, could be the total after a change in the order.
original_order_total:
type: number
title: original_order_total
description: The order's original total.
transaction_total:
type: number
title: transaction_total
description: The total of the transactions made on the order.
accounting_total:
type: number
title: accounting_total
description: The order's total without the credit-line total.
BaseOrderTransaction:
type: object
description: An order transaction's details.
@@ -57466,6 +57888,8 @@ components:
- awaiting
- authorized
- partially_authorized
- completed
- failed
payment_providers:
type: array
description: The payment provider used to process the collection's payments and sessions.
@@ -57496,6 +57920,13 @@ components:
type: object
description: The payment session's details.
x-schemaName: BasePaymentSession
required:
- id
- amount
- currency_code
- provider_id
- data
- status
properties:
id:
type: string
@@ -57518,7 +57949,7 @@ components:
type: object
description: The payment session's data, useful for the payment provider processing the payment.
externalDocs:
url: https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-session#data-property
url: https://docs.medusajs.com/resources/commerce-modules/payment/payment-session#data-property
context:
type: object
description: The context around the payment, such as the customer's details.
@@ -57529,12 +57960,12 @@ components:
type: string
description: The payment session's status.
enum:
- error
- authorized
- captured
- canceled
- captured
- pending
- requires_more
- error
authorized_at:
type: string
title: authorized_at
@@ -57544,13 +57975,6 @@ components:
type: object
payment:
$ref: '#/components/schemas/BasePayment'
required:
- id
- amount
- currency_code
- provider_id
- data
- status
BaseProduct:
type: object
description: The product's details.
@@ -60459,6 +60883,7 @@ components:
required:
- id
- order_id
- version
- order
- amount
- currency_code
@@ -60511,6 +60936,10 @@ components:
description: The date that the transaction was updated.
order:
type: object
version:
type: number
title: version
description: The order version that the transaction belongs to.
RefundReason:
type: object
description: The refund reason's details.
@@ -61743,6 +62172,7 @@ components:
- amount
- prices
- calculated_price
- insufficient_inventory
properties:
id:
type: string
@@ -61826,6 +62256,10 @@ components:
$ref: '#/components/schemas/StorePrice'
calculated_price:
$ref: '#/components/schemas/StoreCalculatedPrice'
insufficient_inventory:
type: boolean
title: insufficient_inventory
description: Whether the shipping option's location doesn't have sufficient quantity for any of the cart's items.
StoreCollection:
type: object
description: The collection's details.
@@ -119,6 +119,8 @@ tags:
externalDocs:
description: Learn more about the Order Module
url: https://docs.medusajs.com/v2/resources/commerce-modules/order
x-associatedSchema:
$ref: ./components/schemas/AdminDraftOrder.yaml
- name: Exchanges
description: >
An exchange is the replacement of an item that the customer ordered with
@@ -1804,35 +1804,7 @@ get:
content:
application/json:
schema:
allOf:
- type: object
description: The paginated list of draft orders.
required:
- limit
- offset
- count
properties:
limit:
type: number
title: limit
description: The maximum number of items returned.
offset:
type: number
title: offset
description: >-
The number of items skipped before retrieving the returned
items.
count:
type: number
title: count
description: The total number of items.
- type: object
description: The paginated list of draft orders.
required:
- draft_orders
properties:
draft_orders:
$ref: ../components/schemas/AdminOrder.yaml
$ref: ../components/schemas/AdminDraftOrderListResponse.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':
@@ -1845,6 +1817,7 @@ get:
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
x-workflow: getOrdersListWorkflow
post:
operationId: PostDraftOrders
summary: Create Draft Order
@@ -12,6 +12,26 @@ get:
required: true
schema:
type: string
- name: fields
in: query
description: >-
Comma-separated fields that should be included in the returned data.
if a field is prefixed with `+` it will be added to the default fields,
using `-` will remove it from the default fields.
without prefix it will replace the entire default fields.
required: false
schema:
type: string
title: fields
description: >-
Comma-separated fields that should be included in the returned data.
If a field is prefixed with `+` it will be added to the default
fields, using `-` will remove it from the default fields. Without
prefix it will replace the entire default fields.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
@@ -42,3 +62,72 @@ get:
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
x-workflow: getOrderDetailWorkflow
post:
operationId: PostDraftOrdersId
summary: Update a Draft Order
description: Update a draft order's details.
x-authenticated: true
parameters:
- name: id
in: path
description: The draft order's ID.
required: true
schema:
type: string
- name: fields
in: query
description: >-
Comma-separated fields that should be included in the returned data.
if a field is prefixed with `+` it will be added to the default fields,
using `-` will remove it from the default fields.
without prefix it will replace the entire default fields.
required: false
schema:
type: string
title: fields
description: >-
Comma-separated fields that should be included in the returned data.
If a field is prefixed with `+` it will be added to the default
fields, using `-` will remove it from the default fields. Without
prefix it will replace the entire default fields.
externalDocs:
url: '#select-fields-and-relations'
security:
- api_token: []
- cookie_auth: []
- jwt_token: []
requestBody:
content:
application/json:
schema:
$ref: ../components/schemas/AdminUpdateDraftOrder.yaml
x-codeSamples:
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/admin_draft-orders_{id}/post.sh
tags:
- Draft Orders
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../components/schemas/AdminDraftOrderResponse.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
x-workflow: updateOrderWorkflow
@@ -3,7 +3,6 @@ description: The product's details.
x-schemaName: AdminCreateProduct
required:
- title
- shipping_profile_id
- options
properties:
title:
@@ -0,0 +1,249 @@
type: object
description: The draft order's details.
x-schemaName: AdminDraftOrder
required:
- payment_collections
- items
- shipping_methods
- status
- currency_code
- id
- version
- region_id
- customer_id
- sales_channel_id
- email
- payment_status
- fulfillment_status
- summary
- created_at
- updated_at
- original_item_total
- original_item_subtotal
- original_item_tax_total
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- gift_card_total
- gift_card_tax_total
- shipping_total
- shipping_subtotal
- shipping_tax_total
- original_shipping_total
- original_shipping_subtotal
- original_shipping_tax_total
properties:
payment_collections:
type: array
description: The draft order's payment collections.
items:
$ref: ./AdminPaymentCollection.yaml
fulfillments:
type: array
description: The draft order's fulfillments.
items:
$ref: ./AdminOrderFulfillment.yaml
sales_channel:
$ref: ./AdminSalesChannel.yaml
customer:
$ref: ./AdminCustomer.yaml
shipping_address:
$ref: ./AdminOrderAddress.yaml
billing_address:
$ref: ./AdminOrderAddress.yaml
items:
type: array
description: The draft order's items.
items:
$ref: ./AdminOrderLineItem.yaml
shipping_methods:
type: array
description: The draft order's shipping methods.
items:
$ref: ./AdminOrderShippingMethod.yaml
status:
type: string
title: status
description: The draft order's status.
currency_code:
type: string
title: currency_code
description: The draft order's currency code.
example: usd
id:
type: string
title: id
description: The draft order's ID.
version:
type: number
title: version
description: The draft order's version.
region_id:
type: string
title: region_id
description: The ID of the region associated with the draft order.
customer_id:
type: string
title: customer_id
description: The ID of the customer that the draft order belongs to.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel that the draft order is placed in.
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
display_id:
type: number
title: display_id
description: The draft order's display ID.
payment_status:
type: string
description: The draft order's payment status.
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- canceled
- captured
- partially_captured
- partially_refunded
- refunded
- requires_action
fulfillment_status:
type: string
description: The draft order's fulfillment status.
enum:
- canceled
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_delivered
- delivered
transactions:
type: array
description: The draft order's transactions.
items:
$ref: ./BaseOrderTransaction.yaml
summary:
$ref: ./BaseOrderSummary.yaml
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the draft order was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the draft order was updated.
original_item_total:
type: number
title: original_item_total
description: >-
The total of the draft order's items including taxes, excluding
promotions.
original_item_subtotal:
type: number
title: original_item_subtotal
description: >-
The total of the draft order's items excluding taxes, including
promotions.
original_item_tax_total:
type: number
title: original_item_tax_total
description: The tax total of the draft order's items excluding promotions.
item_total:
type: number
title: item_total
description: The total of the draft order's items including taxes and promotions.
item_subtotal:
type: number
title: item_subtotal
description: >-
The total of the draft order's items excluding taxes, including
promotions.
item_tax_total:
type: number
title: item_tax_total
description: The tax total of the draft order's items including promotions.
original_total:
type: number
title: original_total
description: The draft order's total excluding promotions, including taxes.
original_subtotal:
type: number
title: original_subtotal
description: The draft order's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The draft order's tax total, excluding promotions.
total:
type: number
title: total
description: The draft order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The draft order's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The draft order's tax total including promotions.
discount_total:
type: number
title: discount_total
description: The draft order's discount or promotions total.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of draft order's discount or promotion.
gift_card_total:
type: number
title: gift_card_total
description: The draft order's gift card total.
gift_card_tax_total:
type: number
title: gift_card_tax_total
description: The tax total of the draft order's gift card.
shipping_total:
type: number
title: shipping_total
description: The draft order's shipping total including taxes and promotions.
shipping_subtotal:
type: number
title: shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
shipping_tax_total:
type: number
title: shipping_tax_total
description: The tax total of the draft order's shipping.
original_shipping_total:
type: number
title: original_shipping_total
description: The draft order's shipping total including taxes, excluding promotions.
original_shipping_subtotal:
type: number
title: original_shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
original_shipping_tax_total:
type: number
title: original_shipping_tax_total
description: The tax total of the draft order's shipping excluding promotions.
@@ -0,0 +1,26 @@
type: object
description: The list of draft orders with pagination fields.
x-schemaName: AdminDraftOrderListResponse
required:
- limit
- offset
- count
- draft_orders
properties:
limit:
type: number
title: limit
description: The maximum number of items retrieved.
offset:
type: number
title: offset
description: The number of items skipped before retrieving the returned items.
count:
type: number
title: count
description: The total count of items available.
draft_orders:
type: array
description: The list of draft orders.
items:
$ref: ./AdminDraftOrder.yaml
@@ -5,4 +5,4 @@ required:
- draft_order
properties:
draft_order:
$ref: ./AdminOrder.yaml
$ref: ./AdminDraftOrder.yaml
@@ -0,0 +1,108 @@
type: object
description: The data to update in the draft order.
x-schemaName: AdminUpdateDraftOrder
properties:
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
shipping_address:
type: object
description: The draft order's shipping address.
properties:
first_name:
type: string
title: first_name
description: The shipping address's first name.
last_name:
type: string
title: last_name
description: The shipping address's last name.
phone:
type: string
title: phone
description: The shipping address's phone.
company:
type: string
title: company
description: The shipping address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The shipping address's city.
country_code:
type: string
title: country_code
description: The shipping address's country code.
example: us
province:
type: string
title: province
description: The shipping address's province.
postal_code:
type: string
title: postal_code
description: The shipping address's postal code.
metadata:
type: object
description: The shipping address's metadata, can hold custom key-value pairs.
billing_address:
type: object
description: The draft order's billing address.
properties:
first_name:
type: string
title: first_name
description: The billing address's first name.
last_name:
type: string
title: last_name
description: The billing address's last name.
phone:
type: string
title: phone
description: The billing address's phone.
company:
type: string
title: company
description: The billing address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The billing address's city.
country_code:
type: string
title: country_code
description: The billing address's country code.
example: us
province:
type: string
title: province
description: The billing address's province.
postal_code:
type: string
title: postal_code
description: The billing address's postal code.
metadata:
type: object
description: The billing address's metadata, can hold custom key-value pairs.
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
@@ -2,49 +2,14 @@ type: object
description: The order's summary details.
x-schemaName: BaseOrderSummary
required:
- total
- subtotal
- total_tax
- ordered_total
- fulfilled_total
- returned_total
- return_request_total
- write_off_total
- pending_difference
- current_order_total
- original_order_total
- transaction_total
- paid_total
- refunded_total
- accounting_total
properties:
total:
type: number
title: total
description: The order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The order's total excluding taxes, including promotions.
total_tax:
type: number
title: total_tax
description: The order's total taxes.
ordered_total:
type: number
title: ordered_total
description: The order's total when it was placed.
fulfilled_total:
type: number
title: fulfilled_total
description: The total of the fulfilled items of the order.
returned_total:
type: number
title: returned_total
description: The total of the order's returned items.
return_request_total:
type: number
title: return_request_total
description: The total of the items requested to be returned.
write_off_total:
type: number
title: write_off_total
description: The total of the items removed from the order.
paid_total:
type: number
title: paid_total
@@ -53,3 +18,25 @@ properties:
type: number
title: refunded_total
description: The total amount refunded.
pending_difference:
type: number
title: pending_difference
description: >-
The difference pending to be processed. If negative, the customer needs a
refund. Otherwise, additional payment is required from the customer.
current_order_total:
type: number
title: current_order_total
description: The order's current total, could be the total after a change in the order.
original_order_total:
type: number
title: original_order_total
description: The order's original total.
transaction_total:
type: number
title: transaction_total
description: The total of the transactions made on the order.
accounting_total:
type: number
title: accounting_total
description: The order's total without the credit-line total.
@@ -59,6 +59,8 @@ properties:
- awaiting
- authorized
- partially_authorized
- completed
- failed
payment_providers:
type: array
description: >-
@@ -1,6 +1,13 @@
type: object
description: The payment session's details.
x-schemaName: BasePaymentSession
required:
- id
- amount
- currency_code
- provider_id
- data
- status
properties:
id:
type: string
@@ -26,7 +33,7 @@ properties:
payment.
externalDocs:
url: >-
https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-session#data-property
https://docs.medusajs.com/resources/commerce-modules/payment/payment-session#data-property
context:
type: object
description: The context around the payment, such as the customer's details.
@@ -37,12 +44,12 @@ properties:
type: string
description: The payment session's status.
enum:
- error
- authorized
- captured
- canceled
- captured
- pending
- requires_more
- error
authorized_at:
type: string
title: authorized_at
@@ -52,10 +59,3 @@ properties:
type: object
payment:
$ref: ./BasePayment.yaml
required:
- id
- amount
- currency_code
- provider_id
- data
- status
@@ -4,6 +4,7 @@ x-schemaName: OrderTransaction
required:
- id
- order_id
- version
- order
- amount
- currency_code
@@ -59,3 +60,7 @@ properties:
description: The date that the transaction was updated.
order:
type: object
version:
type: number
title: version
description: The order version that the transaction belongs to.
@@ -14,6 +14,7 @@ required:
- amount
- prices
- calculated_price
- insufficient_inventory
properties:
id:
type: string
@@ -101,3 +102,9 @@ properties:
$ref: ./StorePrice.yaml
calculated_price:
$ref: ./StoreCalculatedPrice.yaml
insufficient_inventory:
type: boolean
title: insufficient_inventory
description: >-
Whether the shipping option's location doesn't have sufficient quantity
for any of the cart's items.
@@ -9043,7 +9043,6 @@ components:
x-schemaName: AdminCreateProduct
required:
- title
- shipping_profile_id
- options
properties:
title:
@@ -10899,6 +10898,277 @@ components:
type: boolean
title: deleted
description: Whether the object was deleted.
AdminDraftOrder:
type: object
description: The draft order's details.
x-schemaName: AdminDraftOrder
required:
- payment_collections
- items
- shipping_methods
- status
- currency_code
- id
- version
- region_id
- customer_id
- sales_channel_id
- email
- payment_status
- fulfillment_status
- summary
- created_at
- updated_at
- original_item_total
- original_item_subtotal
- original_item_tax_total
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- gift_card_total
- gift_card_tax_total
- shipping_total
- shipping_subtotal
- shipping_tax_total
- original_shipping_total
- original_shipping_subtotal
- original_shipping_tax_total
properties:
payment_collections:
type: array
description: The draft order's payment collections.
items:
$ref: '#/components/schemas/AdminPaymentCollection'
fulfillments:
type: array
description: The draft order's fulfillments.
items:
$ref: '#/components/schemas/AdminOrderFulfillment'
sales_channel:
$ref: '#/components/schemas/AdminSalesChannel'
customer:
$ref: '#/components/schemas/AdminCustomer'
shipping_address:
$ref: '#/components/schemas/AdminOrderAddress'
billing_address:
$ref: '#/components/schemas/AdminOrderAddress'
items:
type: array
description: The draft order's items.
items:
$ref: '#/components/schemas/AdminOrderLineItem'
shipping_methods:
type: array
description: The draft order's shipping methods.
items:
$ref: '#/components/schemas/AdminOrderShippingMethod'
status:
type: string
title: status
description: The draft order's status.
currency_code:
type: string
title: currency_code
description: The draft order's currency code.
example: usd
id:
type: string
title: id
description: The draft order's ID.
version:
type: number
title: version
description: The draft order's version.
region_id:
type: string
title: region_id
description: The ID of the region associated with the draft order.
customer_id:
type: string
title: customer_id
description: The ID of the customer that the draft order belongs to.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel that the draft order is placed in.
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
display_id:
type: number
title: display_id
description: The draft order's display ID.
payment_status:
type: string
description: The draft order's payment status.
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- canceled
- captured
- partially_captured
- partially_refunded
- refunded
- requires_action
fulfillment_status:
type: string
description: The draft order's fulfillment status.
enum:
- canceled
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_delivered
- delivered
transactions:
type: array
description: The draft order's transactions.
items:
$ref: '#/components/schemas/BaseOrderTransaction'
summary:
$ref: '#/components/schemas/BaseOrderSummary'
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the draft order was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the draft order was updated.
original_item_total:
type: number
title: original_item_total
description: The total of the draft order's items including taxes, excluding promotions.
original_item_subtotal:
type: number
title: original_item_subtotal
description: The total of the draft order's items excluding taxes, including promotions.
original_item_tax_total:
type: number
title: original_item_tax_total
description: The tax total of the draft order's items excluding promotions.
item_total:
type: number
title: item_total
description: The total of the draft order's items including taxes and promotions.
item_subtotal:
type: number
title: item_subtotal
description: The total of the draft order's items excluding taxes, including promotions.
item_tax_total:
type: number
title: item_tax_total
description: The tax total of the draft order's items including promotions.
original_total:
type: number
title: original_total
description: The draft order's total excluding promotions, including taxes.
original_subtotal:
type: number
title: original_subtotal
description: The draft order's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The draft order's tax total, excluding promotions.
total:
type: number
title: total
description: The draft order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The draft order's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The draft order's tax total including promotions.
discount_total:
type: number
title: discount_total
description: The draft order's discount or promotions total.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of draft order's discount or promotion.
gift_card_total:
type: number
title: gift_card_total
description: The draft order's gift card total.
gift_card_tax_total:
type: number
title: gift_card_tax_total
description: The tax total of the draft order's gift card.
shipping_total:
type: number
title: shipping_total
description: The draft order's shipping total including taxes and promotions.
shipping_subtotal:
type: number
title: shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
shipping_tax_total:
type: number
title: shipping_tax_total
description: The tax total of the draft order's shipping.
original_shipping_total:
type: number
title: original_shipping_total
description: The draft order's shipping total including taxes, excluding promotions.
original_shipping_subtotal:
type: number
title: original_shipping_subtotal
description: The draft order's shipping total excluding taxes, including promotions.
original_shipping_tax_total:
type: number
title: original_shipping_tax_total
description: The tax total of the draft order's shipping excluding promotions.
AdminDraftOrderListResponse:
type: object
description: The list of draft orders with pagination fields.
x-schemaName: AdminDraftOrderListResponse
required:
- limit
- offset
- count
- draft_orders
properties:
limit:
type: number
title: limit
description: The maximum number of items retrieved.
offset:
type: number
title: offset
description: The number of items skipped before retrieving the returned items.
count:
type: number
title: count
description: The total count of items available.
draft_orders:
type: array
description: The list of draft orders.
items:
$ref: '#/components/schemas/AdminDraftOrder'
AdminDraftOrderResponse:
type: object
description: The draft order's details.
@@ -10907,7 +11177,7 @@ components:
- draft_order
properties:
draft_order:
$ref: '#/components/schemas/AdminOrder'
$ref: '#/components/schemas/AdminDraftOrder'
AdminExchange:
type: object
description: The exchange's details.
@@ -18001,6 +18271,115 @@ components:
metadata:
type: object
description: The customer group's metadata, can hold custom key-value pairs.
AdminUpdateDraftOrder:
type: object
description: The data to update in the draft order.
x-schemaName: AdminUpdateDraftOrder
properties:
email:
type: string
title: email
description: The customer email associated with the draft order.
format: email
shipping_address:
type: object
description: The draft order's shipping address.
properties:
first_name:
type: string
title: first_name
description: The shipping address's first name.
last_name:
type: string
title: last_name
description: The shipping address's last name.
phone:
type: string
title: phone
description: The shipping address's phone.
company:
type: string
title: company
description: The shipping address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The shipping address's city.
country_code:
type: string
title: country_code
description: The shipping address's country code.
example: us
province:
type: string
title: province
description: The shipping address's province.
postal_code:
type: string
title: postal_code
description: The shipping address's postal code.
metadata:
type: object
description: The shipping address's metadata, can hold custom key-value pairs.
billing_address:
type: object
description: The draft order's billing address.
properties:
first_name:
type: string
title: first_name
description: The billing address's first name.
last_name:
type: string
title: last_name
description: The billing address's last name.
phone:
type: string
title: phone
description: The billing address's phone.
company:
type: string
title: company
description: The billing address's company.
address_1:
type: string
title: address_1
description: The first address line.
address_2:
type: string
title: address_2
description: The second address line.
city:
type: string
title: city
description: The billing address's city.
country_code:
type: string
title: country_code
description: The billing address's country code.
example: us
province:
type: string
title: province
description: The billing address's province.
postal_code:
type: string
title: postal_code
description: The billing address's postal code.
metadata:
type: object
description: The billing address's metadata, can hold custom key-value pairs.
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
AdminUpdateOrder:
type: object
description: The details to update in the order.
@@ -21156,49 +21535,14 @@ components:
description: The order's summary details.
x-schemaName: BaseOrderSummary
required:
- total
- subtotal
- total_tax
- ordered_total
- fulfilled_total
- returned_total
- return_request_total
- write_off_total
- pending_difference
- current_order_total
- original_order_total
- transaction_total
- paid_total
- refunded_total
- accounting_total
properties:
total:
type: number
title: total
description: The order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The order's total excluding taxes, including promotions.
total_tax:
type: number
title: total_tax
description: The order's total taxes.
ordered_total:
type: number
title: ordered_total
description: The order's total when it was placed.
fulfilled_total:
type: number
title: fulfilled_total
description: The total of the fulfilled items of the order.
returned_total:
type: number
title: returned_total
description: The total of the order's returned items.
return_request_total:
type: number
title: return_request_total
description: The total of the items requested to be returned.
write_off_total:
type: number
title: write_off_total
description: The total of the items removed from the order.
paid_total:
type: number
title: paid_total
@@ -21207,6 +21551,26 @@ components:
type: number
title: refunded_total
description: The total amount refunded.
pending_difference:
type: number
title: pending_difference
description: The difference pending to be processed. If negative, the customer needs a refund. Otherwise, additional payment is required from the customer.
current_order_total:
type: number
title: current_order_total
description: The order's current total, could be the total after a change in the order.
original_order_total:
type: number
title: original_order_total
description: The order's original total.
transaction_total:
type: number
title: transaction_total
description: The total of the transactions made on the order.
accounting_total:
type: number
title: accounting_total
description: The order's total without the credit-line total.
BaseOrderTransaction:
type: object
description: An order transaction's details.
@@ -21402,6 +21766,8 @@ components:
- awaiting
- authorized
- partially_authorized
- completed
- failed
payment_providers:
type: array
description: The payment provider used to process the collection's payments and sessions.
@@ -21432,6 +21798,13 @@ components:
type: object
description: The payment session's details.
x-schemaName: BasePaymentSession
required:
- id
- amount
- currency_code
- provider_id
- data
- status
properties:
id:
type: string
@@ -21454,7 +21827,7 @@ components:
type: object
description: The payment session's data, useful for the payment provider processing the payment.
externalDocs:
url: https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-session#data-property
url: https://docs.medusajs.com/resources/commerce-modules/payment/payment-session#data-property
context:
type: object
description: The context around the payment, such as the customer's details.
@@ -21465,12 +21838,12 @@ components:
type: string
description: The payment session's status.
enum:
- error
- authorized
- captured
- canceled
- captured
- pending
- requires_more
- error
authorized_at:
type: string
title: authorized_at
@@ -21480,13 +21853,6 @@ components:
type: object
payment:
$ref: '#/components/schemas/BasePayment'
required:
- id
- amount
- currency_code
- provider_id
- data
- status
BaseProduct:
type: object
description: The product's details.
@@ -24395,6 +24761,7 @@ components:
required:
- id
- order_id
- version
- order
- amount
- currency_code
@@ -24447,6 +24814,10 @@ components:
description: The date that the transaction was updated.
order:
type: object
version:
type: number
title: version
description: The order version that the transaction belongs to.
RefundReason:
type: object
description: The refund reason's details.
@@ -25679,6 +26050,7 @@ components:
- amount
- prices
- calculated_price
- insufficient_inventory
properties:
id:
type: string
@@ -25762,6 +26134,10 @@ components:
$ref: '#/components/schemas/StorePrice'
calculated_price:
$ref: '#/components/schemas/StoreCalculatedPrice'
insufficient_inventory:
type: boolean
title: insufficient_inventory
description: Whether the shipping option's location doesn't have sufficient quantity for any of the cart's items.
StoreCollection:
type: object
description: The collection's details.
File diff suppressed because it is too large Load Diff
@@ -106,6 +106,8 @@ tags:
externalDocs:
description: Learn more about the Order Module
url: https://docs.medusajs.com/v2/resources/commerce-modules/order
x-associatedSchema:
$ref: "#/components/schemas/AdminDraftOrder"
- name: Exchanges
description: >
An exchange is the replacement of an item that the customer ordered with
@@ -1481,33 +1481,7 @@
* content:
* application/json:
* schema:
* allOf:
* - type: object
* description: The paginated list of draft orders.
* required:
* - limit
* - offset
* - count
* properties:
* limit:
* type: number
* title: limit
* description: The maximum number of items returned.
* offset:
* type: number
* title: offset
* description: The number of items skipped before retrieving the returned items.
* count:
* type: number
* title: count
* description: The total number of items.
* - type: object
* description: The paginated list of draft orders.
* required:
* - draft_orders
* properties:
* draft_orders:
* $ref: "#/components/schemas/AdminOrder"
* $ref: "#/components/schemas/AdminDraftOrderListResponse"
* "400":
* $ref: "#/components/responses/400_error"
* "401":
@@ -1520,6 +1494,7 @@
* $ref: "#/components/responses/invalid_request_error"
* "500":
* $ref: "#/components/responses/500_error"
* x-workflow: getOrdersListWorkflow
*
*/
@@ -11,6 +11,20 @@
* required: true
* schema:
* type: string
* - name: fields
* in: query
* description: |-
* Comma-separated fields that should be included in the returned data.
* if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.
* without prefix it will replace the entire default fields.
* required: false
* schema:
* type: string
* title: fields
* description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
* fields. Without prefix it will replace the entire default fields.
* externalDocs:
* url: "#select-fields-and-relations"
* security:
* - api_token: []
* - cookie_auth: []
@@ -42,6 +56,7 @@
* $ref: "#/components/responses/invalid_request_error"
* "500":
* $ref: "#/components/responses/500_error"
* x-workflow: getOrderDetailWorkflow
*
*/
@@ -0,0 +1,67 @@
/**
* @oas [post] /admin/draft-orders/{id}
* operationId: PostDraftOrdersId
* summary: Update a Draft Order
* description: Update a draft order's details.
* x-authenticated: true
* parameters:
* - name: id
* in: path
* description: The draft order's ID.
* required: true
* schema:
* type: string
* - name: fields
* in: query
* description: |-
* Comma-separated fields that should be included in the returned data.
* if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.
* without prefix it will replace the entire default fields.
* required: false
* schema:
* type: string
* title: fields
* description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
* fields. Without prefix it will replace the entire default fields.
* externalDocs:
* url: "#select-fields-and-relations"
* security:
* - api_token: []
* - cookie_auth: []
* - jwt_token: []
* requestBody:
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/AdminUpdateDraftOrder"
* x-codeSamples:
* - lang: Shell
* label: cURL
* source: |-
* curl -X POST '{backend_url}/admin/draft-orders/{id}' \
* -H 'Authorization: Bearer {access_token}'
* tags:
* - Draft Orders
* responses:
* "200":
* description: OK
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/AdminDraftOrderResponse"
* "400":
* $ref: "#/components/responses/400_error"
* "401":
* $ref: "#/components/responses/unauthorized"
* "404":
* $ref: "#/components/responses/not_found_error"
* "409":
* $ref: "#/components/responses/invalid_state_error"
* "422":
* $ref: "#/components/responses/invalid_request_error"
* "500":
* $ref: "#/components/responses/500_error"
* x-workflow: updateOrderWorkflow
*
*/
@@ -31,7 +31,12 @@
* label: cURL
* source: |-
* curl -X POST '{backend_url}/admin/products/batch' \
* -H 'Authorization: Bearer {access_token}'
* -H 'Authorization: Bearer {access_token}' \
* --data-raw '{
* "delete": [
* "prod_123"
* ]
* }'
* tags:
* - Products
* responses:
@@ -5,7 +5,6 @@
* x-schemaName: AdminCreateProduct
* required:
* - title
* - shipping_profile_id
* - options
* properties:
* title:
@@ -0,0 +1,248 @@
/**
* @schema AdminDraftOrder
* type: object
* description: The draft order's details.
* x-schemaName: AdminDraftOrder
* required:
* - payment_collections
* - items
* - shipping_methods
* - status
* - currency_code
* - id
* - version
* - region_id
* - customer_id
* - sales_channel_id
* - email
* - payment_status
* - fulfillment_status
* - summary
* - created_at
* - updated_at
* - original_item_total
* - original_item_subtotal
* - original_item_tax_total
* - item_total
* - item_subtotal
* - item_tax_total
* - original_total
* - original_subtotal
* - original_tax_total
* - total
* - subtotal
* - tax_total
* - discount_total
* - discount_tax_total
* - gift_card_total
* - gift_card_tax_total
* - shipping_total
* - shipping_subtotal
* - shipping_tax_total
* - original_shipping_total
* - original_shipping_subtotal
* - original_shipping_tax_total
* properties:
* payment_collections:
* type: array
* description: The draft order's payment collections.
* items:
* $ref: "#/components/schemas/AdminPaymentCollection"
* fulfillments:
* type: array
* description: The draft order's fulfillments.
* items:
* $ref: "#/components/schemas/AdminOrderFulfillment"
* sales_channel:
* $ref: "#/components/schemas/AdminSalesChannel"
* customer:
* $ref: "#/components/schemas/AdminCustomer"
* shipping_address:
* $ref: "#/components/schemas/AdminOrderAddress"
* billing_address:
* $ref: "#/components/schemas/AdminOrderAddress"
* items:
* type: array
* description: The draft order's items.
* items:
* $ref: "#/components/schemas/AdminOrderLineItem"
* shipping_methods:
* type: array
* description: The draft order's shipping methods.
* items:
* $ref: "#/components/schemas/AdminOrderShippingMethod"
* status:
* type: string
* title: status
* description: The draft order's status.
* currency_code:
* type: string
* title: currency_code
* description: The draft order's currency code.
* example: usd
* id:
* type: string
* title: id
* description: The draft order's ID.
* version:
* type: number
* title: version
* description: The draft order's version.
* region_id:
* type: string
* title: region_id
* description: The ID of the region associated with the draft order.
* customer_id:
* type: string
* title: customer_id
* description: The ID of the customer that the draft order belongs to.
* sales_channel_id:
* type: string
* title: sales_channel_id
* description: The ID of the sales channel that the draft order is placed in.
* email:
* type: string
* title: email
* description: The customer email associated with the draft order.
* format: email
* display_id:
* type: number
* title: display_id
* description: The draft order's display ID.
* payment_status:
* type: string
* description: The draft order's payment status.
* enum:
* - not_paid
* - awaiting
* - authorized
* - partially_authorized
* - canceled
* - captured
* - partially_captured
* - partially_refunded
* - refunded
* - requires_action
* fulfillment_status:
* type: string
* description: The draft order's fulfillment status.
* enum:
* - canceled
* - not_fulfilled
* - partially_fulfilled
* - fulfilled
* - partially_shipped
* - shipped
* - partially_delivered
* - delivered
* transactions:
* type: array
* description: The draft order's transactions.
* items:
* $ref: "#/components/schemas/BaseOrderTransaction"
* summary:
* $ref: "#/components/schemas/BaseOrderSummary"
* metadata:
* type: object
* description: The draft order's metadata, can hold custom key-value pairs.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The date the draft order was created.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The date the draft order was updated.
* original_item_total:
* type: number
* title: original_item_total
* description: The total of the draft order's items including taxes, excluding promotions.
* original_item_subtotal:
* type: number
* title: original_item_subtotal
* description: The total of the draft order's items excluding taxes, including promotions.
* original_item_tax_total:
* type: number
* title: original_item_tax_total
* description: The tax total of the draft order's items excluding promotions.
* item_total:
* type: number
* title: item_total
* description: The total of the draft order's items including taxes and promotions.
* item_subtotal:
* type: number
* title: item_subtotal
* description: The total of the draft order's items excluding taxes, including promotions.
* item_tax_total:
* type: number
* title: item_tax_total
* description: The tax total of the draft order's items including promotions.
* original_total:
* type: number
* title: original_total
* description: The draft order's total excluding promotions, including taxes.
* original_subtotal:
* type: number
* title: original_subtotal
* description: The draft order's total excluding taxes, including promotions.
* original_tax_total:
* type: number
* title: original_tax_total
* description: The draft order's tax total, excluding promotions.
* total:
* type: number
* title: total
* description: The draft order's total including taxes and promotions.
* subtotal:
* type: number
* title: subtotal
* description: The draft order's total excluding taxes, including promotions.
* tax_total:
* type: number
* title: tax_total
* description: The draft order's tax total including promotions.
* discount_total:
* type: number
* title: discount_total
* description: The draft order's discount or promotions total.
* discount_tax_total:
* type: number
* title: discount_tax_total
* description: The tax total of draft order's discount or promotion.
* gift_card_total:
* type: number
* title: gift_card_total
* description: The draft order's gift card total.
* gift_card_tax_total:
* type: number
* title: gift_card_tax_total
* description: The tax total of the draft order's gift card.
* shipping_total:
* type: number
* title: shipping_total
* description: The draft order's shipping total including taxes and promotions.
* shipping_subtotal:
* type: number
* title: shipping_subtotal
* description: The draft order's shipping total excluding taxes, including promotions.
* shipping_tax_total:
* type: number
* title: shipping_tax_total
* description: The tax total of the draft order's shipping.
* original_shipping_total:
* type: number
* title: original_shipping_total
* description: The draft order's shipping total including taxes, excluding promotions.
* original_shipping_subtotal:
* type: number
* title: original_shipping_subtotal
* description: The draft order's shipping total excluding taxes, including promotions.
* original_shipping_tax_total:
* type: number
* title: original_shipping_tax_total
* description: The tax total of the draft order's shipping excluding promotions.
*
*/
@@ -0,0 +1,31 @@
/**
* @schema AdminDraftOrderListResponse
* type: object
* description: The list of draft orders with pagination fields.
* x-schemaName: AdminDraftOrderListResponse
* required:
* - limit
* - offset
* - count
* - draft_orders
* properties:
* limit:
* type: number
* title: limit
* description: The maximum number of items retrieved.
* offset:
* type: number
* title: offset
* description: The number of items skipped before retrieving the returned items.
* count:
* type: number
* title: count
* description: The total count of items available.
* draft_orders:
* type: array
* description: The list of draft orders.
* items:
* $ref: "#/components/schemas/AdminDraftOrder"
*
*/
@@ -7,7 +7,7 @@
* - draft_order
* properties:
* draft_order:
* $ref: "#/components/schemas/AdminOrder"
* $ref: "#/components/schemas/AdminDraftOrder"
*
*/
@@ -0,0 +1,113 @@
/**
* @schema AdminUpdateDraftOrder
* type: object
* description: The data to update in the draft order.
* x-schemaName: AdminUpdateDraftOrder
* properties:
* email:
* type: string
* title: email
* description: The customer email associated with the draft order.
* format: email
* shipping_address:
* type: object
* description: The draft order's shipping address.
* properties:
* first_name:
* type: string
* title: first_name
* description: The shipping address's first name.
* last_name:
* type: string
* title: last_name
* description: The shipping address's last name.
* phone:
* type: string
* title: phone
* description: The shipping address's phone.
* company:
* type: string
* title: company
* description: The shipping address's company.
* address_1:
* type: string
* title: address_1
* description: The first address line.
* address_2:
* type: string
* title: address_2
* description: The second address line.
* city:
* type: string
* title: city
* description: The shipping address's city.
* country_code:
* type: string
* title: country_code
* description: The shipping address's country code.
* example: us
* province:
* type: string
* title: province
* description: The shipping address's province.
* postal_code:
* type: string
* title: postal_code
* description: The shipping address's postal code.
* metadata:
* type: object
* description: The shipping address's metadata, can hold custom key-value pairs.
* billing_address:
* type: object
* description: The draft order's billing address.
* properties:
* first_name:
* type: string
* title: first_name
* description: The billing address's first name.
* last_name:
* type: string
* title: last_name
* description: The billing address's last name.
* phone:
* type: string
* title: phone
* description: The billing address's phone.
* company:
* type: string
* title: company
* description: The billing address's company.
* address_1:
* type: string
* title: address_1
* description: The first address line.
* address_2:
* type: string
* title: address_2
* description: The second address line.
* city:
* type: string
* title: city
* description: The billing address's city.
* country_code:
* type: string
* title: country_code
* description: The billing address's country code.
* example: us
* province:
* type: string
* title: province
* description: The billing address's province.
* postal_code:
* type: string
* title: postal_code
* description: The billing address's postal code.
* metadata:
* type: object
* description: The billing address's metadata, can hold custom key-value pairs.
* metadata:
* type: object
* description: The draft order's metadata, can hold custom key-value pairs.
*
*/
@@ -4,49 +4,14 @@
* description: The order's summary details.
* x-schemaName: BaseOrderSummary
* required:
* - total
* - subtotal
* - total_tax
* - ordered_total
* - fulfilled_total
* - returned_total
* - return_request_total
* - write_off_total
* - pending_difference
* - current_order_total
* - original_order_total
* - transaction_total
* - paid_total
* - refunded_total
* - accounting_total
* properties:
* total:
* type: number
* title: total
* description: The order's total including taxes and promotions.
* subtotal:
* type: number
* title: subtotal
* description: The order's total excluding taxes, including promotions.
* total_tax:
* type: number
* title: total_tax
* description: The order's total taxes.
* ordered_total:
* type: number
* title: ordered_total
* description: The order's total when it was placed.
* fulfilled_total:
* type: number
* title: fulfilled_total
* description: The total of the fulfilled items of the order.
* returned_total:
* type: number
* title: returned_total
* description: The total of the order's returned items.
* return_request_total:
* type: number
* title: return_request_total
* description: The total of the items requested to be returned.
* write_off_total:
* type: number
* title: write_off_total
* description: The total of the items removed from the order.
* paid_total:
* type: number
* title: paid_total
@@ -55,6 +20,26 @@
* type: number
* title: refunded_total
* description: The total amount refunded.
* pending_difference:
* type: number
* title: pending_difference
* description: The difference pending to be processed. If negative, the customer needs a refund. Otherwise, additional payment is required from the customer.
* current_order_total:
* type: number
* title: current_order_total
* description: The order's current total, could be the total after a change in the order.
* original_order_total:
* type: number
* title: original_order_total
* description: The order's original total.
* transaction_total:
* type: number
* title: transaction_total
* description: The total of the transactions made on the order.
* accounting_total:
* type: number
* title: accounting_total
* description: The order's total without the credit-line total.
*
*/
@@ -61,6 +61,8 @@
* - awaiting
* - authorized
* - partially_authorized
* - completed
* - failed
* payment_providers:
* type: array
* description: The payment provider used to process the collection's payments and sessions.
@@ -3,6 +3,13 @@
* type: object
* description: The payment session's details.
* x-schemaName: BasePaymentSession
* required:
* - id
* - amount
* - currency_code
* - provider_id
* - data
* - status
* properties:
* id:
* type: string
@@ -25,7 +32,7 @@
* type: object
* description: The payment session's data, useful for the payment provider processing the payment.
* externalDocs:
* url: https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-session#data-property
* url: https://docs.medusajs.com/resources/commerce-modules/payment/payment-session#data-property
* context:
* type: object
* description: The context around the payment, such as the customer's details.
@@ -36,12 +43,12 @@
* type: string
* description: The payment session's status.
* enum:
* - error
* - authorized
* - captured
* - canceled
* - captured
* - pending
* - requires_more
* - error
* authorized_at:
* type: string
* title: authorized_at
@@ -51,13 +58,6 @@
* $ref: "#/components/schemas/BasePaymentCollection"
* payment:
* $ref: "#/components/schemas/BasePayment"
* required:
* - id
* - amount
* - currency_code
* - provider_id
* - data
* - status
*
*/
@@ -6,6 +6,7 @@
* required:
* - id
* - order_id
* - version
* - order
* - amount
* - currency_code
@@ -58,6 +59,10 @@
* description: The date that the transaction was updated.
* order:
* $ref: "#/components/schemas/Order"
* version:
* type: number
* title: version
* description: The order version that the transaction belongs to.
*
*/
@@ -16,6 +16,7 @@
* - amount
* - prices
* - calculated_price
* - insufficient_inventory
* properties:
* id:
* type: string
@@ -100,6 +101,10 @@
* $ref: "#/components/schemas/StorePrice"
* calculated_price:
* $ref: "#/components/schemas/StoreCalculatedPrice"
* insufficient_inventory:
* type: boolean
* title: insufficient_inventory
* description: Whether the shipping option's location doesn't have sufficient quantity for any of the cart's items.
*
*/
@@ -62,6 +62,17 @@ class OasKindGenerator extends FunctionKindGenerator {
public name = "oas"
protected allowedKinds: SyntaxKind[] = [ts.SyntaxKind.FunctionDeclaration]
private MAX_LEVEL = 7
readonly METHOD_NAMES = [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE",
"OPTIONS",
"HEAD",
"TRACE",
"CONNECT",
]
readonly REQUEST_TYPE_NAMES = [
"MedusaRequest",
"RequestWithContext",
@@ -146,8 +157,13 @@ class OasKindGenerator extends FunctionKindGenerator {
const functionNode = ts.isFunctionDeclaration(node)
? node
: this.extractFunctionNode(node as VariableNode)
const functionName = this.getFunctionName(node as FunctionOrVariableNode)
if (!functionNode || functionNode.parameters.length !== 2) {
if (
!functionNode ||
!this.METHOD_NAMES.includes(functionName) ||
functionNode.parameters.length !== 2
) {
return false
}
@@ -753,8 +769,10 @@ class OasKindGenerator extends FunctionKindGenerator {
}
return (
node as ts.VariableStatement
).declarationList.declarations[0].name.getText()
(
node as ts.VariableStatement
).declarationList?.declarations[0].name.getText() || ""
)
}
/**