From c789e01fdda5b62379be7bc014816b1b1b9eb178 Mon Sep 17 00:00:00 2001 From: --list Date: Thu, 24 Jun 2021 16:31:12 +0200 Subject: [PATCH] corrected indent and duplications --- docs/api/admin-spec3.yaml | 3156 +++++++++-------- docs/api/store-spec3.json | 1688 +++++---- docs/api/store-spec3.yaml | 1407 ++++---- .../admin/draft-orders/update-draft-order.js | 2 +- .../routes/admin/returns/receive-return.js | 1 - .../medusa/src/services/__tests__/swap.js | 2 - packages/medusa/src/services/notification.js | 4 - packages/medusa/src/services/order.js | 2 - 8 files changed, 3120 insertions(+), 3142 deletions(-) diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 2301d0681f..f2e31cce28 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -85,148 +85,6 @@ paths: properties: user: $ref: '#/components/schemas/user' - /collections: - post: - operationId: PostCollections - summary: Create a Product Collection - description: Creates a Product Collection. - requestBody: - content: - application/json: - schema: - required: - - title - properties: - title: - type: string - description: The title to identify the Collection by. - handle: - type: string - description: >- - An optional handle to be used in slugs, if none is provided - we will kebab-case the title. - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: '#/components/schemas/product_collection' - get: - operationId: GetCollections - summary: List Product Collections - description: Retrieve a list of Product Collection. - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: '#/components/schemas/product_collection' - '/collections/{id}': - delete: - operationId: DeleteCollectionsCollection - summary: Delete a Product Collection - description: Deletes a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Collection. - schema: - type: string - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - id: - type: string - description: The id of the deleted Collection - object: - type: string - description: The type of the object that was deleted. - deleted: - type: boolean - get: - operationId: GetCollectionsCollection - summary: Retrieve a Product Collection - description: Retrieves a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Product Collection - schema: - type: string - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: '#/components/schemas/product_collection' - post: - operationId: PostCollectionsCollection - summary: Update a Product Collection - description: Updates a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Collection. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - title: - type: string - description: The title to identify the Collection by. - handle: - type: string - description: >- - An optional handle to be used in slugs, if none is provided - we will kebab-case the title. - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: '#/components/schemas/product_collection' '/discounts/{id}/regions/{region_id}': post: operationId: PostDiscountsDiscountRegionsRegion @@ -608,46 +466,33 @@ paths: properties: discount: $ref: '#/components/schemas/discount' - /gift-cards: + /collections: post: - operationId: PostGiftCards - summary: Create a Gift Card - description: >- - Creates a Gift Card that can redeemed by its unique code. The Gift Card - is only valid within 1 region. + operationId: PostCollections + summary: Create a Product Collection + description: Creates a Product Collection. requestBody: content: application/json: schema: + required: + - title properties: - value: - type: integer - description: >- - The value (excluding VAT) that the Gift Card should - represent. - is_disabled: - type: boolean - description: >- - Whether the Gift Card is disabled on creation. You will have - to enable it later to make it available to Customers. - ends_at: + title: + type: string + description: The title to identify the Collection by. + handle: type: string - format: date-time description: >- - The time at which the Gift Card should no longer be - available. - region_id: - description: The id of the Region in which the Gift Card can be used. - type: array - items: - type: string + An optional handle to be used in slugs, if none is provided + we will kebab-case the title. metadata: description: >- An optional set of key-value pairs to hold additional information. type: object tags: - - Gift Card + - Collection responses: '200': description: OK @@ -655,14 +500,14 @@ paths: application/json: schema: properties: - gift_card: - $ref: '#/components/schemas/gift_card' + collection: + $ref: '#/components/schemas/product_collection' get: - operationId: GetGiftCards - summary: List Gift Cards - description: Retrieves a list of Gift Cards. + operationId: GetCollections + summary: List Product Collections + description: Retrieve a list of Product Collection. tags: - - Gift Card + - Collection responses: '200': description: OK @@ -670,24 +515,22 @@ paths: application/json: schema: properties: - gift_cards: - type: array - items: - $ref: '#/components/schemas/gift_card' - '/gift-cards/{id}': + collection: + $ref: '#/components/schemas/product_collection' + '/collections/{id}': delete: - operationId: DeleteGiftCardsGiftCard - summary: Delete a Gift Card - description: Deletes a Gift Card + operationId: DeleteCollectionsCollection + summary: Delete a Product Collection + description: Deletes a Product Collection. parameters: - in: path name: id required: true - description: The id of the Gift Card to delete. + description: The id of the Collection. schema: type: string tags: - - Gift Card + - Collection responses: '200': description: OK @@ -697,25 +540,25 @@ paths: properties: id: type: string - description: The id of the deleted Gift Card + description: The id of the deleted Collection object: type: string description: The type of the object that was deleted. deleted: type: boolean get: - operationId: GetGiftCardsGiftCard - summary: Retrieve a Gift Card - description: Retrieves a Gift Card. + operationId: GetCollectionsCollection + summary: Retrieve a Product Collection + description: Retrieves a Product Collection. parameters: - in: path name: id required: true - description: The id of the Gift Card. + description: The id of the Product Collection schema: type: string tags: - - Gift Card + - Collection responses: '200': description: OK @@ -723,19 +566,17 @@ paths: application/json: schema: properties: - gift_card: - $ref: '#/components/schemas/gift_card' + collection: + $ref: '#/components/schemas/product_collection' post: - operationId: PostGiftCardsGiftCard - summary: Create a Gift Card - description: >- - Creates a Gift Card that can redeemed by its unique code. The Gift Card - is only valid within 1 region. + operationId: PostCollectionsCollection + summary: Update a Product Collection + description: Updates a Product Collection. parameters: - in: path name: id required: true - description: The id of the Gift Card. + description: The id of the Collection. schema: type: string requestBody: @@ -743,34 +584,21 @@ paths: application/json: schema: properties: - balance: - type: integer - description: >- - The value (excluding VAT) that the Gift Card should - represent. - is_disabled: - type: boolean - description: >- - Whether the Gift Card is disabled on creation. You will have - to enable it later to make it available to Customers. - ends_at: + title: + type: string + description: The title to identify the Collection by. + handle: type: string - format: date-time description: >- - The time at which the Gift Card should no longer be - available. - region_id: - description: The id of the Region in which the Gift Card can be used. - type: array - items: - type: string + An optional handle to be used in slugs, if none is provided + we will kebab-case the title. metadata: description: >- An optional set of key-value pairs to hold additional information. type: object tags: - - Gift Card + - Collection responses: '200': description: OK @@ -778,8 +606,8 @@ paths: application/json: schema: properties: - gift_card: - $ref: '#/components/schemas/gift_card' + collection: + $ref: '#/components/schemas/product_collection' /customers: post: operationId: PostCustomers @@ -955,6 +783,11 @@ paths: customer_id: description: The id of the customer to add on the draft order type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine + use of notifications. + type: boolean shipping_methods: description: The shipping methods for the draft order type: array @@ -1218,6 +1051,11 @@ paths: code: description: The code that a Discount is identifed by. type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine + use of notifications. + type: boolean customer_id: description: The id of the Customer to associate the Draft Order with. type: string @@ -1232,6 +1070,178 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' + /gift-cards: + post: + operationId: PostGiftCards + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + requestBody: + content: + application/json: + schema: + properties: + value: + type: integer + description: >- + The value (excluding VAT) that the Gift Card should + represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have + to enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: >- + The time at which the Gift Card should no longer be + available. + region_id: + description: The id of the Region in which the Gift Card can be used. + type: array + items: + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + get: + operationId: GetGiftCards + summary: List Gift Cards + description: Retrieves a list of Gift Cards. + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_cards: + type: array + items: + $ref: '#/components/schemas/gift_card' + '/gift-cards/{id}': + delete: + operationId: DeleteGiftCardsGiftCard + summary: Delete a Gift Card + description: Deletes a Gift Card + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card to delete. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The id of the deleted Gift Card + object: + type: string + description: The type of the object that was deleted. + deleted: + type: boolean + get: + operationId: GetGiftCardsGiftCard + summary: Retrieve a Gift Card + description: Retrieves a Gift Card. + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + post: + operationId: PostGiftCardsGiftCard + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + balance: + type: integer + description: >- + The value (excluding VAT) that the Gift Card should + represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have + to enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: >- + The time at which the Gift Card should no longer be + available. + region_id: + description: The id of the Region in which the Gift Card can be used. + type: array + items: + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' /notifications: get: operationId: GetNotifications @@ -1275,1322 +1285,6 @@ paths: properties: notification: $ref: '#/components/schemas/notification' - '/orders/{id}/shipping-methods': - post: - operationId: PostOrdersOrderShippingMethods - summary: Add a Shipping Method - description: >- - Adds a Shipping Method to an Order. If another Shipping Method exists - with the same Shipping Profile, the previous Shipping Method will be - replaced. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - requestBody: - content: - application/json: - schema: - type: object - required: - - price - - option_id - - data - properties: - price: - type: integer - description: >- - The price (excluding VAT) that should be charged for the - Shipping Method - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping Method - from. - data: - type: object - description: >- - The data required for the Shipping Option to create a - Shipping Method. This will depend on the Fulfillment - Provider. - '/orders/{id}/cancel': - post: - operationId: PostOrdersOrderCancel - summary: Cancel an Order - description: >- - Registers an Order as canceled. This triggers a flow that will cancel - any created Fulfillments and Payments, may fail if the Payment or - Fulfillment Provider is unable to cancel the Payment/Fulfillment. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/capture': - post: - operationId: PostOrdersOrderCapture - summary: Capture an Order - description: Captures all the Payments associated with an Order. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/claims/{claim_id}/shipments': - post: - operationId: PostOrdersOrderClaimsClaimShipments - summary: Create Claim Shipment - description: Registers a Claim Fulfillment as shipped. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The id of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - fulfillment_id: - description: The id of the Fulfillment. - type: string - tracking_numbers: - description: The tracking numbers for the shipment. - type: array - items: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/order/{id}/claims': - post: - operationId: PostOrdersOrderClaims - summary: Create a Claim - description: Creates a Claim. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - type: - description: >- - The type of the Claim. This will determine how the Claim is - treated: `replace` Claims will result in a Fulfillment with - new items being created, while a `refund` Claim will refund - the amount paid for the claimed items. - type: string - enum: - - replace - - refund - claim_items: - description: The Claim Items that the Claim will consist of. - type: array - items: - properties: - item_id: - description: The id of the Line Item that will be claimed. - type: string - quantity: - description: The number of items that will be returned - type: integer - note: - description: >- - Short text describing the Claim Item in further - detail. - type: string - reason: - description: The reason for the Claim - type: string - enum: - - missing_item - - wrong_item - - production_failure - - other - tags: - description: A list o tags to add to the Claim Item - type: array - items: - type: string - images: - description: >- - A list of image URL's that will be associated with the - Claim - items: - type: string - return_shipping: - description: >- - Optional details for the Return Shipping Method, if the - items are to be sent back. - type: object - properties: - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping - Method from. - price: - type: integer - description: The price to charge for the Shipping Method. - additional_items: - description: >- - The new items to send to the Customer when the Claim type is - Replace. - type: array - items: - properties: - variant_id: - description: The id of the Product Variant to ship. - type: string - quantity: - description: The quantity of the Product Variant to ship. - type: integer - shipping_methods: - description: The Shipping Methods to send the additional Line Items with. - type: array - items: - properties: - id: - description: The id of an existing Shipping Method - type: string - option_id: - description: >- - The id of the Shipping Option to create a Shipping - Method from - type: string - price: - description: The price to charge for the Shipping Method - type: integer - shipping_address: - type: object - description: >- - An optional shipping address to send the claim to. Defaults - to the parent order's shipping address - refund_amount: - description: >- - The amount to refund the Customer when the Claim type is - `refund`. - type: integer - no_notification: - description: >- - If set to true no notification will be send related to this - Claim. - type: boolean - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/fulfillments': - post: - operationId: PostOrdersOrderFulfillments - summary: Create a Fulfillment - description: >- - Creates a Fulfillment of an Order - will notify Fulfillment Providers to - prepare a shipment. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - items: - description: The Line Items to include in the Fulfillment. - type: array - items: - properties: - item_id: - description: The id of Line Item to fulfill. - type: string - quantity: - description: The quantity of the Line Item to fulfill. - type: integer - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/shipment': - post: - operationId: PostOrdersOrderShipment - summary: Create a Shipment - description: Registers a Fulfillment as shipped. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - fulfillment_id: - description: The id of the Fulfillment. - type: string - tracking_numbers: - description: The tracking numbers for the shipment. - type: array - items: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/swaps/{swap_id}/shipments': - post: - operationId: PostOrdersOrderSwapsSwapShipments - summary: Create Swap Shipment - description: Registers a Swap Fulfillment as shipped. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The id of the Swap. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - fulfillment_id: - description: The id of the Fulfillment. - type: string - tracking_numbers: - description: The tracking numbers for the shipment. - type: array - items: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/order/{id}/swaps': - post: - operationId: PostOrdersOrderSwaps - summary: Create a Swap - description: >- - Creates a Swap. Swaps are used to handle Return of previously purchased - goods and Fulfillment of replacements simultaneously. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - return_items: - description: The Line Items to return as part of the Swap. - type: array - items: - properties: - item_id: - description: The id of the Line Item that will be claimed. - type: string - quantity: - description: The number of items that will be returned - type: integer - return_shipping: - description: How the Swap will be returned. - type: object - properties: - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping - Method from. - price: - type: integer - description: The price to charge for the Shipping Method. - additional_items: - description: The new items to send to the Customer. - type: array - items: - properties: - variant_id: - description: The id of the Product Variant to ship. - type: string - quantity: - description: The quantity of the Product Variant to ship. - type: integer - no_notification: - description: >- - If set to true no notification will be send related to this - Swap. - type: boolean - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/order/{id}/metadata/{key}': - delete: - operationId: DeleteOrdersOrderMetadataKey - summary: Delete Metadata - description: Deletes a metadata key. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: key - required: true - description: The metadata key. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/claims/{claim_id}/fulfillments': - post: - operationId: PostOrdersOrderClaimsClaimFulfillments - summary: Create a Claim Fulfillment - description: Creates a Fulfillment for a Claim. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The id of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/swaps/{swap_id}/fulfillments': - post: - operationId: PostOrdersOrderSwapsSwapFulfillments - summary: Create a Swap Fulfillment - description: Creates a Fulfillment for a Swap. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The id of the Swap. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Retrieve an Order - description: Retrieves an Order - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - /orders: - get: - operationId: GetOrders - summary: List Orders - description: Retrieves a list of Orders - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - orders: - type: array - items: - $ref: '#/components/schemas/order' - '/orders/{id}/swaps/{swap_id}/process-payment': - post: - operationId: PostOrdersOrderSwapsSwapProcessPayment - summary: Process a Swap difference - description: >- - When there are differences between the returned and shipped Products in - a Swap, the difference must be processed. Either a Refund will be issued - or a Payment will be captured. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The id of the Swap. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/swaps/{swap_id}/receive': - post: - operationId: PostOrdersOrderSwapsSwapReceive - summary: Receive a Swap - description: Registers a Swap as received. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The id of the Swap. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - items: - description: The Line Items that have been received. - type: array - items: - properties: - item_id: - description: The id of the Line Item. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/refunds': - post: - operationId: PostOrdersOrderRefunds - summary: Create a Refund - description: Issues a Refund. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - required: - - amount - - reason - properties: - amount: - description: The amount to refund. - type: integer - reason: - description: The reason for the Refund. - type: string - note: - description: A not with additional details about the Refund. - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/returns': - post: - operationId: PostOrdersOrderReturns - summary: Request a Return - description: >- - Requests a Return. If applicable a return label will be created and - other plugins notified. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - items: - description: The Line Items that will be returned. - type: array - items: - properties: - item_id: - description: The id of the Line Item. - type: string - reason_id: - description: The id of the Return Reason to use. - type: string - note: - description: An optional note with information about the Return. - type: string - quantity: - description: The quantity of the Line Item. - type: integer - return_shipping: - description: >- - The Shipping Method to be used to handle the return - shipment. - type: object - properties: - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping - Method from. - price: - type: integer - description: The price to charge for the Shipping Method. - receive_now: - description: >- - A flag to indicate if the Return should be registerd as - received immediately. - type: boolean - refund: - description: The amount to refund. - type: integer - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/order/{id}/claims/{claim_id}': - post: - operationId: PostOrdersOrderClaimsClaim - summary: Update a Claim - description: Updates a Claim. - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: claim_id - required: true - description: The id of the Claim. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - claim_items: - description: The Claim Items that the Claim will consist of. - type: array - items: - properties: - id: - description: The id of the Claim Item. - type: string - item_id: - description: The id of the Line Item that will be claimed. - type: string - quantity: - description: The number of items that will be returned - type: integer - note: - description: >- - Short text describing the Claim Item in further - detail. - type: string - reason: - description: The reason for the Claim - type: string - enum: - - missing_item - - wrong_item - - production_failure - - other - tags: - description: A list o tags to add to the Claim Item - type: array - items: - type: string - images: - description: >- - A list of image URL's that will be associated with the - Claim - items: - type: string - shipping_methods: - description: The Shipping Methods to send the additional Line Items with. - type: array - items: - properties: - id: - description: The id of an existing Shipping Method - type: string - option_id: - description: >- - The id of the Shipping Option to create a Shipping - Method from - type: string - price: - description: The price to charge for the Shipping Method - type: integer - no_notification: - description: >- - If set to true no notification will be send related to this - Swap. - type: boolean - metadata: - description: >- - An optional set of key-value pairs to hold additional - information. - type: object - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/regions/{id}/countries': - post: - operationId: PostRegionsRegionCountries - summary: Add Country - description: Adds a Country to the list of Countries in a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - country_code: - description: The 2 character ISO code for the Country. - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}/fulfillment-providers': - post: - operationId: PostRegionsRegionFulfillmentProviders - summary: Add Fulfillment Provider - description: Adds a Fulfillment Provider to a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - provider_id: - description: The id of the Fulfillment Provider to add. - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}/payment-providers': - post: - operationId: PostRegionsRegionPaymentProviders - summary: Add Payment Provider - description: Adds a Payment Provider to a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - provider_id: - description: The id of the Payment Provider to add. - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - /regions: - post: - operationId: PostRegions - summary: Create a Region - description: Creates a Region - requestBody: - content: - application/json: - schema: - properties: - name: - description: The name of the Region - type: string - currency_code: - description: The 3 character ISO currency code to use for the Region. - type: string - tax_code: - description: An optional tax code the Region. - type: string - tax_rate: - description: The tax rate to use on Orders in the Region. - type: number - payment_providers: - description: >- - A list of Payment Providers that should be enabled for the - Region - type: array - items: - type: string - fulfillment_providers: - description: >- - A list of Fulfillment Providers that should be enabled for - the Region - type: array - items: - type: string - countries: - description: A list of countries that should be included in the Region. - type: array - items: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - get: - operationId: GetRegions - summary: List Regions - description: Retrieves a list of Regions. - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - regions: - type: array - items: - $ref: '#/components/schemas/region' - '/regions/{id}/metadata/{key}': - delete: - operationId: DeleteRegionsRegionMetadataKey - summary: Delete Metadata - description: Deletes a metadata key. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - - in: path - name: key - required: true - description: The metadata key. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}': - delete: - operationId: DeleteRegionsRegion - summary: Delete a Region - description: Deletes a Region. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - id: - type: string - description: The id of the deleted Region. - object: - type: string - description: The type of the object that was deleted. - deleted: - type: boolean - get: - operationId: GetRegionsRegion - summary: Retrieve a Region - description: Retrieves a Region. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - post: - operationId: PostRegionsRegion - summary: Update a Region - description: Updates a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - name: - description: The name of the Region - type: string - currency_code: - description: The 3 character ISO currency code to use for the Region. - type: string - tax_code: - description: An optional tax code the Region. - type: string - tax_rate: - description: The tax rate to use on Orders in the Region. - type: number - payment_providers: - description: >- - A list of Payment Providers that should be enabled for the - Region - type: array - items: - type: string - fulfillment_providers: - description: >- - A list of Fulfillment Providers that should be enabled for - the Region - type: array - items: - type: string - countries: - description: A list of countries that should be included in the Region. - type: array - items: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}/fulfillment-options': - get: - operationId: GetRegionsRegionFulfillmentOptions - summary: List Fulfillment Options available in the Region - description: Gathers all the fulfillment options available to in the Region. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Product - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - fulfillment_options: - type: array - items: - type: object - '/regions/{id}/countries/{country_code}': - delete: - operationId: PostRegionsRegionCountriesCountry - summary: Remove Country - description: Removes a Country from the list of Countries in a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - - in: path - name: country_code - required: true - description: The 2 character ISO code for the Country. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}/fulfillment-providers/{provider_id}': - delete: - operationId: PostRegionsRegionFulfillmentProvidersProvider - summary: Remove Fulfillment Provider - description: Removes a Fulfillment Provider. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - - in: path - name: provider_id - required: true - description: The id of the Fulfillment Provider. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - '/regions/{id}/payment-providers/{provider_id}': - delete: - operationId: PostRegionsRegionPaymentProvidersProvider - summary: Remove Payment Provider - description: Removes a Payment Provider. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - - in: path - name: provider_id - required: true - description: The id of the Payment Provider. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' '/products/{id}/options': post: operationId: PostProductsProductOptions @@ -3496,6 +2190,68 @@ paths: type: array items: $ref: '#/components/schemas/product_type' + /returns: + get: + operationId: GetReturns + summary: List Returns + description: Retrieves a list of Returns + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + returns: + type: array + items: + $ref: '#/components/schemas/return' + '/returns/{id}receive': + post: + operationId: PostReturnsReturnReceive + summary: Receive a Return + description: >- + Registers a Return as received. Updates statuses on Orders and Swaps + accordingly. + parameters: + - in: path + name: id + required: true + description: The id of the Return. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + items: + description: The Line Items that have been received. + type: array + items: + properties: + item_id: + description: The id of the Line Item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + refund: + description: The amount to refund. + type: integer + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: '#/components/schemas/return' /return-reasons: post: operationId: PostReturnReasons @@ -3616,13 +2372,28 @@ paths: properties: return_reason: $ref: '#/components/schemas/return_reason' - /returns: - get: - operationId: GetReturns - summary: List Returns - description: Retrieves a list of Returns + '/regions/{id}/countries': + post: + operationId: PostRegionsRegionCountries + summary: Add Country + description: Adds a Country to the list of Countries in a Region + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + country_code: + description: The 2 character ISO code for the Country. + type: string tags: - - Return + - Region responses: '200': description: OK @@ -3630,22 +2401,1067 @@ paths: application/json: schema: properties: - returns: - type: array - items: - $ref: '#/components/schemas/return' - '/returns/{id}receive': + region: + $ref: '#/components/schemas/region' + '/regions/{id}/fulfillment-providers': post: - operationId: PostReturnsReturnReceive - summary: Receive a Return - description: >- - Registers a Return as received. Updates statuses on Orders and Swaps - accordingly. + operationId: PostRegionsRegionFulfillmentProviders + summary: Add Fulfillment Provider + description: Adds a Fulfillment Provider to a Region parameters: - in: path name: id required: true - description: The id of the Return. + description: The id of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + provider_id: + description: The id of the Fulfillment Provider to add. + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/payment-providers': + post: + operationId: PostRegionsRegionPaymentProviders + summary: Add Payment Provider + description: Adds a Payment Provider to a Region + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + provider_id: + description: The id of the Payment Provider to add. + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + /regions: + post: + operationId: PostRegions + summary: Create a Region + description: Creates a Region + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Region + type: string + currency_code: + description: The 3 character ISO currency code to use for the Region. + type: string + tax_code: + description: An optional tax code the Region. + type: string + tax_rate: + description: The tax rate to use on Orders in the Region. + type: number + payment_providers: + description: >- + A list of Payment Providers that should be enabled for the + Region + type: array + items: + type: string + fulfillment_providers: + description: >- + A list of Fulfillment Providers that should be enabled for + the Region + type: array + items: + type: string + countries: + description: A list of countries that should be included in the Region. + type: array + items: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + regions: + type: array + items: + $ref: '#/components/schemas/region' + '/regions/{id}/metadata/{key}': + delete: + operationId: DeleteRegionsRegionMetadataKey + summary: Delete Metadata + description: Deletes a metadata key. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + - in: path + name: key + required: true + description: The metadata key. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}': + delete: + operationId: DeleteRegionsRegion + summary: Delete a Region + description: Deletes a Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The id of the deleted Region. + object: + type: string + description: The type of the object that was deleted. + deleted: + type: boolean + get: + operationId: GetRegionsRegion + summary: Retrieve a Region + description: Retrieves a Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + post: + operationId: PostRegionsRegion + summary: Update a Region + description: Updates a Region + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Region + type: string + currency_code: + description: The 3 character ISO currency code to use for the Region. + type: string + tax_code: + description: An optional tax code the Region. + type: string + tax_rate: + description: The tax rate to use on Orders in the Region. + type: number + payment_providers: + description: >- + A list of Payment Providers that should be enabled for the + Region + type: array + items: + type: string + fulfillment_providers: + description: >- + A list of Fulfillment Providers that should be enabled for + the Region + type: array + items: + type: string + countries: + description: A list of countries that should be included in the Region. + type: array + items: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/fulfillment-options': + get: + operationId: GetRegionsRegionFulfillmentOptions + summary: List Fulfillment Options available in the Region + description: Gathers all the fulfillment options available to in the Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + fulfillment_options: + type: array + items: + type: object + '/regions/{id}/countries/{country_code}': + delete: + operationId: PostRegionsRegionCountriesCountry + summary: Remove Country + description: Removes a Country from the list of Countries in a Region + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + - in: path + name: country_code + required: true + description: The 2 character ISO code for the Country. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/fulfillment-providers/{provider_id}': + delete: + operationId: PostRegionsRegionFulfillmentProvidersProvider + summary: Remove Fulfillment Provider + description: Removes a Fulfillment Provider. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + - in: path + name: provider_id + required: true + description: The id of the Fulfillment Provider. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/payment-providers/{provider_id}': + delete: + operationId: PostRegionsRegionPaymentProvidersProvider + summary: Remove Payment Provider + description: Removes a Payment Provider. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + - in: path + name: provider_id + required: true + description: The id of the Payment Provider. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/orders/{id}/shipping-methods': + post: + operationId: PostOrdersOrderShippingMethods + summary: Add a Shipping Method + description: >- + Adds a Shipping Method to an Order. If another Shipping Method exists + with the same Shipping Profile, the previous Shipping Method will be + replaced. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + requestBody: + content: + application/json: + schema: + type: object + required: + - price + - option_id + - data + properties: + price: + type: integer + description: >- + The price (excluding VAT) that should be charged for the + Shipping Method + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping Method + from. + data: + type: object + description: >- + The data required for the Shipping Option to create a + Shipping Method. This will depend on the Fulfillment + Provider. + '/orders/{id}/cancel': + post: + operationId: PostOrdersOrderCancel + summary: Cancel an Order + description: >- + Registers an Order as canceled. This triggers a flow that will cancel + any created Fulfillments and Payments, may fail if the Payment or + Fulfillment Provider is unable to cancel the Payment/Fulfillment. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/capture': + post: + operationId: PostOrdersOrderCapture + summary: Capture an Order + description: Captures all the Payments associated with an Order. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/claims/{claim_id}/shipments': + post: + operationId: PostOrdersOrderClaimsClaimShipments + summary: Create Claim Shipment + description: Registers a Claim Fulfillment as shipped. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The id of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + fulfillment_id: + description: The id of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/order/{id}/claims': + post: + operationId: PostOrdersOrderClaims + summary: Create a Claim + description: Creates a Claim. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + type: + description: >- + The type of the Claim. This will determine how the Claim is + treated: `replace` Claims will result in a Fulfillment with + new items being created, while a `refund` Claim will refund + the amount paid for the claimed items. + type: string + enum: + - replace + - refund + claim_items: + description: The Claim Items that the Claim will consist of. + type: array + items: + properties: + item_id: + description: The id of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + note: + description: >- + Short text describing the Claim Item in further + detail. + type: string + reason: + description: The reason for the Claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + tags: + description: A list o tags to add to the Claim Item + type: array + items: + type: string + images: + description: >- + A list of image URL's that will be associated with the + Claim + items: + type: string + return_shipping: + description: >- + Optional details for the Return Shipping Method, if the + items are to be sent back. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. + price: + type: integer + description: The price to charge for the Shipping Method. + additional_items: + description: >- + The new items to send to the Customer when the Claim type is + Replace. + type: array + items: + properties: + variant_id: + description: The id of the Product Variant to ship. + type: string + quantity: + description: The quantity of the Product Variant to ship. + type: integer + shipping_methods: + description: The Shipping Methods to send the additional Line Items with. + type: array + items: + properties: + id: + description: The id of an existing Shipping Method + type: string + option_id: + description: >- + The id of the Shipping Option to create a Shipping + Method from + type: string + price: + description: The price to charge for the Shipping Method + type: integer + shipping_address: + type: object + description: >- + An optional shipping address to send the claim to. Defaults + to the parent order's shipping address + refund_amount: + description: >- + The amount to refund the Customer when the Claim type is + `refund`. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/fulfillments': + post: + operationId: PostOrdersOrderFulfillments + summary: Create a Fulfillment + description: >- + Creates a Fulfillment of an Order - will notify Fulfillment Providers to + prepare a shipment. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + items: + description: The Line Items to include in the Fulfillment. + type: array + items: + properties: + item_id: + description: The id of Line Item to fulfill. + type: string + quantity: + description: The quantity of the Line Item to fulfill. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/shipment': + post: + operationId: PostOrdersOrderShipment + summary: Create a Shipment + description: Registers a Fulfillment as shipped. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + fulfillment_id: + description: The id of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/shipments': + post: + operationId: PostOrdersOrderSwapsSwapShipments + summary: Create Swap Shipment + description: Registers a Swap Fulfillment as shipped. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The id of the Swap. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + fulfillment_id: + description: The id of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/order/{id}/swaps': + post: + operationId: PostOrdersOrderSwaps + summary: Create a Swap + description: >- + Creates a Swap. Swaps are used to handle Return of previously purchased + goods and Fulfillment of replacements simultaneously. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + return_items: + description: The Line Items to return as part of the Swap. + type: array + items: + properties: + item_id: + description: The id of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + return_shipping: + description: How the Swap will be returned. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. + price: + type: integer + description: The price to charge for the Shipping Method. + additional_items: + description: The new items to send to the Customer. + type: array + items: + properties: + variant_id: + description: The id of the Product Variant to ship. + type: string + quantity: + description: The quantity of the Product Variant to ship. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/order/{id}/metadata/{key}': + delete: + operationId: DeleteOrdersOrderMetadataKey + summary: Delete Metadata + description: Deletes a metadata key. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: key + required: true + description: The metadata key. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/claims/{claim_id}/fulfillments': + post: + operationId: PostOrdersOrderClaimsClaimFulfillments + summary: Create a Claim Fulfillment + description: Creates a Fulfillment for a Claim. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The id of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/fulfillments': + post: + operationId: PostOrdersOrderSwapsSwapFulfillments + summary: Create a Swap Fulfillment + description: Creates a Fulfillment for a Swap. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The id of the Swap. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Retrieve an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + /orders: + get: + operationId: GetOrders + summary: List Orders + description: Retrieves a list of Orders + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + orders: + type: array + items: + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/process-payment': + post: + operationId: PostOrdersOrderSwapsSwapProcessPayment + summary: Process a Swap difference + description: >- + When there are differences between the returned and shipped Products in + a Swap, the difference must be processed. Either a Refund will be issued + or a Payment will be captured. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The id of the Swap. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/receive': + post: + operationId: PostOrdersOrderSwapsSwapReceive + summary: Receive a Swap + description: Registers a Swap as received. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The id of the Swap. schema: type: string requestBody: @@ -3664,11 +3480,8 @@ paths: quantity: description: The quantity of the Line Item. type: integer - refund: - description: The amount to refund. - type: integer tags: - - Return + - Order responses: '200': description: OK @@ -3676,8 +3489,225 @@ paths: application/json: schema: properties: - return: - $ref: '#/components/schemas/return' + order: + $ref: '#/components/schemas/order' + '/orders/{id}/refunds': + post: + operationId: PostOrdersOrderRefunds + summary: Create a Refund + description: Issues a Refund. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - amount + - reason + properties: + amount: + description: The amount to refund. + type: integer + reason: + description: The reason for the Refund. + type: string + note: + description: A not with additional details about the Refund. + type: string + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}/returns': + post: + operationId: PostOrdersOrderReturns + summary: Request a Return + description: >- + Requests a Return. If applicable a return label will be created and + other plugins notified. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + items: + description: The Line Items that will be returned. + type: array + items: + properties: + item_id: + description: The id of the Line Item. + type: string + reason_id: + description: The id of the Return Reason to use. + type: string + note: + description: An optional note with information about the Return. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + return_shipping: + description: >- + The Shipping Method to be used to handle the return + shipment. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. + price: + type: integer + description: The price to charge for the Shipping Method. + receive_now: + description: >- + A flag to indicate if the Return should be registerd as + received immediately. + type: boolean + no_notification: + description: >- + A flag to indicate if no notifications should be emitted + related to the requested Return. + type: boolean + refund: + description: The amount to refund. + type: integer + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/order/{id}/claims/{claim_id}': + post: + operationId: PostOrdersOrderClaimsClaim + summary: Update a Claim + description: Updates a Claim. + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The id of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + claim_items: + description: The Claim Items that the Claim will consist of. + type: array + items: + properties: + id: + description: The id of the Claim Item. + type: string + item_id: + description: The id of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + note: + description: >- + Short text describing the Claim Item in further + detail. + type: string + reason: + description: The reason for the Claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + tags: + description: A list o tags to add to the Claim Item + type: array + items: + type: string + images: + description: >- + A list of image URL's that will be associated with the + Claim + items: + type: string + shipping_methods: + description: The Shipping Methods to send the additional Line Items with. + type: array + items: + properties: + id: + description: The id of an existing Shipping Method + type: string + option_id: + description: >- + The id of the Shipping Option to create a Shipping + Method from + type: string + price: + description: The price to charge for the Shipping Method + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' /shipping-options: post: operationId: PostShippingOptions @@ -4402,6 +4432,9 @@ components: type: string format: date-time no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. type: boolean metadata: type: object @@ -4672,6 +4705,8 @@ components: completed_at: type: string format: date-time + no_notification_order: + type: boolean metadata: type: object idempotency_key: @@ -5297,6 +5332,9 @@ components: paid_total: type: integer no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. type: boolean payment_provider: title: Payment Provider diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 5f7a2b994d..9fcf3c6e85 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -199,6 +199,746 @@ } } }, + "/carts/{id}/shipping-methods": { + "post": { + "operationId": "PostCartsCartShippingMethod", + "description": "Adds a Shipping Method to the Cart.", + "summary": "Add a Shipping Method", + "tags": [ + "Cart" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The cart id.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "A successful response", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "option_id" + ], + "properties": { + "option_id": { + "type": "string", + "description": "id of the shipping option to create the method from" + }, + "data": { + "type": "object", + "description": "Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send." + } + } + } + } + } + } + } + }, + "/carts/{id}/complete": { + "post": { + "summary": "Complete a Cart", + "operationId": "PostCartsCartComplete", + "description": "Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. If not provided, we will generate one for the request.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The Cart id.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "If a cart was successfully authorized, but requires further action from the user the response body will contain the cart with an updated payment session. If the Cart was successfully completed the response body will contain the newly created Order.", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/order" + } + } + }, + { + "type": "object", + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + ] + } + } + } + } + } + } + }, + "/carts": { + "post": { + "summary": "Create a Cart", + "operationId": "PostCart", + "description": "Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "region_id": { + "type": "string", + "description": "The id of the Region to create the Cart in." + }, + "country_code": { + "type": "string", + "description": "The 2 character ISO country code to create the Cart in." + }, + "items": { + "description": "An optional array of `variant_id`, `quantity` pairs to generate Line Items from.", + "type": "array", + "items": { + "properties": { + "variant_id": { + "description": "The id of the Product Variant to generate a Line Item from.", + "type": "string" + }, + "quantity": { + "description": "The quantity of the Product Variant to add", + "type": "integer" + } + } + } + }, + "context": { + "description": "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "Successfully created a new Cart", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + } + }, + "/carts/{id}/line-items": { + "post": { + "operationId": "PostCartsCartLineItems", + "summary": "Add a Line Item", + "description": "Generates a Line Item with a given Product Variant and adds it to the Cart", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart to add the Line Item to.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "variant_id", + "quantity" + ], + "properties": { + "variant_id": { + "type": "string", + "description": "The id of the Product Variant to generate the Line Item from." + }, + "quantity": { + "type": "integer", + "description": "The quantity of the Product Variant to add to the Line Item." + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details about the Line Item." + } + } + } + } + } + } + } + }, + "/carts/{id}/payment-sessions": { + "post": { + "operationId": "PostCartsCartPaymentSessions", + "summary": "Initialize Payment Sessions", + "description": "Creates Payment Sessions for each of the available Payment Providers in the Cart's Region.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + } + }, + "/carts/{id}/discounts/{code}": { + "delete": { + "operationId": "DeleteCartsCartDiscountsDiscount", + "description": "Removes a Discount from a Cart.", + "summary": "Remove Discount from Cart", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "code", + "required": true, + "description": "The unique Discount code.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + } + }, + "/carts/{id}/line-items/{line_id}": { + "delete": { + "operationId": "DeleteCartsCartLineItemsItem", + "summary": "Delete a Line Item", + "description": "Removes a Line Item from a Cart.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "line_id", + "required": true, + "description": "The id of the Line Item.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCartsCartLineItemsItem", + "summary": "Update a Line Item", + "description": "Updates a Line Item if the desired quantity can be fulfilled.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "line_id", + "required": true, + "description": "The id of the Line Item.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "quantity" + ], + "properties": { + "quantity": { + "type": "integer", + "description": "The quantity to set the Line Item to." + } + } + } + } + } + } + } + }, + "/carts/{id}/payment-sessions/{provider_id}": { + "delete": { + "operationId": "DeleteCartsCartPaymentSessionsSession", + "summary": "Delete a Payment Session", + "description": "Deletes a Payment Session on a Cart. May be useful if a payment has failed.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "provider_id", + "required": true, + "description": "The id of the Payment Provider used to create the Payment Session to be deleted.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCartsCartPaymentSessionUpdate", + "summary": "Update a Payment Session", + "description": "Updates a Payment Session with additional data.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "provider_id", + "required": true, + "description": "The id of the payment provider.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "provider_id", + "data" + ], + "properties": { + "provider_id": { + "type": "string", + "description": "The id of the Payment Provider responsible for the Payment Session to update." + }, + "data": { + "type": "object", + "description": "The data to update the payment session with." + } + } + } + } + } + } + } + }, + "/carts/{id}": { + "get": { + "operationId": "GetCartsCart", + "summary": "Retrieve a Cart", + "description": "Retrieves a Cart.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + } + }, + "/carts/{id}/payment-session": { + "post": { + "operationId": "PostCartsCartPaymentSession", + "summary": "Select a Payment Session", + "description": "Selects a Payment Session as the session intended to be used towards the completion of the Cart.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "provider_id" + ], + "properties": { + "provider_id": { + "type": "string", + "description": "The id of the Payment Provider." + } + } + } + } + } + } + } + }, + "/store/carts/{id}": { + "post": { + "operationId": "PostCartsCart", + "summary": "Update a Cart\"", + "description": "Updates a Cart.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "region_id": { + "type": "string", + "description": "The id of the Region to create the Cart in." + }, + "country_code": { + "type": "string", + "description": "The 2 character ISO country code to create the Cart in." + }, + "email": { + "type": "string", + "description": "An email to be used on the Cart." + }, + "billing_address": { + "description": "The Address to be used for billing purposes.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + }, + "shipping_address": { + "description": "The Address to be used for shipping.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + }, + "gift_cards": { + "description": "An array of Gift Card codes to add to the Cart.", + "type": "array", + "items": { + "properties": { + "code": { + "description": "The code that a Gift Card is identified by.", + "type": "string" + } + } + } + }, + "discounts": { + "description": "An array of Discount codes to add to the Cart.", + "type": "array", + "items": { + "properties": { + "code": { + "description": "The code that a Discount is identifed by.", + "type": "string" + } + } + } + }, + "customer_id": { + "description": "The id of the Customer to associate the Cart with.", + "type": "string" + }, + "context": { + "description": "An optional object to provide context to the Cart.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } + } + }, "/gift-cards/{code}": { "get": { "operationId": "GetGiftCardsCode", @@ -753,783 +1493,6 @@ } } }, - "/carts/{id}/shipping-methods": { - "post": { - "operationId": "PostCartsCartShippingMethod", - "description": "Adds a Shipping Method to the Cart.", - "summary": "Add a Shipping Method", - "tags": [ - "Cart" - ], - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The cart id.", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "A successful response", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "option_id" - ], - "properties": { - "option_id": { - "type": "string", - "description": "id of the shipping option to create the method from" - }, - "data": { - "type": "object", - "description": "Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send." - } - } - } - } - } - } - } - }, - "/carts/{id}/complete-cart": { - "post": { - "summary": "Complete a Cart", - "operationId": "PostCartsCartComplete", - "description": "Completes a cart. The following steps will be performed. Payment authorization is attempted and if more work is required, we simply return the cart for further updates. If payment is authorized and order is not yet created, we make sure to do so. The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. If not provided, we will generate one for the request.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Cart id.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "If a cart was successfully authorized, but requires further action from the user the response body will contain the cart with an updated payment session. If the Cart was successfully completed the response body will contain the newly created Order.", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - }, - { - "type": "object", - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - ] - } - } - } - } - } - } - }, - "/carts": { - "post": { - "summary": "Create a Cart", - "operationId": "PostCart", - "description": "Creates a Cart within the given region and with the initial items. If no `region_id` is provided the cart will be associated with the first Region available. If no items are provided the cart will be empty after creation. If a user is logged in the cart's customer id and email will be set.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "region_id": { - "type": "string", - "description": "The id of the Region to create the Cart in." - }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in." - }, - "items": { - "description": "An optional array of `variant_id`, `quantity` pairs to generate Line Items from.", - "type": "array", - "items": { - "properties": { - "variant_id": { - "description": "The id of the Product Variant to generate a Line Item from.", - "type": "string" - }, - "quantity": { - "description": "The quantity of the Product Variant to add", - "type": "integer" - } - } - } - }, - "context": { - "description": "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "Successfully created a new Cart", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/line-items": { - "post": { - "operationId": "PostCartsCartLineItems", - "summary": "Add a Line Item", - "description": "Generates a Line Item with a given Product Variant and adds it to the Cart", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart to add the Line Item to.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "variant_id", - "quantity" - ], - "properties": { - "variant_id": { - "type": "string", - "description": "The id of the Product Variant to generate the Line Item from." - }, - "quantity": { - "type": "integer", - "description": "The quantity of the Product Variant to add to the Line Item." - }, - "metadata": { - "type": "object", - "description": "An optional key-value map with additional details about the Line Item." - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-sessions": { - "post": { - "operationId": "PostCartsCartPaymentSessions", - "summary": "Initialize Payment Sessions", - "description": "Creates Payment Sessions for each of the available Payment Providers in the Cart's Region.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/discounts/{code}": { - "delete": { - "operationId": "DeleteCartsCartDiscountsDiscount", - "description": "Removes a Discount from a Cart.", - "summary": "Remove Discount from Cart", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "code", - "required": true, - "description": "The unique Discount code.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/line-items/{line_id}": { - "delete": { - "operationId": "DeleteCartsCartLineItemsItem", - "summary": "Delete a Line Item", - "description": "Removes a Line Item from a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "line_id", - "required": true, - "description": "The id of the Line Item.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCartsCartLineItemsItem", - "summary": "Update a Line Item", - "description": "Updates a Line Item if the desired quantity can be fulfilled.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "line_id", - "required": true, - "description": "The id of the Line Item.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "quantity" - ], - "properties": { - "quantity": { - "type": "integer", - "description": "The quantity to set the Line Item to." - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-sessions/{provider_id}": { - "delete": { - "operationId": "DeleteCartsCartPaymentSessionsSession", - "summary": "Delete a Payment Session", - "description": "Deletes a Payment Session on a Cart. May be useful if a payment has failed.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "provider_id", - "required": true, - "description": "The id of the Payment Provider used to create the Payment Session to be deleted.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCartsCartPaymentSessionsSession", - "summary": "Refresh a Payment Session", - "description": "Refreshes a Payment Session to ensure that it is in sync with the Cart - this is usually not necessary.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "provider_id", - "required": true, - "description": "The id of the Payment Provider that created the Payment Session to be refreshed.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}": { - "get": { - "operationId": "GetCartsCart", - "summary": "Retrieve a Cart", - "description": "Retrieves a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-session": { - "post": { - "operationId": "PostCartsCartPaymentSession", - "summary": "Select a Payment Session", - "description": "Selects a Payment Session as the session intended to be used towards the completion of the Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "provider_id" - ], - "properties": { - "provider_id": { - "type": "string", - "description": "The id of the Payment Provider." - } - } - } - } - } - } - } - }, - "/store/carts/{id}": { - "post": { - "operationId": "PostCartsCart", - "summary": "Update a Cart\"", - "description": "Updates a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "region_id": { - "type": "string", - "description": "The id of the Region to create the Cart in." - }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in." - }, - "email": { - "type": "string", - "description": "An email to be used on the Cart." - }, - "billing_address": { - "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "gift_cards": { - "description": "An array of Gift Card codes to add to the Cart.", - "type": "array", - "items": { - "properties": { - "code": { - "description": "The code that a Gift Card is identified by.", - "type": "string" - } - } - } - }, - "discounts": { - "description": "An array of Discount codes to add to the Cart.", - "type": "array", - "items": { - "properties": { - "code": { - "description": "The code that a Discount is identifed by.", - "type": "string" - } - } - } - }, - "customer_id": { - "description": "The id of the Customer to associate the Cart with.", - "type": "string" - }, - "context": { - "description": "An optional object to provide context to the Cart.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - } - } - }, - "/carts/{id}/payment-session/update": { - "post": { - "operationId": "PostCartsCartPaymentSessionUpdate", - "summary": "Update a Payment Session", - "description": "Updates a Payment Session with additional data.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "provider_id", - "data" - ], - "properties": { - "provider_id": { - "type": "string", - "description": "The id of the Payment Provider responsible for the Payment Session to update." - }, - "data": { - "type": "object", - "description": "The data to update the payment session with." - } - } - } - } - } - } - } - }, "/orders/cart/{cart_id}": { "get": { "operationId": "GetOrdersOrderCartId", @@ -1728,6 +1691,72 @@ } } }, + "/returns": { + "post": { + "operationId": "PostReturns", + "summary": "Create Return", + "description": "Creates a Return for an Order.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "order_id": { + "type": "string", + "description": "The id of the Order to create the Return from." + }, + "items": { + "description": "The items to include in the Return.", + "type": "array", + "items": { + "properties": { + "item_id": { + "description": "The id of the Line Item from the Order.", + "type": "string" + }, + "quantity": { + "description": "The quantity to return.", + "type": "integer" + } + } + } + }, + "return_shipping": { + "description": "If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.", + "type": "object", + "properties": { + "option_id": { + "type": "string", + "description": "The id of the Shipping Option to create the Shipping Method from." + } + } + } + } + } + } + } + }, + "tags": [ + "Return" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "return": { + "$ref": "#/components/schemas/return" + } + } + } + } + } + } + } + } + }, "/return-reasons/{id}": { "get": { "operationId": "GetReturnReasonsReason", @@ -1872,53 +1901,24 @@ } } }, - "/returns": { - "post": { - "operationId": "PostReturns", - "summary": "Create Return", - "description": "Creates a Return for an Order.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "order_id": { - "type": "string", - "description": "The id of the Order to create the Return from." - }, - "items": { - "description": "The items to include in the Return.", - "type": "array", - "items": { - "properties": { - "item_id": { - "description": "The id of the Line Item from the Order.", - "type": "string" - }, - "quantity": { - "description": "The quantity to return.", - "type": "integer" - } - } - } - }, - "return_shipping": { - "description": "If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.", - "type": "object", - "properties": { - "option_id": { - "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." - } - } - } - } - } + "/swaps/{cart_id}": { + "get": { + "operationId": "GetSwapsSwapCartId", + "summary": "Retrieve Swap by Cart id", + "description": "Retrieves a Swap by the id of the Cart used to confirm the Swap.", + "parameters": [ + { + "in": "path", + "name": "cart_id", + "required": true, + "description": "The id of the Cart", + "schema": { + "type": "string" } } - }, + ], "tags": [ - "Return" + "Swap" ], "responses": { "200": { @@ -1927,8 +1927,8 @@ "application/json": { "schema": { "properties": { - "return": { - "$ref": "#/components/schemas/return" + "swap": { + "$ref": "#/components/schemas/swap" } } } @@ -2033,43 +2033,6 @@ } } }, - "/swaps/{cart_id}": { - "get": { - "operationId": "GetSwapsSwapCartId", - "summary": "Retrieve Swap by Cart id", - "description": "Retrieves a Swap by the id of the Cart used to confirm the Swap.", - "parameters": [ - { - "in": "path", - "name": "cart_id", - "required": true, - "description": "The id of the Cart", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Swap" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "swap": { - "$ref": "#/components/schemas/swap" - } - } - } - } - } - } - } - } - }, "/variants/{variant_id}": { "get": { "operationId": "GetVariantsVariant", @@ -2506,6 +2469,7 @@ "format": "date-time" }, "no_notification": { + "description": "Flag for describing whether or not notifications related to this should be send.", "type": "boolean" }, "metadata": { @@ -2857,6 +2821,9 @@ "type": "string", "format": "date-time" }, + "no_notification_order": { + "type": "boolean" + }, "metadata": { "type": "object" }, @@ -3623,6 +3590,7 @@ "type": "integer" }, "no_notification": { + "description": "Flag for describing whether or not notifications related to this should be send.", "type": "boolean" } } diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index b36b9dd521..3ac9dc6bd0 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -121,570 +121,6 @@ paths: properties: exists: type: boolean - '/carts/{id}/shipping-methods': - post: - operationId: PostCartsCartShippingMethod - description: Adds a Shipping Method to the Cart. - summary: Add a Shipping Method - tags: - - Cart - parameters: - - in: path - name: id - required: true - description: The cart id. - schema: - type: string - responses: - '200': - description: A successful response - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - requestBody: - content: - application/json: - schema: - type: object - required: - - option_id - properties: - option_id: - type: string - description: id of the shipping option to create the method from - data: - type: object - description: >- - Used to hold any data that the shipping method may need to - process the fulfillment of the order. Look at the - documentation for your installed fulfillment providers to - find out what to send. - '/carts/{id}/complete-cart': - post: - summary: Complete a Cart - operationId: PostCartsCartComplete - description: >- - Completes a cart. The following steps will be performed. Payment - authorization is attempted and if more work is required, we simply - return the cart for further updates. If payment is authorized and order - is not yet created, we make sure to do so. The completion of a cart can - be performed idempotently with a provided header `Idempotency-Key`. If - not provided, we will generate one for the request. - parameters: - - in: path - name: id - required: true - description: The Cart id. - schema: - type: string - tags: - - Cart - responses: - '200': - description: >- - If a cart was successfully authorized, but requires further action - from the user the response body will contain the cart with an - updated payment session. If the Cart was successfully completed the - response body will contain the newly created Order. - content: - application/json: - schema: - oneOf: - - type: object - properties: - order: - $ref: '#/components/schemas/order' - - type: object - properties: - cart: - $ref: '#/components/schemas/cart' - /carts: - post: - summary: Create a Cart - operationId: PostCart - description: >- - Creates a Cart within the given region and with the initial items. If no - `region_id` is provided the cart will be associated with the first - Region available. If no items are provided the cart will be empty after - creation. If a user is logged in the cart's customer id and email will - be set. - requestBody: - content: - application/json: - schema: - properties: - region_id: - type: string - description: The id of the Region to create the Cart in. - country_code: - type: string - description: The 2 character ISO country code to create the Cart in. - items: - description: >- - An optional array of `variant_id`, `quantity` pairs to - generate Line Items from. - type: array - items: - properties: - variant_id: - description: >- - The id of the Product Variant to generate a Line Item - from. - type: string - quantity: - description: The quantity of the Product Variant to add - type: integer - context: - description: >- - An optional object to provide context to the Cart. The - `context` field is automatically populated with `ip` and - `user_agent` - type: object - tags: - - Cart - responses: - '200': - description: Successfully created a new Cart - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}/line-items': - post: - operationId: PostCartsCartLineItems - summary: Add a Line Item - description: >- - Generates a Line Item with a given Product Variant and adds it to the - Cart - parameters: - - in: path - name: id - required: true - description: The id of the Cart to add the Line Item to. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - requestBody: - content: - application/json: - schema: - type: object - required: - - variant_id - - quantity - properties: - variant_id: - type: string - description: >- - The id of the Product Variant to generate the Line Item - from. - quantity: - type: integer - description: The quantity of the Product Variant to add to the Line Item. - metadata: - type: object - description: >- - An optional key-value map with additional details about the - Line Item. - '/carts/{id}/payment-sessions': - post: - operationId: PostCartsCartPaymentSessions - summary: Initialize Payment Sessions - description: >- - Creates Payment Sessions for each of the available Payment Providers in - the Cart's Region. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}/discounts/{code}': - delete: - operationId: DeleteCartsCartDiscountsDiscount - description: Removes a Discount from a Cart. - summary: Remove Discount from Cart - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - - in: path - name: code - required: true - description: The unique Discount code. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}/line-items/{line_id}': - delete: - operationId: DeleteCartsCartLineItemsItem - summary: Delete a Line Item - description: Removes a Line Item from a Cart. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - - in: path - name: line_id - required: true - description: The id of the Line Item. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - post: - operationId: PostCartsCartLineItemsItem - summary: Update a Line Item - description: Updates a Line Item if the desired quantity can be fulfilled. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - - in: path - name: line_id - required: true - description: The id of the Line Item. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - requestBody: - content: - application/json: - schema: - type: object - required: - - quantity - properties: - quantity: - type: integer - description: The quantity to set the Line Item to. - '/carts/{id}/payment-sessions/{provider_id}': - delete: - operationId: DeleteCartsCartPaymentSessionsSession - summary: Delete a Payment Session - description: >- - Deletes a Payment Session on a Cart. May be useful if a payment has - failed. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - - in: path - name: provider_id - required: true - description: >- - The id of the Payment Provider used to create the Payment Session to - be deleted. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - post: - operationId: PostCartsCartPaymentSessionsSession - summary: Refresh a Payment Session - description: >- - Refreshes a Payment Session to ensure that it is in sync with the Cart - - this is usually not necessary. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - - in: path - name: provider_id - required: true - description: >- - The id of the Payment Provider that created the Payment Session to - be refreshed. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}': - get: - operationId: GetCartsCart - summary: Retrieve a Cart - description: Retrieves a Cart. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}/payment-session': - post: - operationId: PostCartsCartPaymentSession - summary: Select a Payment Session - description: >- - Selects a Payment Session as the session intended to be used towards the - completion of the Cart. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - requestBody: - content: - application/json: - schema: - type: object - required: - - provider_id - properties: - provider_id: - type: string - description: The id of the Payment Provider. - '/store/carts/{id}': - post: - operationId: PostCartsCart - summary: Update a Cart" - description: Updates a Cart. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - region_id: - type: string - description: The id of the Region to create the Cart in. - country_code: - type: string - description: The 2 character ISO country code to create the Cart in. - email: - type: string - description: An email to be used on the Cart. - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address' - shipping_address: - description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address' - gift_cards: - description: An array of Gift Card codes to add to the Cart. - type: array - items: - properties: - code: - description: The code that a Gift Card is identified by. - type: string - discounts: - description: An array of Discount codes to add to the Cart. - type: array - items: - properties: - code: - description: The code that a Discount is identifed by. - type: string - customer_id: - description: The id of the Customer to associate the Cart with. - type: string - context: - description: An optional object to provide context to the Cart. - type: object - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - '/carts/{id}/payment-session/update': - post: - operationId: PostCartsCartPaymentSessionUpdate - summary: Update a Payment Session - description: Updates a Payment Session with additional data. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string - tags: - - Cart - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: '#/components/schemas/cart' - requestBody: - content: - application/json: - schema: - type: object - required: - - provider_id - - data - properties: - provider_id: - type: string - description: >- - The id of the Payment Provider responsible for the Payment - Session to update. - data: - type: object - description: The data to update the payment session with. - '/gift-cards/{code}': - get: - operationId: GetGiftCardsCode - summary: Retrieve Gift Card by Code - description: Retrieves a Gift Card by its associated unqiue code. - parameters: - - in: path - name: code - required: true - description: The unique Gift Card code. - schema: - type: string - tags: - - Gift Card - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - id: - description: The id of the Gift Card - code: - description: The code of the Gift Card - value: - description: The original value of the Gift Card. - balance: - description: The current balanace of the Gift Card - region: - $ref: '#/components/schemas/region' '/customers/{id}/addresses': post: operationId: PostCustomersCustomerAddresses @@ -1017,77 +453,155 @@ paths: password: type: string description: The new password to set for the Customer. - '/orders/cart/{cart_id}': - get: - operationId: GetOrdersOrderCartId - summary: Retrieves Order by Cart id - description: >- - Retrieves an Order by the id of the Cart that was used to create the - Order. - parameters: - - in: path - name: cart_id - required: true - description: The id of Cart. - schema: - type: string + '/carts/{id}/shipping-methods': + post: + operationId: PostCartsCartShippingMethod + description: Adds a Shipping Method to the Cart. + summary: Add a Shipping Method tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Retrieves an Order - description: Retrieves an Order + - Cart parameters: - in: path name: id required: true - description: The id of the Order. + description: The cart id. schema: type: string - tags: - - Order responses: '200': - description: OK + description: A successful response content: application/json: schema: properties: - customer: - $ref: '#/components/schemas/customer' - /orders: - get: - operationId: GetOrders - summary: Look Up an Order + cart: + $ref: '#/components/schemas/cart' + requestBody: + content: + application/json: + schema: + type: object + required: + - option_id + properties: + option_id: + type: string + description: id of the shipping option to create the method from + data: + type: object + description: >- + Used to hold any data that the shipping method may need to + process the fulfillment of the order. Look at the + documentation for your installed fulfillment providers to + find out what to send. + '/carts/{id}/complete': + post: + summary: Complete a Cart + operationId: PostCartsCartComplete description: >- - Looks for an Order with a given `display_id`, `email` pair. The - `display_id`, `email` pair must match in order for the Order to be - returned. + Completes a cart. The following steps will be performed. Payment + authorization is attempted and if more work is required, we simply + return the cart for further updates. If payment is authorized and order + is not yet created, we make sure to do so. The completion of a cart can + be performed idempotently with a provided header `Idempotency-Key`. If + not provided, we will generate one for the request. parameters: - - in: query - name: display_id + - in: path + name: id required: true - description: The display id given to the Order. - schema: - type: number - - in: query - name: email - required: true - description: The email of the Order with the given display_id. + description: The Cart id. schema: type: string tags: - - Order + - Cart + responses: + '200': + description: >- + If a cart was successfully authorized, but requires further action + from the user the response body will contain the cart with an + updated payment session. If the Cart was successfully completed the + response body will contain the newly created Order. + content: + application/json: + schema: + oneOf: + - type: object + properties: + order: + $ref: '#/components/schemas/order' + - type: object + properties: + cart: + $ref: '#/components/schemas/cart' + /carts: + post: + summary: Create a Cart + operationId: PostCart + description: >- + Creates a Cart within the given region and with the initial items. If no + `region_id` is provided the cart will be associated with the first + Region available. If no items are provided the cart will be empty after + creation. If a user is logged in the cart's customer id and email will + be set. + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The id of the Region to create the Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + items: + description: >- + An optional array of `variant_id`, `quantity` pairs to + generate Line Items from. + type: array + items: + properties: + variant_id: + description: >- + The id of the Product Variant to generate a Line Item + from. + type: string + quantity: + description: The quantity of the Product Variant to add + type: integer + context: + description: >- + An optional object to provide context to the Cart. The + `context` field is automatically populated with `ip` and + `user_agent` + type: object + tags: + - Cart + responses: + '200': + description: Successfully created a new Cart + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/line-items': + post: + operationId: PostCartsCartLineItems + summary: Add a Line Item + description: >- + Generates a Line Item with a given Product Variant and adds it to the + Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart to add the Line Item to. + schema: + type: string + tags: + - Cart responses: '200': description: OK @@ -1095,8 +609,387 @@ paths: application/json: schema: properties: - order: - $ref: '#/components/schemas/order' + cart: + $ref: '#/components/schemas/cart' + requestBody: + content: + application/json: + schema: + type: object + required: + - variant_id + - quantity + properties: + variant_id: + type: string + description: >- + The id of the Product Variant to generate the Line Item + from. + quantity: + type: integer + description: The quantity of the Product Variant to add to the Line Item. + metadata: + type: object + description: >- + An optional key-value map with additional details about the + Line Item. + '/carts/{id}/payment-sessions': + post: + operationId: PostCartsCartPaymentSessions + summary: Initialize Payment Sessions + description: >- + Creates Payment Sessions for each of the available Payment Providers in + the Cart's Region. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/discounts/{code}': + delete: + operationId: DeleteCartsCartDiscountsDiscount + description: Removes a Discount from a Cart. + summary: Remove Discount from Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: code + required: true + description: The unique Discount code. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/line-items/{line_id}': + delete: + operationId: DeleteCartsCartLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + post: + operationId: PostCartsCartLineItemsItem + summary: Update a Line Item + description: Updates a Line Item if the desired quantity can be fulfilled. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + quantity: + type: integer + description: The quantity to set the Line Item to. + '/carts/{id}/payment-sessions/{provider_id}': + delete: + operationId: DeleteCartsCartPaymentSessionsSession + summary: Delete a Payment Session + description: >- + Deletes a Payment Session on a Cart. May be useful if a payment has + failed. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: >- + The id of the Payment Provider used to create the Payment Session to + be deleted. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + post: + operationId: PostCartsCartPaymentSessionUpdate + summary: Update a Payment Session + description: Updates a Payment Session with additional data. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: The id of the payment provider. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + requestBody: + content: + application/json: + schema: + type: object + required: + - provider_id + - data + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider responsible for the Payment + Session to update. + data: + type: object + description: The data to update the payment session with. + '/carts/{id}': + get: + operationId: GetCartsCart + summary: Retrieve a Cart + description: Retrieves a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/payment-session': + post: + operationId: PostCartsCartPaymentSession + summary: Select a Payment Session + description: >- + Selects a Payment Session as the session intended to be used towards the + completion of the Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + requestBody: + content: + application/json: + schema: + type: object + required: + - provider_id + properties: + provider_id: + type: string + description: The id of the Payment Provider. + '/store/carts/{id}': + post: + operationId: PostCartsCart + summary: Update a Cart" + description: Updates a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The id of the Region to create the Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + email: + type: string + description: An email to be used on the Cart. + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: '#/components/schemas/address' + gift_cards: + description: An array of Gift Card codes to add to the Cart. + type: array + items: + properties: + code: + description: The code that a Gift Card is identified by. + type: string + discounts: + description: An array of Discount codes to add to the Cart. + type: array + items: + properties: + code: + description: The code that a Discount is identifed by. + type: string + customer_id: + description: The id of the Customer to associate the Cart with. + type: string + context: + description: An optional object to provide context to the Cart. + type: object + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/gift-cards/{code}': + get: + operationId: GetGiftCardsCode + summary: Retrieve Gift Card by Code + description: Retrieves a Gift Card by its associated unqiue code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + description: The id of the Gift Card + code: + description: The code of the Gift Card + value: + description: The original value of the Gift Card. + balance: + description: The current balanace of the Gift Card + region: + $ref: '#/components/schemas/region' '/products/{id}': get: operationId: GetProductsProduct @@ -1197,44 +1090,22 @@ paths: type: array items: $ref: '#/components/schemas/region' - /returns: - post: - operationId: PostReturns - summary: Create Return - description: Creates a Return for an Order. - requestBody: - content: - application/json: - schema: - properties: - order_id: - type: string - description: The id of the Order to create the Return from. - items: - description: The items to include in the Return. - type: array - items: - properties: - item_id: - description: The id of the Line Item from the Order. - type: string - quantity: - description: The quantity to return. - type: integer - return_shipping: - description: >- - If the Return is to be handled by the store operator the - Customer can choose a Return Shipping Method. Alternatvely - the Customer can handle the Return themselves. - type: object - properties: - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping - Method from. + '/orders/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Retrieves Order by Cart id + description: >- + Retrieves an Order by the id of the Cart that was used to create the + Order. + parameters: + - in: path + name: cart_id + required: true + description: The id of Cart. + schema: + type: string tags: - - Return + - Order responses: '200': description: OK @@ -1242,8 +1113,104 @@ paths: application/json: schema: properties: - return: - $ref: '#/components/schemas/return' + order: + $ref: '#/components/schemas/order' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Retrieves an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /orders: + get: + operationId: GetOrders + summary: Look Up an Order + description: >- + Looks for an Order with a given `display_id`, `email` pair. The + `display_id`, `email` pair must match in order for the Order to be + returned. + parameters: + - in: query + name: display_id + required: true + description: The display id given to the Order. + schema: + type: number + - in: query + name: email + required: true + description: The email of the Order with the given display_id. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/return-reasons/{id}': + get: + operationId: GetReturnReasonsReason + summary: Retrieve a Return Reason + description: Retrieves a Return Reason. + parameters: + - in: path + name: id + required: true + description: The id of the Return Reason. + schema: + type: string + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: '#/components/schemas/return_reason' + /return-reasons: + get: + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reasons: + type: array + items: + $ref: '#/components/schemas/return_reason' /shipping-options: get: operationId: GetShippingOptions @@ -1305,20 +1272,44 @@ paths: type: array items: $ref: '#/components/schemas/shipping_option' - '/return-reasons/{id}': - get: - operationId: GetReturnReasonsReason - summary: Retrieve a Return Reason - description: Retrieves a Return Reason. - parameters: - - in: path - name: id - required: true - description: The id of the Return Reason. - schema: - type: string + /returns: + post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + properties: + order_id: + type: string + description: The id of the Order to create the Return from. + items: + description: The items to include in the Return. + type: array + items: + properties: + item_id: + description: The id of the Line Item from the Order. + type: string + quantity: + description: The quantity to return. + type: integer + return_shipping: + description: >- + If the Return is to be handled by the store operator the + Customer can choose a Return Shipping Method. Alternatvely + the Customer can handle the Return themselves. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. tags: - - Return Reason + - Return responses: '200': description: OK @@ -1326,49 +1317,8 @@ paths: application/json: schema: properties: - return_reason: - $ref: '#/components/schemas/return_reason' - /return-reasons: - get: - operationId: GetReturnReasons - summary: List Return Reasons - description: Retrieves a list of Return Reasons. - tags: - - Return Reason - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - return_reasons: - type: array - items: - $ref: '#/components/schemas/return_reason' - '/swaps/{cart_id}': - get: - operationId: GetSwapsSwapCartId - summary: Retrieve Swap by Cart id - description: Retrieves a Swap by the id of the Cart used to confirm the Swap. - parameters: - - in: path - name: cart_id - required: true - description: The id of the Cart - schema: - type: string - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - swap: - $ref: '#/components/schemas/swap' + return: + $ref: '#/components/schemas/return' '/variants/{variant_id}': get: operationId: GetVariantsVariant @@ -1416,6 +1366,29 @@ paths: type: array items: $ref: '#/components/schemas/product_variant' + '/swaps/{cart_id}': + get: + operationId: GetSwapsSwapCartId + summary: Retrieve Swap by Cart id + description: Retrieves a Swap by the id of the Cart used to confirm the Swap. + parameters: + - in: path + name: cart_id + required: true + description: The id of the Cart + schema: + type: string + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: '#/components/schemas/swap' components: schemas: address: @@ -1683,6 +1656,9 @@ components: type: string format: date-time no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. type: boolean metadata: type: object @@ -1953,6 +1929,8 @@ components: completed_at: type: string format: date-time + no_notification_order: + type: boolean metadata: type: object idempotency_key: @@ -2578,6 +2556,9 @@ components: paid_total: type: integer no_notification: + description: >- + Flag for describing whether or not notifications related to this + should be send. type: boolean payment_provider: title: Payment Provider diff --git a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.js b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.js index 9a84fa5a25..6fff5d598b 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.js +++ b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.js @@ -36,7 +36,7 @@ import { defaultCartFields, defaultCartRelations, defaultFields } from "." * description: "The code that a Discount is identifed by." * type: string * no_notification_order: - * description: "An optional flag passed to the resulting order to determine use of notifications."" + * description: "An optional flag passed to the resulting order to determine use of notifications." * type: boolean * customer_id: * description: "The id of the Customer to associate the Draft Order with." diff --git a/packages/medusa/src/api/routes/admin/returns/receive-return.js b/packages/medusa/src/api/routes/admin/returns/receive-return.js index 404ee7d69d..8e77f55fd9 100644 --- a/packages/medusa/src/api/routes/admin/returns/receive-return.js +++ b/packages/medusa/src/api/routes/admin/returns/receive-return.js @@ -56,7 +56,6 @@ export default async (req, res) => { const { value, error } = schema.validate(req.body) if (error) { - console.log(error) throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details) } diff --git a/packages/medusa/src/services/__tests__/swap.js b/packages/medusa/src/services/__tests__/swap.js index 4adb462748..ef56621044 100644 --- a/packages/medusa/src/services/__tests__/swap.js +++ b/packages/medusa/src/services/__tests__/swap.js @@ -942,6 +942,4 @@ describe("SwapService", () => { }) }) }) - - }) diff --git a/packages/medusa/src/services/notification.js b/packages/medusa/src/services/notification.js index 9332cd3fe5..e0165ef952 100644 --- a/packages/medusa/src/services/notification.js +++ b/packages/medusa/src/services/notification.js @@ -168,10 +168,6 @@ class NotificationService extends BaseService { return } - if(data['no_notification'] === true) { - return - } - return Promise.all( subs.map(async providerId => { return this.send(eventName, data, providerId).catch(err => { diff --git a/packages/medusa/src/services/order.js b/packages/medusa/src/services/order.js index 57637ad4ac..b8c79e459b 100644 --- a/packages/medusa/src/services/order.js +++ b/packages/medusa/src/services/order.js @@ -309,11 +309,9 @@ class OrderService extends BaseService { */ async retrieve(orderId, config = {}) { - const orderRepo = this.manager_.getCustomRepository(this.orderRepository_) const validatedId = this.validateId_(orderId) - const { select, relations, totalsToSelect } = this.transformQueryForTotals_( config )