docs: add clarification for set cart's customer API route (#13506)
This commit is contained in:
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to set the cart's customer
|
||||||
sdk.store.cart.transferCart("cart_123")
|
sdk.store.cart.transferCart("cart_123")
|
||||||
.then(({ cart }) => {
|
.then(({ cart }) => {
|
||||||
console.log(cart)
|
console.log(cart)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to retrieve their details
|
||||||
sdk.store.customer.retrieve()
|
sdk.store.customer.retrieve()
|
||||||
.then(({ customer }) => {
|
.then(({ customer }) => {
|
||||||
console.log(customer)
|
console.log(customer)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to update their details
|
||||||
sdk.store.customer.update({
|
sdk.store.customer.update({
|
||||||
first_name: "John"
|
first_name: "John"
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to list their addresses
|
||||||
sdk.store.customer.listAddress()
|
sdk.store.customer.listAddress()
|
||||||
.then(({ addresses, count, offset, limit }) => {
|
.then(({ addresses, count, offset, limit }) => {
|
||||||
console.log(addresses)
|
console.log(addresses)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to create an address
|
||||||
sdk.store.customer.createAddress({
|
sdk.store.customer.createAddress({
|
||||||
country_code: "us"
|
country_code: "us"
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to delete their address
|
||||||
sdk.store.customer.deleteAddress("caddr_123")
|
sdk.store.customer.deleteAddress("caddr_123")
|
||||||
.then(({ deleted, parent: customer }) => {
|
.then(({ deleted, parent: customer }) => {
|
||||||
console.log(customer)
|
console.log(customer)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to retrieve their address
|
||||||
sdk.store.customer.retrieveAddress(
|
sdk.store.customer.retrieveAddress(
|
||||||
"caddr_123"
|
"caddr_123"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to update their address
|
||||||
sdk.store.customer.updateAddress(
|
sdk.store.customer.updateAddress(
|
||||||
"caddr_123",
|
"caddr_123",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to list their orders
|
||||||
sdk.store.order.list()
|
sdk.store.order.list()
|
||||||
.then(({ orders, count, offset, limit }) => {
|
.then(({ orders, count, offset, limit }) => {
|
||||||
console.log(orders)
|
console.log(orders)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to cancel the order transfer
|
||||||
sdk.store.order.cancelTransfer(
|
sdk.store.order.cancelTransfer(
|
||||||
"order_123",
|
"order_123",
|
||||||
{},
|
{},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const sdk = new Medusa({
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to request the order transfer
|
||||||
sdk.store.order.requestTransfer(
|
sdk.store.order.requestTransfer(
|
||||||
"order_123",
|
"order_123",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}' \
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'Authorization: Bearer {access_token}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
curl '{backend_url}/store/orders' \
|
curl '{backend_url}/store/orders' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
@@ -1265,13 +1265,13 @@ paths:
|
|||||||
/store/carts/{id}/customer:
|
/store/carts/{id}/customer:
|
||||||
post:
|
post:
|
||||||
operationId: PostCartsIdCustomer
|
operationId: PostCartsIdCustomer
|
||||||
summary: Set Cart's Customer
|
summary: Change Cart's Customer to Logged-in Customer
|
||||||
x-sidebar-summary: Set Customer
|
x-sidebar-summary: Change Customer
|
||||||
description: Set the customer of the cart. This is useful when you create the cart for a guest customer, then they log in with their account.
|
description: Change the cart's customer to the currently logged-in customer. This is useful when you create the cart for a guest customer, then they log in with their account.
|
||||||
externalDocs:
|
externalDocs:
|
||||||
url: https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
url: https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
||||||
description: 'Storefront guide: How to set the cart''s customer.'
|
description: 'Storefront guide: How to set the cart''s customer.'
|
||||||
x-authenticated: false
|
x-authenticated: true
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@@ -1318,6 +1318,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to set the cart's customer
|
||||||
sdk.store.cart.transferCart("cart_123")
|
sdk.store.cart.transferCart("cart_123")
|
||||||
.then(({ cart }) => {
|
.then(({ cart }) => {
|
||||||
console.log(cart)
|
console.log(cart)
|
||||||
@@ -1326,6 +1327,7 @@ paths:
|
|||||||
label: cURL
|
label: cURL
|
||||||
source: |-
|
source: |-
|
||||||
curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
tags:
|
tags:
|
||||||
- Carts
|
- Carts
|
||||||
@@ -1361,6 +1363,9 @@ paths:
|
|||||||
description: Emitted when the customer in the cart is transferred.
|
description: Emitted when the customer in the cart is transferred.
|
||||||
deprecated: false
|
deprecated: false
|
||||||
since: 2.8.0
|
since: 2.8.0
|
||||||
|
security:
|
||||||
|
- cookie_auth: []
|
||||||
|
- jwt_token: []
|
||||||
/store/carts/{id}/gift-cards:
|
/store/carts/{id}/gift-cards:
|
||||||
post:
|
post:
|
||||||
operationId: PostCartsIdGiftCards
|
operationId: PostCartsIdGiftCards
|
||||||
@@ -3349,6 +3354,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to retrieve their details
|
||||||
sdk.store.customer.retrieve()
|
sdk.store.customer.retrieve()
|
||||||
.then(({ customer }) => {
|
.then(({ customer }) => {
|
||||||
console.log(customer)
|
console.log(customer)
|
||||||
@@ -3433,6 +3439,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to update their details
|
||||||
sdk.store.customer.update({
|
sdk.store.customer.update({
|
||||||
first_name: "John"
|
first_name: "John"
|
||||||
})
|
})
|
||||||
@@ -3623,6 +3630,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to list their addresses
|
||||||
sdk.store.customer.listAddress()
|
sdk.store.customer.listAddress()
|
||||||
.then(({ addresses, count, offset, limit }) => {
|
.then(({ addresses, count, offset, limit }) => {
|
||||||
console.log(addresses)
|
console.log(addresses)
|
||||||
@@ -3708,6 +3716,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to create an address
|
||||||
sdk.store.customer.createAddress({
|
sdk.store.customer.createAddress({
|
||||||
country_code: "us"
|
country_code: "us"
|
||||||
})
|
})
|
||||||
@@ -3811,6 +3820,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to retrieve their address
|
||||||
sdk.store.customer.retrieveAddress(
|
sdk.store.customer.retrieveAddress(
|
||||||
"caddr_123"
|
"caddr_123"
|
||||||
)
|
)
|
||||||
@@ -3904,6 +3914,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to update their address
|
||||||
sdk.store.customer.updateAddress(
|
sdk.store.customer.updateAddress(
|
||||||
"caddr_123",
|
"caddr_123",
|
||||||
{
|
{
|
||||||
@@ -4001,6 +4012,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to delete their address
|
||||||
sdk.store.customer.deleteAddress("caddr_123")
|
sdk.store.customer.deleteAddress("caddr_123")
|
||||||
.then(({ deleted, parent: customer }) => {
|
.then(({ deleted, parent: customer }) => {
|
||||||
console.log(customer)
|
console.log(customer)
|
||||||
@@ -4009,8 +4021,8 @@ paths:
|
|||||||
label: cURL
|
label: cURL
|
||||||
source: |-
|
source: |-
|
||||||
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}' \
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'Authorization: Bearer {access_token}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
tags:
|
tags:
|
||||||
- Customers
|
- Customers
|
||||||
responses:
|
responses:
|
||||||
@@ -4343,6 +4355,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to list their orders
|
||||||
sdk.store.order.list()
|
sdk.store.order.list()
|
||||||
.then(({ orders, count, offset, limit }) => {
|
.then(({ orders, count, offset, limit }) => {
|
||||||
console.log(orders)
|
console.log(orders)
|
||||||
@@ -4351,6 +4364,7 @@ paths:
|
|||||||
label: cURL
|
label: cURL
|
||||||
source: |-
|
source: |-
|
||||||
curl '{backend_url}/store/orders' \
|
curl '{backend_url}/store/orders' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
tags:
|
tags:
|
||||||
- Orders
|
- Orders
|
||||||
@@ -4643,6 +4657,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to cancel the order transfer
|
||||||
sdk.store.order.cancelTransfer(
|
sdk.store.order.cancelTransfer(
|
||||||
"order_123",
|
"order_123",
|
||||||
{},
|
{},
|
||||||
@@ -4657,6 +4672,7 @@ paths:
|
|||||||
label: cURL
|
label: cURL
|
||||||
source: |-
|
source: |-
|
||||||
curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
tags:
|
tags:
|
||||||
- Orders
|
- Orders
|
||||||
@@ -4844,6 +4860,7 @@ paths:
|
|||||||
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO must be authenticated as the customer to request the order transfer
|
||||||
sdk.store.order.requestTransfer(
|
sdk.store.order.requestTransfer(
|
||||||
"order_123",
|
"order_123",
|
||||||
{
|
{
|
||||||
@@ -4861,6 +4878,7 @@ paths:
|
|||||||
label: cURL
|
label: cURL
|
||||||
source: |-
|
source: |-
|
||||||
curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
||||||
|
-H 'Authorization: Bearer {access_token}' \
|
||||||
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
-H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
tags:
|
tags:
|
||||||
- Orders
|
- Orders
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
post:
|
post:
|
||||||
operationId: PostCartsIdCustomer
|
operationId: PostCartsIdCustomer
|
||||||
summary: Set Cart's Customer
|
summary: Change Cart's Customer to Logged-in Customer
|
||||||
x-sidebar-summary: Set Customer
|
x-sidebar-summary: Change Customer
|
||||||
description: >-
|
description: >-
|
||||||
Set the customer of the cart. This is useful when you create the cart for a
|
Change the cart's customer to the currently logged-in customer. This is
|
||||||
guest customer, then they log in with their account.
|
useful when you create the cart for a guest customer, then they log in with
|
||||||
|
their account.
|
||||||
externalDocs:
|
externalDocs:
|
||||||
url: >-
|
url: >-
|
||||||
https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
||||||
description: 'Storefront guide: How to set the cart''s customer.'
|
description: 'Storefront guide: How to set the cart''s customer.'
|
||||||
x-authenticated: false
|
x-authenticated: true
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@@ -88,3 +89,6 @@ post:
|
|||||||
description: Emitted when the customer in the cart is transferred.
|
description: Emitted when the customer in the cart is transferred.
|
||||||
deprecated: false
|
deprecated: false
|
||||||
since: 2.8.0
|
since: 2.8.0
|
||||||
|
security:
|
||||||
|
- cookie_auth: []
|
||||||
|
- jwt_token: []
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ This API route is only available after [Medusa v2.0.5](https://github.com/medusa
|
|||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// TODO must be authenticated as the customer to set the cart's customer
|
||||||
sdk.store.cart.transferCart(cartId)
|
sdk.store.cart.transferCart(cartId)
|
||||||
.then(({ cart }) => {
|
.then(({ cart }) => {
|
||||||
// use cart...
|
// use cart...
|
||||||
|
|||||||
@@ -720,8 +720,8 @@
|
|||||||
"description": "Emitted when a payment is captured.",
|
"description": "Emitted when a payment is captured.",
|
||||||
"workflows": [
|
"workflows": [
|
||||||
"capturePaymentWorkflow",
|
"capturePaymentWorkflow",
|
||||||
"processPaymentWorkflow",
|
"markPaymentCollectionAsPaid",
|
||||||
"markPaymentCollectionAsPaid"
|
"processPaymentWorkflow"
|
||||||
],
|
],
|
||||||
"deprecated": false
|
"deprecated": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to delete their address
|
||||||
* sdk.store.customer.deleteAddress("caddr_123")
|
* sdk.store.customer.deleteAddress("caddr_123")
|
||||||
* .then(({ deleted, parent: customer }) => {
|
* .then(({ deleted, parent: customer }) => {
|
||||||
* console.log(customer)
|
* console.log(customer)
|
||||||
@@ -66,8 +67,8 @@
|
|||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
* curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||||
* -H 'x-publishable-api-key: {your_publishable_api_key}' \
|
* -H 'Authorization: Bearer {access_token}' \
|
||||||
* -H 'Authorization: Bearer {access_token}'
|
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
* tags:
|
* tags:
|
||||||
* - Customers
|
* - Customers
|
||||||
* responses:
|
* responses:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to retrieve their details
|
||||||
* sdk.store.customer.retrieve()
|
* sdk.store.customer.retrieve()
|
||||||
* .then(({ customer }) => {
|
* .then(({ customer }) => {
|
||||||
* console.log(customer)
|
* console.log(customer)
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to list their addresses
|
||||||
* sdk.store.customer.listAddress()
|
* sdk.store.customer.listAddress()
|
||||||
* .then(({ addresses, count, offset, limit }) => {
|
* .then(({ addresses, count, offset, limit }) => {
|
||||||
* console.log(addresses)
|
* console.log(addresses)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to retrieve their address
|
||||||
* sdk.store.customer.retrieveAddress(
|
* sdk.store.customer.retrieveAddress(
|
||||||
* "caddr_123"
|
* "caddr_123"
|
||||||
* )
|
* )
|
||||||
|
|||||||
@@ -147,6 +147,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to list their orders
|
||||||
* sdk.store.order.list()
|
* sdk.store.order.list()
|
||||||
* .then(({ orders, count, offset, limit }) => {
|
* .then(({ orders, count, offset, limit }) => {
|
||||||
* console.log(orders)
|
* console.log(orders)
|
||||||
@@ -155,6 +156,7 @@
|
|||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl '{backend_url}/store/orders' \
|
* curl '{backend_url}/store/orders' \
|
||||||
|
* -H 'Authorization: Bearer {access_token}' \
|
||||||
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
* tags:
|
* tags:
|
||||||
* - Orders
|
* - Orders
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* @oas [post] /store/carts/{id}/customer
|
* @oas [post] /store/carts/{id}/customer
|
||||||
* operationId: PostCartsIdCustomer
|
* operationId: PostCartsIdCustomer
|
||||||
* summary: Set Cart's Customer
|
* summary: Change Cart's Customer to Logged-in Customer
|
||||||
* x-sidebar-summary: Set Customer
|
* x-sidebar-summary: Change Customer
|
||||||
* description: Set the customer of the cart. This is useful when you create the cart for a guest customer, then they log in with their account.
|
* description: Change the cart's customer to the currently logged-in customer. This is useful when you create the cart for a guest customer, then they log in with their account.
|
||||||
* externalDocs:
|
* externalDocs:
|
||||||
* url: https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
* url: https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
|
||||||
* description: "Storefront guide: How to set the cart's customer."
|
* description: "Storefront guide: How to set the cart's customer."
|
||||||
* x-authenticated: false
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - name: id
|
* - name: id
|
||||||
* in: path
|
* in: path
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to set the cart's customer
|
||||||
* sdk.store.cart.transferCart("cart_123")
|
* sdk.store.cart.transferCart("cart_123")
|
||||||
* .then(({ cart }) => {
|
* .then(({ cart }) => {
|
||||||
* console.log(cart)
|
* console.log(cart)
|
||||||
@@ -63,6 +64,7 @@
|
|||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
* curl -X POST '{backend_url}/store/carts/{id}/customer' \
|
||||||
|
* -H 'Authorization: Bearer {access_token}' \
|
||||||
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
* tags:
|
* tags:
|
||||||
* - Carts
|
* - Carts
|
||||||
@@ -98,6 +100,9 @@
|
|||||||
* description: Emitted when the customer in the cart is transferred.
|
* description: Emitted when the customer in the cart is transferred.
|
||||||
* deprecated: false
|
* deprecated: false
|
||||||
* since: 2.8.0
|
* since: 2.8.0
|
||||||
|
* security:
|
||||||
|
* - cookie_auth: []
|
||||||
|
* - jwt_token: []
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to update their details
|
||||||
* sdk.store.customer.update({
|
* sdk.store.customer.update({
|
||||||
* first_name: "John"
|
* first_name: "John"
|
||||||
* })
|
* })
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to create an address
|
||||||
* sdk.store.customer.createAddress({
|
* sdk.store.customer.createAddress({
|
||||||
* country_code: "us"
|
* country_code: "us"
|
||||||
* })
|
* })
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to update their address
|
||||||
* sdk.store.customer.updateAddress(
|
* sdk.store.customer.updateAddress(
|
||||||
* "caddr_123",
|
* "caddr_123",
|
||||||
* {
|
* {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to cancel the order transfer
|
||||||
* sdk.store.order.cancelTransfer(
|
* sdk.store.order.cancelTransfer(
|
||||||
* "order_123",
|
* "order_123",
|
||||||
* {},
|
* {},
|
||||||
@@ -66,6 +67,7 @@
|
|||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
* curl -X POST '{backend_url}/store/orders/{id}/transfer/cancel' \
|
||||||
|
* -H 'Authorization: Bearer {access_token}' \
|
||||||
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
* tags:
|
* tags:
|
||||||
* - Orders
|
* - Orders
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
* publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
* // TODO must be authenticated as the customer to request the order transfer
|
||||||
* sdk.store.order.requestTransfer(
|
* sdk.store.order.requestTransfer(
|
||||||
* "order_123",
|
* "order_123",
|
||||||
* {
|
* {
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
* curl -X POST '{backend_url}/store/orders/{id}/transfer/request' \
|
||||||
|
* -H 'Authorization: Bearer {access_token}' \
|
||||||
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
* -H 'x-publishable-api-key: {your_publishable_api_key}'
|
||||||
* tags:
|
* tags:
|
||||||
* - Orders
|
* - Orders
|
||||||
|
|||||||
@@ -1008,7 +1008,7 @@
|
|||||||
"js-sdk": "sdk.store.cart.complete(\"cart_123\")\n.then((data) => {\n if(data.type === \"cart\") {\n // an error occurred\n console.log(data.error, data.cart)\n } else {\n // order placed successfully\n console.log(data.order)\n }\n})"
|
"js-sdk": "sdk.store.cart.complete(\"cart_123\")\n.then((data) => {\n if(data.type === \"cart\") {\n // an error occurred\n console.log(data.error, data.cart)\n } else {\n // order placed successfully\n console.log(data.order)\n }\n})"
|
||||||
},
|
},
|
||||||
"POST /store/carts/{id}/customer": {
|
"POST /store/carts/{id}/customer": {
|
||||||
"js-sdk": "sdk.store.cart.transferCart(\"cart_123\")\n.then(({ cart }) => {\n console.log(cart)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to set the cart's customer\nsdk.store.cart.transferCart(\"cart_123\")\n.then(({ cart }) => {\n console.log(cart)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/shipping-options": {
|
"GET /store/shipping-options": {
|
||||||
"js-sdk": "sdk.store.fulfillment.listCartOptions({\n cart_id: \"cart_123\"\n})\n.then(({ shipping_options }) => {\n console.log(shipping_options)\n})"
|
"js-sdk": "sdk.store.fulfillment.listCartOptions({\n cart_id: \"cart_123\"\n})\n.then(({ shipping_options }) => {\n console.log(shipping_options)\n})"
|
||||||
@@ -1023,16 +1023,16 @@
|
|||||||
"js-sdk": "sdk.store.payment.initiatePaymentSession(\n cart, // assuming you already have the cart object.\n {\n provider_id: \"pp_stripe_stripe\",\n data: {\n // any data relevant for the provider.\n }\n }\n)\n.then(({ payment_collection }) => {\n console.log(payment_collection)\n})"
|
"js-sdk": "sdk.store.payment.initiatePaymentSession(\n cart, // assuming you already have the cart object.\n {\n provider_id: \"pp_stripe_stripe\",\n data: {\n // any data relevant for the provider.\n }\n }\n)\n.then(({ payment_collection }) => {\n console.log(payment_collection)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/orders": {
|
"GET /store/orders": {
|
||||||
"js-sdk": "sdk.store.order.list()\n.then(({ orders, count, offset, limit }) => {\n console.log(orders)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to list their orders\nsdk.store.order.list()\n.then(({ orders, count, offset, limit }) => {\n console.log(orders)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/orders/{id}": {
|
"GET /store/orders/{id}": {
|
||||||
"js-sdk": "sdk.store.order.retrieve(\"order_123\")\n.then(({ order }) => {\n console.log(order)\n})"
|
"js-sdk": "sdk.store.order.retrieve(\"order_123\")\n.then(({ order }) => {\n console.log(order)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/orders/{id}/transfer/request": {
|
"POST /store/orders/{id}/transfer/request": {
|
||||||
"js-sdk": "sdk.store.order.requestTransfer(\n \"order_123\",\n {\n description: \"I want to transfer this order to my friend.\"\n },\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to request the order transfer\nsdk.store.order.requestTransfer(\n \"order_123\",\n {\n description: \"I want to transfer this order to my friend.\"\n },\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/orders/{id}/transfer/cancel": {
|
"POST /store/orders/{id}/transfer/cancel": {
|
||||||
"js-sdk": "sdk.store.order.cancelTransfer(\n \"order_123\",\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to cancel the order transfer\nsdk.store.order.cancelTransfer(\n \"order_123\",\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/orders/{id}/transfer/accept": {
|
"POST /store/orders/{id}/transfer/accept": {
|
||||||
"js-sdk": "sdk.store.order.acceptTransfer(\n \"order_123\",\n {\n token: \"transfer_token\"\n },\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
"js-sdk": "sdk.store.order.acceptTransfer(\n \"order_123\",\n {\n token: \"transfer_token\"\n },\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ order }) => {\n console.log(order)\n})"
|
||||||
@@ -1044,24 +1044,24 @@
|
|||||||
"js-sdk": "const token = await sdk.auth.register(\"customer\", \"emailpass\", {\n \"email\": \"customer@gmail.com\",\n \"password\": \"supersecret\"\n})\n\nsdk.store.customer.create(\n {\n \"email\": \"customer@gmail.com\"\n },\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "const token = await sdk.auth.register(\"customer\", \"emailpass\", {\n \"email\": \"customer@gmail.com\",\n \"password\": \"supersecret\"\n})\n\nsdk.store.customer.create(\n {\n \"email\": \"customer@gmail.com\"\n },\n {},\n {\n Authorization: `Bearer ${token}`\n }\n)\n.then(({ customer }) => {\n console.log(customer)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/customers/me": {
|
"POST /store/customers/me": {
|
||||||
"js-sdk": "sdk.store.customer.update({\n first_name: \"John\"\n})\n.then(({ customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to update their details\nsdk.store.customer.update({\n first_name: \"John\"\n})\n.then(({ customer }) => {\n console.log(customer)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/customers/me": {
|
"GET /store/customers/me": {
|
||||||
"js-sdk": "sdk.store.customer.retrieve()\n.then(({ customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to retrieve their details\nsdk.store.customer.retrieve()\n.then(({ customer }) => {\n console.log(customer)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/customers/me/addresses": {
|
"POST /store/customers/me/addresses": {
|
||||||
"js-sdk": "sdk.store.customer.createAddress({\n country_code: \"us\"\n})\n.then(({ customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to create an address\nsdk.store.customer.createAddress({\n country_code: \"us\"\n})\n.then(({ customer }) => {\n console.log(customer)\n})"
|
||||||
},
|
},
|
||||||
"POST /store/customers/me/addresses/{addressid}": {
|
"POST /store/customers/me/addresses/{addressid}": {
|
||||||
"js-sdk": "sdk.store.customer.updateAddress(\n \"caddr_123\",\n {\n country_code: \"us\"\n }\n)\n.then(({ customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to update their address\nsdk.store.customer.updateAddress(\n \"caddr_123\",\n {\n country_code: \"us\"\n }\n)\n.then(({ customer }) => {\n console.log(customer)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/customers/me/addresses": {
|
"GET /store/customers/me/addresses": {
|
||||||
"js-sdk": "sdk.store.customer.listAddress()\n.then(({ addresses, count, offset, limit }) => {\n console.log(addresses)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to list their addresses\nsdk.store.customer.listAddress()\n.then(({ addresses, count, offset, limit }) => {\n console.log(addresses)\n})"
|
||||||
},
|
},
|
||||||
"GET /store/customers/me/addresses/{addressid}": {
|
"GET /store/customers/me/addresses/{addressid}": {
|
||||||
"js-sdk": "sdk.store.customer.retrieveAddress(\n \"caddr_123\"\n)\n.then(({ address }) => {\n console.log(address)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to retrieve their address\nsdk.store.customer.retrieveAddress(\n \"caddr_123\"\n)\n.then(({ address }) => {\n console.log(address)\n})"
|
||||||
},
|
},
|
||||||
"DELETE /store/customers/me/addresses/{addressid}": {
|
"DELETE /store/customers/me/addresses/{addressid}": {
|
||||||
"js-sdk": "sdk.store.customer.deleteAddress(\"caddr_123\")\n.then(({ deleted, parent: customer }) => {\n console.log(customer)\n})"
|
"js-sdk": "// TODO must be authenticated as the customer to delete their address\nsdk.store.customer.deleteAddress(\"caddr_123\")\n.then(({ deleted, parent: customer }) => {\n console.log(customer)\n})"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,6 +129,10 @@ class OasKindGenerator extends FunctionKindGenerator {
|
|||||||
startsWith: "store/store-credit-accounts",
|
startsWith: "store/store-credit-accounts",
|
||||||
requiresAuthentication: true,
|
requiresAuthentication: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
exact: "store/carts/[id]/customer",
|
||||||
|
requiresAuthentication: true,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
readonly RESPONSE_TYPE_NAMES = ["MedusaResponse"]
|
readonly RESPONSE_TYPE_NAMES = ["MedusaResponse"]
|
||||||
readonly FIELD_QUERY_PARAMS = ["fields", "expand"]
|
readonly FIELD_QUERY_PARAMS = ["fields", "expand"]
|
||||||
|
|||||||
Reference in New Issue
Block a user