chore(docs): Generated API reference (#2788)

This commit is contained in:
Shahed Nasser
2022-12-13 12:52:58 +02:00
committed by GitHub
parent a77b4a1b7e
commit 52a8e90aac
413 changed files with 11540 additions and 4501 deletions

View File

@@ -0,0 +1,12 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.orders.claimOrders({
display_ids,
})
.then(() => {
// successful
})
.catch(() => {
// an error occurred
});

View File

@@ -0,0 +1,12 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.orders.confirmRequest(
token,
)
.then(() => {
// successful
})
.catch(() => {
// an error occurred
});

View File

@@ -0,0 +1,7 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.paymentCollections.retrieve(paymentCollectionId)
.then(({ payment_collection }) => {
console.log(payment_collection.id)
})

View File

@@ -0,0 +1,9 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
// Total amount = 10000
// Adding a payment session
medusa.paymentCollections.managePaymentSession(payment_id, { provider_id: "stripe" })
.then(({ payment_collection }) => {
console.log(payment_collection.id);
});

View File

@@ -0,0 +1,29 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
// Total amount = 10000
// Adding two new sessions
medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [
{
provider_id: "stripe",
amount: 5000,
},
{
provider_id: "manual",
amount: 5000,
},
])
.then(({ payment_collection }) => {
console.log(payment_collection.id);
});
// Updating one session and removing the other
medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [
{
provider_id: "stripe",
amount: 10000,
session_id: "ps_123456"
},
])
.then(({ payment_collection }) => {
console.log(payment_collection.id);
});

View File

@@ -0,0 +1,7 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.paymentCollections.authorize(payment_id)
.then(({ payment_collection }) => {
console.log(payment_collection.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.paymentCollections.refreshPaymentSession(payment_collection_id, session_id, payload)
.then(({ payment_session }) => {
console.log(payment_session.id);
});

View File

@@ -0,0 +1,7 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.paymentCollections.authorize(payment_id, session_id)
.then(({ payment_collection }) => {
console.log(payment_collection.id);
});

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/batch/customer/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"display_ids": ["id"],
}'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/orders/customer/confirm' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "{token}",
}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/payment-collections/{id}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/payment-collections/{id}/sessions'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch/authorize'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}/authorize'