diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index 5da7fcc4b6..de03c84c1d 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -145,6 +145,183 @@ } } }, + "/customers": { + "post": { + "operationId": "PostCustomers", + "summary": "Create a Customer", + "description": "Creates a Customer.", + "parameters": [], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "first_name", + "last_name" + ], + "properties": { + "email": { + "type": "string", + "description": "The Customer's email address." + }, + "first_name": { + "type": "string", + "description": "The Customer's first name." + }, + "last_name": { + "type": "string", + "description": "The Customer's last name." + }, + "phone": { + "type": "string", + "description": "The Customer's phone number." + } + } + } + } + } + } + }, + "get": { + "operationId": "GetCustomers", + "summary": "List Customers", + "description": "Retrieves a list of Customers.", + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers/{id}": { + "get": { + "operationId": "GetCustomersCustomer", + "summary": "Retrieve a Customer", + "description": "Retrieves a Customer.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Customer.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCustomersCustomer", + "summary": "Update a Customer", + "description": "Updates a Customer.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Customer.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "first_name": { + "type": "string", + "description": "The Customer's first name." + }, + "last_name": { + "type": "string", + "description": "The Customer's last name." + }, + "phone": { + "description": "The Customer's phone number.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, "/collections": { "post": { "operationId": "PostCollections", @@ -357,14 +534,47 @@ } } }, - "/customers": { + "/gift-cards": { "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer.", - "parameters": [], + "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": [ - "Customer" + "Gift Card" ], "responses": { "200": { @@ -373,54 +583,22 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "gift_card": { + "$ref": "#/components/schemas/gift_card" } } } } } } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "first_name", - "last_name" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email address." - }, - "first_name": { - "type": "string", - "description": "The Customer's first name." - }, - "last_name": { - "type": "string", - "description": "The Customer's last name." - }, - "phone": { - "type": "string", - "description": "The Customer's phone number." - } - } - } - } - } } }, "get": { - "operationId": "GetCustomers", - "summary": "List Customers", - "description": "Retrieves a list of Customers.", + "operationId": "GetGiftCards", + "summary": "List Gift Cards", + "description": "Retrieves a list of Gift Cards.", "tags": [ - "Customer" + "Gift Card" ], "responses": { "200": { @@ -429,8 +607,11 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "gift_cards": { + "type": "array", + "items": { + "$ref": "#/components/schemas/gift_card" + } } } } @@ -440,24 +621,24 @@ } } }, - "/customers/{id}": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieve a Customer", - "description": "Retrieves a Customer.", + "/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 Customer.", + "description": "The id of the Gift Card to delete.", "schema": { "type": "string" } } ], "tags": [ - "Customer" + "Gift Card" ], "responses": { "200": { @@ -466,8 +647,51 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "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" } } } @@ -477,15 +701,15 @@ } }, "post": { - "operationId": "PostCustomersCustomer", - "summary": "Update a Customer", - "description": "Updates a Customer.", + "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 Customer.", + "description": "The id of the Gift Card.", "schema": { "type": "string" } @@ -496,16 +720,28 @@ "application/json": { "schema": { "properties": { - "first_name": { - "type": "string", - "description": "The Customer's first name." + "balance": { + "type": "integer", + "description": "The value (excluding VAT) that the Gift Card should represent." }, - "last_name": { - "type": "string", - "description": "The Customer's last name." + "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." }, - "phone": { - "description": "The Customer's phone number.", + "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" } } @@ -514,7 +750,7 @@ } }, "tags": [ - "Customer" + "Gift Card" ], "responses": { "200": { @@ -523,8 +759,8 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "gift_card": { + "$ref": "#/components/schemas/gift_card" } } } @@ -717,6 +953,10 @@ "type": "string" } }, + "usage_limit": { + "type": "number", + "description": "Maximum times the discount can be used" + }, "metadata": { "description": "An optional set of key-value pairs to hold additional information.", "type": "object" @@ -1038,242 +1278,6 @@ } } }, - "/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", @@ -1960,6 +1964,10 @@ } } } + }, + "no_notification": { + "description": "If set to true no notification will be send", + "type": "boolean" } } } @@ -2265,82 +2273,6 @@ } } }, - "/orders/{id}/returns/{return_id}/receive": { - "post": { - "operationId": "PostOrdersOrderReturnsReturnReceive", - "summary": "Receive a Return", - "description": "Registers a Return as received.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Order.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "return_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": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, "/orders/{id}/swaps/{swap_id}/receive": { "post": { "operationId": "PostOrdersOrderSwapsSwapReceive", @@ -3926,6 +3858,183 @@ } } }, + "/return-reasons": { + "post": { + "operationId": "PostReturnReasons", + "summary": "Create a Return Reason", + "description": "Creates a Return Reason", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "label": { + "description": "The label to display to the Customer.", + "type": "string" + }, + "value": { + "description": "The value that the Return Reason will be identified by. Must be unique.", + "type": "string" + }, + "description": { + "description": "An optional description to for the Reason.", + "type": "string" + }, + "metadata": { + "description": "An optional set of key-value pairs with additional information.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Return Reason" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "return_reason": { + "$ref": "#/components/schemas/return_reason" + } + } + } + } + } + } + } + }, + "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" + } + } + } + } + } + } + } + } + } + }, + "/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" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostReturnReasonsReason", + "summary": "Update a Return Reason", + "description": "Updates a Return Reason", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Return Reason.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "label": { + "description": "The label to display to the Customer.", + "type": "string" + }, + "value": { + "description": "The value that the Return Reason will be identified by. Must be unique.", + "type": "string" + }, + "description": { + "description": "An optional description to for the Reason.", + "type": "string" + }, + "metadata": { + "description": "An optional set of key-value pairs with additional information.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Return Reason" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "return_reason": { + "$ref": "#/components/schemas/return_reason" + } + } + } + } + } + } + } + } + }, "/regions/{id}/countries": { "post": { "operationId": "PostRegionsRegionCountries", @@ -4565,183 +4674,6 @@ } } }, - "/return-reasons": { - "post": { - "operationId": "PostReturnReasons", - "summary": "Create a Return Reason", - "description": "Creates a Return Reason", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "label": { - "description": "The label to display to the Customer.", - "type": "string" - }, - "value": { - "description": "The value that the Return Reason will be identified by. Must be unique.", - "type": "string" - }, - "description": { - "description": "An optional description to for the Reason.", - "type": "string" - }, - "metadata": { - "description": "An optional set of key-value pairs with additional information.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - }, - "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" - } - } - } - } - } - } - } - } - } - }, - "/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" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostReturnReasonsReason", - "summary": "Update a Return Reason", - "description": "Updates a Return Reason", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Return Reason.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "label": { - "description": "The label to display to the Customer.", - "type": "string" - }, - "value": { - "description": "The value that the Return Reason will be identified by. Must be unique.", - "type": "string" - }, - "description": { - "description": "An optional description to for the Reason.", - "type": "string" - }, - "metadata": { - "description": "An optional set of key-value pairs with additional information.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Return Reason" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return_reason": { - "$ref": "#/components/schemas/return_reason" - } - } - } - } - } - } - } - } - }, "/returns": { "get": { "operationId": "GetReturns", @@ -4771,6 +4703,269 @@ } } }, + "/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" + } + } + } + } + } + } + } + } + }, + "/shipping-profiles": { + "post": { + "operationId": "PostShippingProfiles", + "summary": "Create a Shipping Profile", + "description": "Creates a Shipping Profile", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "The name of the Shipping Profile", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Shipping Profile" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "shipping_profile": { + "$ref": "#/components/schemas/shipping_profile" + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetShippingProfiles", + "summary": "List Shipping Profiles", + "description": "Retrieves a list of Shipping Profile.", + "tags": [ + "Shipping Profile" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "shipping_profiles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/shipping_profile" + } + } + } + } + } + } + } + } + } + }, + "/shipping-profiles/{id}": { + "delete": { + "operationId": "DeleteShippingProfilesProfile", + "summary": "Delete a Shipping Profile", + "description": "Deletes a Shipping Profile.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Shipping Profile.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Shipping Profile" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The id of the deleted Shipping Profile." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted." + }, + "deleted": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetShippingProfilesProfile", + "summary": "Retrieve a Shipping Profile", + "description": "Retrieves a Shipping Profile.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Shipping Profile.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Shipping Profile" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "shipping_profile": { + "$ref": "#/components/schemas/shipping_profile" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostShippingProfilesProfile", + "summary": "Update a Shipping Profiles", + "description": "Updates a Shipping Profile", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Shipping Profile.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "The name of the Shipping Profile", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Shipping Profile" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "shipping_profiles": { + "$ref": "#/components/schemas/shipping_profile" + } + } + } + } + } + } + } + } + }, "/shipping-options": { "post": { "operationId": "PostShippingOptions", @@ -5043,202 +5238,6 @@ } } }, - "/shipping-profiles": { - "post": { - "operationId": "PostShippingProfiles", - "summary": "Create a Shipping Profile", - "description": "Creates a Shipping Profile", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "name": { - "description": "The name of the Shipping Profile", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profile": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetShippingProfiles", - "summary": "List Shipping Profiles", - "description": "Retrieves a list of Shipping Profile.", - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profiles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - } - } - }, - "/shipping-profiles/{id}": { - "delete": { - "operationId": "DeleteShippingProfilesProfile", - "summary": "Delete a Shipping Profile", - "description": "Deletes a Shipping Profile.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Shipping Profile.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "id": { - "type": "string", - "description": "The id of the deleted Shipping Profile." - }, - "object": { - "type": "string", - "description": "The type of the object that was deleted." - }, - "deleted": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetShippingProfilesProfile", - "summary": "Retrieve a Shipping Profile", - "description": "Retrieves a Shipping Profile.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Shipping Profile.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profile": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostShippingProfilesProfile", - "summary": "Update a Shipping Profiles", - "description": "Updates a Shipping Profile", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Shipping Profile.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "name": { - "description": "The name of the Shipping Profile", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Shipping Profile" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "shipping_profiles": { - "$ref": "#/components/schemas/shipping_profile" - } - } - } - } - } - } - } - } - }, "/store/currencies/{code}": { "post": { "operationId": "PostStoreCurrenciesCode", @@ -6020,10 +6019,6 @@ "$ref": "#/components/schemas/product" } }, - "usage_limit": { - "description": "The maximum number of times that a discount can be used.", - "type": "integer" - }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", @@ -6095,6 +6090,14 @@ "$ref": "#/components/schemas/region" } }, + "usage_limit": { + "description": "The maximum number of times that a discount can be used.", + "type": "integer" + }, + "usage_count": { + "description": "The number of times a discount has been used.", + "type": "integer" + }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", @@ -6869,6 +6872,9 @@ }, "gift_card_total": { "type": "integer" + }, + "paid_total": { + "type": "integer" } } }, diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 048de24094..01407368f2 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -85,6 +85,119 @@ paths: properties: user: $ref: '#/components/schemas/user' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + parameters: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - first_name + - last_name + properties: + email: + type: string + description: The Customer's email address. + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + phone: + type: string + description: The Customer's phone number. + get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '/customers/{id}': + get: + operationId: GetCustomersCustomer + summary: Retrieve a Customer + description: Retrieves a Customer. + parameters: + - in: path + name: id + required: true + description: The id of the Customer. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + post: + operationId: PostCustomersCustomer + summary: Update a Customer + description: Updates a Customer. + parameters: + - in: path + name: id + required: true + description: The id of the Customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + phone: + description: The Customer's phone number. + type: object + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' /collections: post: operationId: PostCollections @@ -227,119 +340,6 @@ paths: properties: collection: $ref: '#/components/schemas/product_collection' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - parameters: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - first_name - - last_name - properties: - email: - type: string - description: The Customer's email address. - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - phone: - type: string - description: The Customer's phone number. - get: - operationId: GetCustomers - summary: List Customers - description: Retrieves a list of Customers. - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - '/customers/{id}': - get: - operationId: GetCustomersCustomer - summary: Retrieve a Customer - description: Retrieves a Customer. - parameters: - - in: path - name: id - required: true - description: The id of the Customer. - schema: - type: string - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - post: - operationId: PostCustomersCustomer - summary: Update a Customer - description: Updates a Customer. - parameters: - - in: path - name: id - required: true - description: The id of the Customer. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - phone: - description: The Customer's phone number. - type: object - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' '/discounts/{id}/regions/{region_id}': post: operationId: PostDiscountsDiscountRegionsRegion @@ -478,6 +478,9 @@ paths: type: array items: type: string + usage_limit: + type: number + description: Maximum times the discount can be used metadata: description: >- An optional set of key-value pairs to hold additional @@ -910,266 +913,34 @@ paths: properties: notification: $ref: '#/components/schemas/notification' - '/orders/{id}/shipping-methods': + /return-reasons: 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 + operationId: PostReturnReasons + summary: Create a Return Reason + description: Creates a Return Reason requestBody: content: application/json: schema: properties: - fulfillment_id: - description: The id of the Fulfillment. + label: + description: The label to display to the Customer. 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: + value: 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. + The value that the Return Reason will be identified by. Must + be unique. + type: string + description: + description: An optional description to for the Reason. 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 - refund_amount: - description: >- - The amount to refund the Customer when the Claim type is - `refund`. - type: integer metadata: description: >- - An optional set of key-value pairs to hold additional + An optional set of key-value pairs with additional information. type: object tags: - - Order + - Return Reason responses: '200': description: OK @@ -1177,317 +948,14 @@ paths: 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 - 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}': + return_reason: + $ref: '#/components/schemas/return_reason' 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 + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. tags: - - Order + - Return Reason responses: '200': description: OK @@ -1495,49 +963,24 @@ paths: 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: + return_reasons: 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. + $ref: '#/components/schemas/return_reason' + '/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 Order. - schema: - type: string - - in: path - name: swap_id - required: true - description: The id of the Swap. + description: The id of the Return Reason. schema: type: string tags: - - Order + - Return Reason responses: '200': description: OK @@ -1545,24 +988,17 @@ paths: application/json: schema: properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}/returns/{return_id}/receive': + return_reason: + $ref: '#/components/schemas/return_reason' post: - operationId: PostOrdersOrderReturnsReturnReceive - summary: Receive a Return - description: Registers a Return as received. + operationId: PostReturnReasonsReason + summary: Update a Return Reason + description: Updates a Return Reason parameters: - in: path name: id required: true - description: The id of the Order. - schema: - type: string - - in: path - name: return_id - required: true - description: The id of the Return. + description: The id of the Return Reason. schema: type: string requestBody: @@ -1570,269 +1006,24 @@ paths: 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: - - 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. + label: + description: The label to display to the Customer. type: string - note: - description: A not with additional details about the Refund. + value: + description: >- + The value that the Return Reason will be identified by. Must + be unique. + type: string + description: + description: An optional description to for the Reason. 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 metadata: description: >- - An optional set of key-value pairs to hold additional + An optional set of key-value pairs with additional information. type: object tags: - - Order + - Return Reason responses: '200': description: OK @@ -1840,8 +1031,8 @@ paths: application/json: schema: properties: - order: - $ref: '#/components/schemas/order' + return_reason: + $ref: '#/components/schemas/return_reason' '/products/{id}/options': post: operationId: PostProductsProductOptions @@ -3159,126 +2350,6 @@ paths: properties: region: $ref: '#/components/schemas/region' - /return-reasons: - post: - operationId: PostReturnReasons - summary: Create a Return Reason - description: Creates a Return Reason - requestBody: - content: - application/json: - schema: - properties: - label: - description: The label to display to the Customer. - type: string - value: - description: >- - The value that the Return Reason will be identified by. Must - be unique. - type: string - description: - description: An optional description to for the Reason. - type: string - metadata: - description: >- - An optional set of key-value pairs with additional - information. - type: object - tags: - - Return Reason - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - return_reason: - $ref: '#/components/schemas/return_reason' - 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' - '/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' - post: - operationId: PostReturnReasonsReason - summary: Update a Return Reason - description: Updates a Return Reason - parameters: - - in: path - name: id - required: true - description: The id of the Return Reason. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - label: - description: The label to display to the Customer. - type: string - value: - description: >- - The value that the Return Reason will be identified by. Must - be unique. - type: string - description: - description: An optional description to for the Reason. - type: string - metadata: - description: >- - An optional set of key-value pairs with additional - information. - type: object - tags: - - Return Reason - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - return_reason: - $ref: '#/components/schemas/return_reason' /returns: get: operationId: GetReturns @@ -3297,6 +2368,937 @@ paths: 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' + '/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 + refund_amount: + description: >- + The amount to refund the Customer when the Claim type is + `refund`. + 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}/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 + 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 + 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 @@ -3608,6 +3610,24 @@ paths: properties: shipping_profiles: $ref: '#/components/schemas/shipping_profile' + /swaps: + get: + operationId: GetSwaps + summary: List Swaps + description: Retrieves a list of Swaps. + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swaps: + type: array + items: + $ref: '#/components/schemas/swap' '/store/currencies/{code}': post: operationId: PostStoreCurrenciesCode @@ -3718,24 +3738,6 @@ paths: type: array items: $ref: '#/components/schemas/store' - /swaps: - get: - operationId: GetSwaps - summary: List Swaps - description: Retrieves a list of Swaps. - tags: - - Swap - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - swaps: - type: array - items: - $ref: '#/components/schemas/swap' /variants: get: operationId: GetVariants @@ -4167,9 +4169,6 @@ components: type: array items: $ref: '#/components/schemas/product' - usage_limit: - description: The maximum number of times that a discount can be used. - type: integer created_at: description: The date with timezone at which the resource was created. type: string @@ -4232,6 +4231,12 @@ components: type: array items: $ref: '#/components/schemas/region' + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + usage_count: + description: The number of times a discount has been used. + type: integer created_at: description: The date with timezone at which the resource was created. type: string @@ -4865,6 +4870,8 @@ components: type: integer gift_card_total: type: integer + paid_total: + type: integer payment_provider: title: Payment Provider description: Represents a Payment Provider plugin and holds its installation status. diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 5727ac1234..545a298abd 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -976,6 +976,55 @@ } } }, + "/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", @@ -1481,277 +1530,6 @@ } } }, - "/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", - "summary": "Retrieves a Product", - "description": "Retrieves a Product.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Product.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - }, - "/products": { - "get": { - "operationId": "GetProducts", - "summary": "List Products", - "description": "Retrieves a list of Products.", - "tags": [ - "Product" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "count": { - "description": "The total number of Products.", - "type": "integer" - }, - "offset": { - "description": "The offset for pagination.", - "type": "integer" - }, - "limit": { - "description": "The maxmimum number of Products to return,", - "type": "integer" - }, - "products": { - "type": "array", - "items": { - "$ref": "#/components/schemas/product" - } - } - } - } - } - } - } - } - } - }, - "/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" - } - } - } - } - } - } - } - } - } - }, - "/regions/{id}": { - "get": { - "operationId": "GetRegionsRegion", - "summary": "Retrieves 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" - } - } - } - } - } - } - } - } - }, - "/regions": { - "get": { - "operationId": "GetRegions", - "summary": "List Regions", - "description": "Retrieves a list of Regions.", - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "count": { - "description": "The total number of regions.", - "type": "integer" - }, - "offset": { - "description": "The offset for pagination.", - "type": "integer" - }, - "limit": { - "description": "The maxmimum number of regions to return,", - "type": "integer" - }, - "regions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - } - } - } - }, "/orders/cart/{cart_id}": { "get": { "operationId": "GetOrdersOrderCartId", @@ -1872,6 +1650,162 @@ } } }, + "/products/{id}": { + "get": { + "operationId": "GetProductsProduct", + "summary": "Retrieves a Product", + "description": "Retrieves a Product.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Product.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Product" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "product": { + "$ref": "#/components/schemas/product" + } + } + } + } + } + } + } + } + }, + "/products": { + "get": { + "operationId": "GetProducts", + "summary": "List Products", + "description": "Retrieves a list of Products.", + "tags": [ + "Product" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "count": { + "description": "The total number of Products.", + "type": "integer" + }, + "offset": { + "description": "The offset for pagination.", + "type": "integer" + }, + "limit": { + "description": "The maxmimum number of Products to return,", + "type": "integer" + }, + "products": { + "type": "array", + "items": { + "$ref": "#/components/schemas/product" + } + } + } + } + } + } + } + } + } + }, + "/regions/{id}": { + "get": { + "operationId": "GetRegionsRegion", + "summary": "Retrieves 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" + } + } + } + } + } + } + } + } + }, + "/regions": { + "get": { + "operationId": "GetRegions", + "summary": "List Regions", + "description": "Retrieves a list of Regions.", + "tags": [ + "Region" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "count": { + "description": "The total number of regions.", + "type": "integer" + }, + "offset": { + "description": "The offset for pagination.", + "type": "integer" + }, + "limit": { + "description": "The maxmimum number of regions to return,", + "type": "integer" + }, + "regions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/region" + } + } + } + } + } + } + } + } + } + }, "/returns": { "post": { "operationId": "PostReturns", @@ -1911,6 +1845,10 @@ "description": "The id of the Shipping Option to create the Shipping Method from." } } + }, + "no_notification": { + "description": "If set to true no notification will be send", + "type": "boolean" } } } @@ -1938,6 +1876,72 @@ } } }, + "/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", @@ -2696,10 +2700,6 @@ "$ref": "#/components/schemas/product" } }, - "usage_limit": { - "description": "The maximum number of times that a discount can be used.", - "type": "integer" - }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", @@ -2771,6 +2771,14 @@ "$ref": "#/components/schemas/region" } }, + "usage_limit": { + "description": "The maximum number of times that a discount can be used.", + "type": "integer" + }, + "usage_count": { + "description": "The number of times a discount has been used.", + "type": "integer" + }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", @@ -3545,6 +3553,9 @@ }, "gift_card_total": { "type": "integer" + }, + "paid_total": { + "type": "integer" } } }, diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 43e7a49d17..5f6fd465cf 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -1147,47 +1147,6 @@ paths: type: array items: $ref: '#/components/schemas/product' - '/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' '/regions/{id}': get: operationId: GetRegionsRegion @@ -1238,6 +1197,47 @@ paths: type: array items: $ref: '#/components/schemas/region' + '/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' /returns: post: operationId: PostReturns @@ -1274,6 +1274,9 @@ paths: description: >- The id of the Shipping Option to create the Shipping Method from. + no_notification: + description: If set to true no notification will be send + type: boolean tags: - Return responses: @@ -1285,6 +1288,29 @@ paths: properties: return: $ref: '#/components/schemas/return' + '/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' /shipping-options: get: operationId: GetShippingOptions @@ -1346,29 +1372,6 @@ paths: type: array items: $ref: '#/components/schemas/shipping_option' - '/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 @@ -1829,9 +1832,6 @@ components: type: array items: $ref: '#/components/schemas/product' - usage_limit: - description: The maximum number of times that a discount can be used. - type: integer created_at: description: The date with timezone at which the resource was created. type: string @@ -1894,6 +1894,12 @@ components: type: array items: $ref: '#/components/schemas/region' + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + usage_count: + description: The number of times a discount has been used. + type: integer created_at: description: The date with timezone at which the resource was created. type: string @@ -2527,6 +2533,8 @@ components: type: integer gift_card_total: type: integer + paid_total: + type: integer payment_provider: title: Payment Provider description: Represents a Payment Provider plugin and holds its installation status. diff --git a/packages/medusa/src/api/routes/admin/orders/create-swap.js b/packages/medusa/src/api/routes/admin/orders/create-swap.js index 7782400eaa..f81c02b35f 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-swap.js +++ b/packages/medusa/src/api/routes/admin/orders/create-swap.js @@ -45,6 +45,9 @@ import { defaultFields, defaultRelations } from "./" * quantity: * description: The quantity of the Product Variant to ship. * type: integer + * no_notification: + * description: If set to true no notification will be send. + * type: boolean * tags: * - Order * responses: @@ -65,7 +68,7 @@ export default async (req, res) => { .items({ item_id: Validator.string().required(), quantity: Validator.number().required(), - }) + }) .required(), return_shipping: Validator.object() .keys({ @@ -79,6 +82,7 @@ export default async (req, res) => { variant_id: Validator.string().required(), quantity: Validator.number().required(), }), + no_notification: Validator.boolean().optional() }) const { value, error } = schema.validate(req.body) @@ -134,6 +138,7 @@ export default async (req, res) => { value.return_items, value.additional_items, value.return_shipping, + no_notification, { idempotency_key: idempotencyKey.idempotency_key } ) diff --git a/packages/medusa/src/api/routes/store/returns/create-return.js b/packages/medusa/src/api/routes/store/returns/create-return.js index e04bf44037..c61727c4c5 100644 --- a/packages/medusa/src/api/routes/store/returns/create-return.js +++ b/packages/medusa/src/api/routes/store/returns/create-return.js @@ -31,6 +31,10 @@ import { MedusaError, Validator } from "medusa-core-utils" * option_id: * type: string * description: The id of the Shipping Option to create the Shipping Method from. + * no_notification: + * description: If set to true no notification will be send + * type: boolean + * * tags: * - Return * responses: @@ -59,6 +63,7 @@ export default async (req, res) => { option_id: Validator.string().optional(), }) .optional(), + no_notification: Validator.boolean().optional() }) const { value, error } = schema.validate(req.body) @@ -132,6 +137,7 @@ export default async (req, res) => { .emit("order.return_requested", { id: value.order_id, return_id: createdReturn.id, + no_notification: no_notification }) return { diff --git a/packages/medusa/src/services/__tests__/notification.js b/packages/medusa/src/services/__tests__/notification.js index f26ab26d15..64b6361b65 100644 --- a/packages/medusa/src/services/__tests__/notification.js +++ b/packages/medusa/src/services/__tests__/notification.js @@ -1,30 +1,31 @@ import NotificationService from "../notification" -import { IdMap, MockManager, MockRepository } from "medusa-test-utils" +import { MockManager, MockRepository } from "medusa-test-utils" describe("NotificationService", () => { - describe("send", () => { - const notificationRepository = MockRepository({ create: c => c }) + const notificationRepository = MockRepository({ create: c => c }) - const container = { - manager: MockManager, - notificationRepository, - noti_test: { - sendNotification: jest.fn(() => - Promise.resolve({ - to: "test@mail.com", - data: { id: "something" }, - }) - ), - }, - } + const container = { + manager: MockManager, + notificationRepository, + noti_test: { + sendNotification: jest.fn(() => + Promise.resolve({ + to: "test@mail.com", + data: { id: "something" }, + }) + ), + }, + } - const notificationService = new NotificationService(container) + beforeEach(() => { + jest.clearAllMocks() + }) - beforeEach(() => { - jest.clearAllMocks() - }) + describe("send", () =>{ it("successfully calls provider and saves noti", async () => { + const notificationService = new NotificationService(container) + await notificationService.send("event.test", { id: "test" }, "test") expect(container.noti_test.sendNotification).toHaveBeenCalledTimes(1) @@ -51,4 +52,30 @@ describe("NotificationService", () => { expect(notificationRepository.save).toHaveBeenCalledWith(constructed) }) }) + + describe("handleEvent", () => { + + it("cancels notification if no_notification is set", async () => { + const notificationService = new NotificationService(container) + const event = "event.test" + notificationService.subscribe(event, "test") + + await notificationService.handleEvent(event, {id: "id", + return_id: "id", + no_notification: true}) + + expect(container.noti_test.sendNotification).not.toHaveBeenCalled() + }) + + it("if no_notification is not set notification is send", async () => { + const notificationService = new NotificationService(container) + const event = "event.test" + notificationService.subscribe(event, "test") + + await notificationService.handleEvent(event, {id: "id", return_id: "id"}) + + expect(container.noti_test.sendNotification).toHaveBeenCalledTimes(1) + }) + + }) }) diff --git a/packages/medusa/src/services/__tests__/swap.js b/packages/medusa/src/services/__tests__/swap.js index cbbc61fc85..695583da6a 100644 --- a/packages/medusa/src/services/__tests__/swap.js +++ b/packages/medusa/src/services/__tests__/swap.js @@ -338,6 +338,28 @@ describe("SwapService", () => { expect(returnService.create).toHaveBeenCalledTimes(1) }) + + it.each([ + [true, true], + [false, false], + [undefined, undefined] + ])( "passes correct notification to eventBus with %s", async (input, expected) => { + + await swapService.create( + testOrder, + [{ item_id: IdMap.getId("line"), quantity: 1 }], + [{ variant_id: IdMap.getId("new-variant"), quantity: 1 }], + { + id: IdMap.getId("return-shipping"), + price: 20, + }, + input + ) + + expect(eventBusService.emit).toHaveBeenCalledWith( + expect.anything(), + {"id": undefined, "no_notification": expected}) + }) }) }) @@ -918,4 +940,6 @@ describe("SwapService", () => { }) }) }) + + }) diff --git a/packages/medusa/src/services/notification.js b/packages/medusa/src/services/notification.js index df75b7fdc0..e0165ef952 100644 --- a/packages/medusa/src/services/notification.js +++ b/packages/medusa/src/services/notification.js @@ -164,6 +164,9 @@ class NotificationService extends BaseService { if (!subs) { return } + if(data['no_notification'] === true) { + return + } return Promise.all( subs.map(async providerId => { diff --git a/packages/medusa/src/services/swap.js b/packages/medusa/src/services/swap.js index fef1599ceb..6c7ca61ec2 100644 --- a/packages/medusa/src/services/swap.js +++ b/packages/medusa/src/services/swap.js @@ -204,6 +204,7 @@ class SwapService extends BaseService { * the customer. * @param {ReturnShipping?} returnShipping - an optional shipping method for * returning the returnItems. + * @param {boolean?} noNotification - an optional flag to disable sending notification when creating swap * @returns {Promise} the newly created swap. */ async create( @@ -211,6 +212,7 @@ class SwapService extends BaseService { returnItems, additionalItems, returnShipping, + noNotification, custom = {} ) { return this.atomicPhase_(async manager => { @@ -256,6 +258,7 @@ class SwapService extends BaseService { .withTransaction(manager) .emit(SwapService.Events.CREATED, { id: result.id, + no_notification: noNotification, }) return result