diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index f6648c935e..3e75450599 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -71,14 +71,14 @@ } ], "paths": { - "/auth": { + "/customers": { "post": { - "operationId": "PostAuth", - "summary": "Authenticate a User", - "description": "Logs a User in and authorizes them to manage Store settings.", + "operationId": "PostCustomers", + "summary": "Create a Customer", + "description": "Creates a Customer.", "parameters": [], "tags": [ - "Auth" + "Customer" ], "responses": { "200": { @@ -88,7 +88,7 @@ "schema": { "properties": { "customer": { - "$ref": "#/components/schemas/user" + "$ref": "#/components/schemas/customer" } } } @@ -103,16 +103,25 @@ "type": "object", "required": [ "email", - "password" + "first_name", + "last_name" ], "properties": { "email": { "type": "string", - "description": "The User's email." + "description": "The Customer's email address." }, - "password": { + "first_name": { "type": "string", - "description": "The User's password." + "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." } } } @@ -121,11 +130,11 @@ } }, "get": { - "operationId": "GetAuth", - "summary": "Get Session", - "description": "Gets the currently logged in User.", + "operationId": "GetCustomers", + "summary": "List Customers", + "description": "Retrieves a list of Customers.", "tags": [ - "Auth" + "Customer" ], "responses": { "200": { @@ -135,7 +144,101 @@ "schema": { "properties": { "customer": { - "$ref": "#/components/schemas/user" + "$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" } } } @@ -357,14 +460,14 @@ } } }, - "/customers": { + "/auth": { "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer.", + "operationId": "PostAuth", + "summary": "Authenticate a User", + "description": "Logs a User in and authorizes them to manage Store settings.", "parameters": [], "tags": [ - "Customer" + "Auth" ], "responses": { "200": { @@ -374,7 +477,7 @@ "schema": { "properties": { "customer": { - "$ref": "#/components/schemas/customer" + "$ref": "#/components/schemas/user" } } } @@ -389,25 +492,16 @@ "type": "object", "required": [ "email", - "first_name", - "last_name" + "password" ], "properties": { "email": { "type": "string", - "description": "The Customer's email address." + "description": "The User's email." }, - "first_name": { + "password": { "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." + "description": "The User's password." } } } @@ -416,11 +510,11 @@ } }, "get": { - "operationId": "GetCustomers", - "summary": "List Customers", - "description": "Retrieves a list of Customers.", + "operationId": "GetAuth", + "summary": "Get Session", + "description": "Gets the currently logged in User.", "tags": [ - "Customer" + "Auth" ], "responses": { "200": { @@ -430,7 +524,7 @@ "schema": { "properties": { "customer": { - "$ref": "#/components/schemas/customer" + "$ref": "#/components/schemas/user" } } } @@ -440,24 +534,47 @@ } } }, - "/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" + "/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": [ - "Customer" + "Gift Card" ], "responses": { "200": { @@ -466,8 +583,115 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "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" } } } @@ -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" } } } @@ -1038,242 +1274,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", @@ -3915,6 +3915,35 @@ } } }, + "/returns": { + "get": { + "operationId": "GetReturns", + "summary": "List Returns", + "description": "Retrieves a list of Returns", + "tags": [ + "Return" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "returns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/return" + } + } + } + } + } + } + } + } + } + }, "/regions/{id}/countries": { "post": { "operationId": "PostRegionsRegionCountries", @@ -4554,35 +4583,6 @@ } } }, - "/returns": { - "get": { - "operationId": "GetReturns", - "summary": "List Returns", - "description": "Retrieves a list of Returns", - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "returns": { - "type": "array", - "items": { - "$ref": "#/components/schemas/return" - } - } - } - } - } - } - } - } - } - }, "/shipping-options": { "post": { "operationId": "PostShippingOptions", @@ -5051,6 +5051,35 @@ } } }, + "/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", @@ -5224,35 +5253,6 @@ } } }, - "/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", diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 6668035d49..e90c27efbf 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -695,178 +695,6 @@ paths: properties: discount: $ref: '#/components/schemas/discount' - /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 @@ -1834,6 +1662,178 @@ paths: properties: order: $ref: '#/components/schemas/order' + /gift-cards: + post: + operationId: PostGiftCards + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + requestBody: + content: + application/json: + schema: + properties: + value: + type: integer + description: >- + The value (excluding VAT) that the Gift Card should + represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have + to enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: >- + The time at which the Gift Card should no longer be + available. + region_id: + description: The id of the Region in which the Gift Card can be used. + type: array + items: + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + get: + operationId: GetGiftCards + summary: List Gift Cards + description: Retrieves a list of Gift Cards. + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_cards: + type: array + items: + $ref: '#/components/schemas/gift_card' + '/gift-cards/{id}': + delete: + operationId: DeleteGiftCardsGiftCard + summary: Delete a Gift Card + description: Deletes a Gift Card + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card to delete. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The id of the deleted Gift Card + object: + type: string + description: The type of the object that was deleted. + deleted: + type: boolean + get: + operationId: GetGiftCardsGiftCard + summary: Retrieve a Gift Card + description: Retrieves a Gift Card. + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' + post: + operationId: PostGiftCardsGiftCard + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + parameters: + - in: path + name: id + required: true + description: The id of the Gift Card. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + balance: + type: integer + description: >- + The value (excluding VAT) that the Gift Card should + represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have + to enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: >- + The time at which the Gift Card should no longer be + available. + region_id: + description: The id of the Region in which the Gift Card can be used. + type: array + items: + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: '#/components/schemas/gift_card' '/products/{id}/options': post: operationId: PostProductsProductOptions diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 28e3e02a74..17d183e563 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -199,511 +199,6 @@ } } }, - "/customers/{id}/addresses": { - "post": { - "operationId": "PostCustomersCustomerAddresses", - "summary": "Add a Shipping Address", - "description": "Adds a Shipping Address to a Customer's saved addresses.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Customer id.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "address": { - "description": "The Address to add to the Customer.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "A successful response", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers": { - "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer account.", - "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", - "password" - ], - "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." - }, - "password": { - "type": "string", - "description": "The Customer's password for login." - }, - "phone": { - "type": "string", - "description": "The Customer's phone number." - } - } - } - } - } - } - } - }, - "/customers/{id}/addresses/{address_id}": { - "delete": { - "operationId": "DeleteCustomersCustomerAddressesAddress", - "summary": "Delete an Address", - "description": "Removes an Address from the Customer's saved addresse.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "address_id", - "required": true, - "description": "The id of the Address to remove.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomersCustomerAddressesAddress", - "summary": "Update a Shipping Address", - "description": "Updates a Customer's saved Shipping Address.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Customer id.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "address_id", - "required": true, - "description": "The id of the Address to update.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "address": { - "description": "The updated Address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/{id}": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieves a Customer", - "description": "Retrieves a Customer - the Customer must be logged in to retrieve their details.", - "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 Customer details", - "description": "Updates a Customer's saved details.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "first_name": { - "description": "The Customer's first name.", - "type": "string" - }, - "last_name": { - "description": "The Customer's last name.", - "type": "string" - }, - "password": { - "description": "The Customer's password.", - "type": "string" - }, - "phone": { - "description": "The Customer's phone number.", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/{id}/payment-methods": { - "get": { - "operationId": "GetCustomersCustomerPaymentMethods", - "summary": "Retrieve saved payment methods", - "description": "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods.", - "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": { - "payment_methods": { - "type": "array", - "items": { - "properties": { - "provider_id": { - "type": "string", - "description": "The id of the Payment Provider where the payment method is saved." - }, - "data": { - "type": "object", - "description": "The data needed for the Payment Provider to use the saved payment method." - } - } - } - } - } - } - } - } - } - } - } - }, - "/customers/{id}/orders": { - "get": { - "operationId": "GetCustomersCustomerOrders", - "summary": "Retrieve Customer Orders", - "description": "Retrieves a list of a Customer's Orders.", - "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": { - "payment_methods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - } - }, - "/customers/{id}/password-token": { - "post": { - "operationId": "PostCustomersCustomerPasswordToken", - "summary": "Creates a reset password token", - "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "204": { - "description": "OK" - } - } - } - }, - "/customers/{id}/reset-password": { - "post": { - "operationId": "PostCustomersCustomerResetPassword", - "summary": "Resets Customer password", - "description": "Resets a Customer's password using a password token created by a previous /password-token request.", - "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" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "token", - "password" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email." - }, - "token": { - "type": "string", - "description": "The password token created by a /password-token request." - }, - "password": { - "type": "string", - "description": "The new password to set for the Customer." - } - } - } - } - } - } - } - }, "/carts/{id}/shipping-methods": { "post": { "operationId": "PostCartsCartShippingMethod", @@ -1473,6 +968,546 @@ } } }, + "/customers/{id}/addresses": { + "post": { + "operationId": "PostCustomersCustomerAddresses", + "summary": "Add a Shipping Address", + "description": "Adds a Shipping Address to a Customer's saved addresses.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The Customer id.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "address": { + "description": "The Address to add to the Customer.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "A successful response", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers": { + "post": { + "operationId": "PostCustomers", + "summary": "Create a Customer", + "description": "Creates a Customer account.", + "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", + "password" + ], + "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." + }, + "password": { + "type": "string", + "description": "The Customer's password for login." + }, + "phone": { + "type": "string", + "description": "The Customer's phone number." + } + } + } + } + } + } + } + }, + "/customers/{id}/addresses/{address_id}": { + "delete": { + "operationId": "DeleteCustomersCustomerAddressesAddress", + "summary": "Delete an Address", + "description": "Removes an Address from the Customer's saved addresse.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Customer.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "address_id", + "required": true, + "description": "The id of the Address to remove.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCustomersCustomerAddressesAddress", + "summary": "Update a Shipping Address", + "description": "Updates a Customer's saved Shipping Address.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The Customer id.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "address_id", + "required": true, + "description": "The id of the Address to update.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "address": { + "description": "The updated Address.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers/{id}": { + "get": { + "operationId": "GetCustomersCustomer", + "summary": "Retrieves a Customer", + "description": "Retrieves a Customer - the Customer must be logged in to retrieve their details.", + "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 Customer details", + "description": "Updates a Customer's saved details.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Customer.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "first_name": { + "description": "The Customer's first name.", + "type": "string" + }, + "last_name": { + "description": "The Customer's last name.", + "type": "string" + }, + "password": { + "description": "The Customer's password.", + "type": "string" + }, + "phone": { + "description": "The Customer's phone number.", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers/{id}/payment-methods": { + "get": { + "operationId": "GetCustomersCustomerPaymentMethods", + "summary": "Retrieve saved payment methods", + "description": "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods.", + "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": { + "payment_methods": { + "type": "array", + "items": { + "properties": { + "provider_id": { + "type": "string", + "description": "The id of the Payment Provider where the payment method is saved." + }, + "data": { + "type": "object", + "description": "The data needed for the Payment Provider to use the saved payment method." + } + } + } + } + } + } + } + } + } + } + } + }, + "/customers/{id}/orders": { + "get": { + "operationId": "GetCustomersCustomerOrders", + "summary": "Retrieve Customer Orders", + "description": "Retrieves a list of a Customer's Orders.", + "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": { + "payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/order" + } + } + } + } + } + } + } + } + } + }, + "/customers/{id}/password-token": { + "post": { + "operationId": "PostCustomersCustomerPasswordToken", + "summary": "Creates a reset password token", + "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Customer.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "204": { + "description": "OK" + } + } + } + }, + "/customers/{id}/reset-password": { + "post": { + "operationId": "PostCustomersCustomerResetPassword", + "summary": "Resets Customer password", + "description": "Resets a Customer's password using a password token created by a previous /password-token request.", + "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" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "token", + "password" + ], + "properties": { + "email": { + "type": "string", + "description": "The Customer's email." + }, + "token": { + "type": "string", + "description": "The password token created by a /password-token request." + }, + "password": { + "type": "string", + "description": "The new password to set for the Customer." + } + } + } + } + } + } + } + }, + "/gift-cards/{code}": { + "get": { + "operationId": "GetGiftCardsCode", + "summary": "Retrieve Gift Card by Code", + "description": "Retrieves a Gift Card by its associated unqiue code.", + "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" + } + } + } + } + } + } + } + } + }, "/orders/cart/{cart_id}": { "get": { "operationId": "GetOrdersOrderCartId", @@ -1547,6 +1582,52 @@ } } }, + "/orders": { + "get": { + "operationId": "GetOrders", + "summary": "Look Up an Order", + "description": "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned.", + "parameters": [ + { + "in": "query", + "name": "display_id", + "required": true, + "description": "The display id given to the Order.", + "schema": { + "type": "number" + } + }, + { + "in": "query", + "name": "email", + "required": true, + "description": "The email of the Order with the given display_id.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Order" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "order": { + "$ref": "#/components/schemas/order" + } + } + } + } + } + } + } + } + }, "/products/{id}": { "get": { "operationId": "GetProductsProduct", @@ -1625,50 +1706,53 @@ } } }, - "/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" + "/returns": { + "post": { + "operationId": "PostReturns", + "summary": "Create Return", + "description": "Creates a Return for an Order.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "order_id": { + "type": "string", + "description": "The id of the Order to create the Return from." + }, + "items": { + "description": "The items to include in the Return.", + "type": "array", + "items": { + "properties": { + "item_id": { + "description": "The id of the Line Item from the Order.", + "type": "string" + }, + "quantity": { + "description": "The quantity to return.", + "type": "integer" + } + } + } + }, + "return_shipping": { + "description": "If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.", + "type": "object", + "properties": { + "option_id": { + "type": "string", + "description": "The id of the Shipping Option to create the Shipping Method from." + } } } } } } } - } - } - }, - "/regions": { - "get": { - "operationId": "GetRegions", - "summary": "List Regions", - "description": "Retrieves a list of Regions.", + }, "tags": [ - "Region" + "Return" ], "responses": { "200": { @@ -1677,23 +1761,8 @@ "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" - } + "return": { + "$ref": "#/components/schemas/return" } } } @@ -1902,6 +1971,84 @@ } } } + }, + "/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" + } + } + } + } + } + } + } + } + } } }, "components": { diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 0998688653..44193543f2 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -645,6 +645,28 @@ paths: data: type: object description: The data to update the payment session with. + '/gift-cards/{code}': + get: + operationId: GetGiftCardsCode + summary: Retrieve Gift Card by Code + description: Retrieves a Gift Card by its associated unqiue code. + 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 '/customers/{id}/addresses': post: operationId: PostCustomersCustomerAddresses @@ -977,54 +999,6 @@ paths: password: type: string description: The new password to set for the Customer. - '/orders/cart/{cart_id}': - get: - operationId: GetOrdersOrderCartId - summary: Retrieves Order by Cart id - description: >- - Retrieves an Order by the id of the Cart that was used to create the - Order. - parameters: - - in: path - name: cart_id - required: true - description: The id of Cart. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Retrieves an Order - description: Retrieves an Order - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' '/products/{id}': get: operationId: GetProductsProduct @@ -1075,6 +1049,133 @@ paths: type: array items: $ref: '#/components/schemas/product' + '/orders/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Retrieves Order by Cart id + description: >- + Retrieves an Order by the id of the Cart that was used to create the + Order. + parameters: + - in: path + name: cart_id + required: true + description: The id of Cart. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Retrieves an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /orders: + get: + operationId: GetOrders + summary: Look Up an Order + description: >- + Looks for an Order with a given `display_id`, `email` pair. The + `display_id`, `email` pair must match in order for the Order to be + returned. + parameters: + - in: query + name: display_id + required: true + description: The display id given to the Order. + schema: + type: number + - in: query + name: email + required: true + description: The email of the Order with the given display_id. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + /returns: + post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + properties: + order_id: + type: string + description: The id of the Order to create the Return from. + items: + description: The items to include in the Return. + type: array + items: + properties: + item_id: + description: The id of the Line Item from the Order. + type: string + quantity: + description: The quantity to return. + type: integer + return_shipping: + description: >- + If the Return is to be handled by the store operator the + Customer can choose a Return Shipping Method. Alternatvely + the Customer can handle the Return themselves. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: '#/components/schemas/return' '/regions/{id}': get: operationId: GetRegionsRegion diff --git a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.js b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.js index 7a60875ab8..ce7d4c13fb 100644 --- a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.js +++ b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.js @@ -6,7 +6,7 @@ import { defaultRelations, defaultFields } from "./" * summary: "Retrieve Gift Card by Code" * description: "Retrieves a Gift Card by its associated unqiue code." * tags: - * - Region + * - Gift Card * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/store/orders/lookup-order.js b/packages/medusa/src/api/routes/store/orders/lookup-order.js index 5498a04adc..bbd8d99bdf 100644 --- a/packages/medusa/src/api/routes/store/orders/lookup-order.js +++ b/packages/medusa/src/api/routes/store/orders/lookup-order.js @@ -1,6 +1,26 @@ import { Validator, MedusaError } from "medusa-core-utils" import { defaultRelations, defaultFields } from "./index" +/** + * @oas [get] /orders + * operationId: "GetOrders" + * summary: "Look Up an Order" + * description: "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned." + * parameters: + * - (query) display_id=* {number} The display id given to the Order. + * - (query) email=* {string} The email of the Order with the given display_id. + * tags: + * - Order + * responses: + * 200: + * description: OK + * content: + * application/json: + * schema: + * properties: + * order: + * $ref: "#/components/schemas/order" + */ export default async (req, res) => { const schema = Validator.object().keys({ display_id: Validator.number().required(), 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 ef1d7c4060..f08b8a51c8 100644 --- a/packages/medusa/src/api/routes/store/returns/create-return.js +++ b/packages/medusa/src/api/routes/store/returns/create-return.js @@ -1,6 +1,48 @@ import { MedusaError, Validator } from "medusa-core-utils" -import { defaultRelations, defaultFields } from "./" +/** + * @oas [post] /returns + * operationId: "PostReturns" + * summary: "Create Return" + * description: "Creates a Return for an Order." + * requestBody: + * content: + * application/json: + * schema: + * properties: + * order_id: + * type: string + * description: The id of the Order to create the Return from. + * items: + * description: "The items to include in the Return." + * type: array + * items: + * properties: + * item_id: + * description: The id of the Line Item from the Order. + * type: string + * quantity: + * description: The quantity to return. + * type: integer + * return_shipping: + * description: If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves. + * type: object + * properties: + * option_id: + * type: string + * description: The id of the Shipping Option to create the Shipping Method from. + * tags: + * - Return + * responses: + * 200: + * description: OK + * content: + * application/json: + * schema: + * properties: + * return: + * $ref: "#/components/schemas/return" + */ export default async (req, res) => { const schema = Validator.object().keys({ order_id: Validator.string().required(),