docs: general fixes and additions (#10876)
This commit is contained in:
1 parent
9427f1e4af
commit
a0e944a7a8
12 files changed
+235
-74
No files matched your search
+21
-2
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Cache Modules`,
|
||||
@@ -18,7 +18,26 @@ By default, Medusa uses the In-Memory Cache Module. This module uses a plain Jav
|
||||
|
||||
This is useful for development. However, for production, it's highly recommended to use other Cache Modules, such as the Redis Cache Module.
|
||||
|
||||
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
||||
<CardList
|
||||
items={[
|
||||
{
|
||||
title: "In-Memory",
|
||||
href: "/architectural-modules/cache/in-memory",
|
||||
badge: {
|
||||
variant: "neutral",
|
||||
children: "For Development"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Redis",
|
||||
href: "/architectural-modules/cache/redis",
|
||||
badge: {
|
||||
variant: "green",
|
||||
children: "For Production"
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Event Modules`,
|
||||
@@ -18,7 +18,26 @@ By default, Medusa uses the Local Event Module. This module uses Node’s EventE
|
||||
|
||||
This is useful for development. However, for production, it’s highly recommended to use other Event Modules, Redis Event Module.
|
||||
|
||||
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
||||
<CardList
|
||||
items={[
|
||||
{
|
||||
title: "Local",
|
||||
href: "/architectural-modules/event/local",
|
||||
badge: {
|
||||
variant: "neutral",
|
||||
children: "For Development"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Redis",
|
||||
href: "/architectural-modules/event/redis",
|
||||
badge: {
|
||||
variant: "green",
|
||||
children: "For Production"
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `File Module Providers`,
|
||||
@@ -14,7 +14,26 @@ By default, Medusa uses the Local File Module. This module uploads files to the
|
||||
|
||||
This is useful for development. However, for production, it’s highly recommended to use other File Modules, such as the S3 Module.
|
||||
|
||||
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
||||
<CardList
|
||||
items={[
|
||||
{
|
||||
title: "Local",
|
||||
href: "/architectural-modules/file/local",
|
||||
badge: {
|
||||
variant: "neutral",
|
||||
children: "For Development"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "AWS S3 (and Compatible APIs)",
|
||||
href: "/architectural-modules/file/s3",
|
||||
badge: {
|
||||
variant: "green",
|
||||
children: "For Production"
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Notification Module Providers`,
|
||||
@@ -18,7 +18,26 @@ By default, Medusa uses the Local Notification Module which only simulates sendi
|
||||
|
||||
Medusa provides other Notification Modules that actually send notifications, such as the SendGrid Notification Module Provider.
|
||||
|
||||
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
||||
<CardList
|
||||
items={[
|
||||
{
|
||||
title: "Local",
|
||||
href: "/architectural-modules/notification/local",
|
||||
badge: {
|
||||
variant: "neutral",
|
||||
children: "For Development"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "SendGrid",
|
||||
href: "/architectural-modules/notification/sendgrid",
|
||||
badge: {
|
||||
variant: "green",
|
||||
children: "For Production"
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs, CardList } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Architectural Modules`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
import { CardList } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Workflow Engine Modules`,
|
||||
@@ -10,4 +10,23 @@ Workflow engine modules handle tracking and recording the transactions and statu
|
||||
|
||||
Medusa uses the In-Memory Workflow Engine Module by default. For production purposes, it's recommended to use the Redis Engine Module instead.
|
||||
|
||||
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
||||
<CardList
|
||||
items={[
|
||||
{
|
||||
title: "In-Memory",
|
||||
href: "/architectural-modules/workflow-engine/in-memory",
|
||||
badge: {
|
||||
variant: "neutral",
|
||||
children: "For Development"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Redis",
|
||||
href: "/architectural-modules/workflow-engine/redis",
|
||||
badge: {
|
||||
variant: "green",
|
||||
children: "For Production"
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
@@ -10,6 +10,12 @@ This document explains how the Inventory Module is used within the Medusa applic
|
||||
|
||||
When a product variant is created and its `manage_inventory` property's value is `true`, the Medusa application creates an inventory item associated with that product variant.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
This flow is implemented within the [createProductVariantsWorkflow](/references/medusa-workflows/createProductVariantsWorkflow)
|
||||
|
||||
</Note>
|
||||
|
||||

|
||||
|
||||
---
|
||||
@@ -18,6 +24,12 @@ When a product variant is created and its `manage_inventory` property's value is
|
||||
|
||||
When a product variant with `manage_inventory` set to `true` is added to cart, the Medusa application checks whether there's sufficient stocked quantity. If not, an error is thrown and the product variant won't be added to the cart.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
This flow is implemented within the [addToCartWorkflow](/references/medusa-workflows/addToCartWorkflow)
|
||||
|
||||
</Note>
|
||||
|
||||

|
||||
|
||||
---
|
||||
@@ -26,6 +38,12 @@ When a product variant with `manage_inventory` set to `true` is added to cart, t
|
||||
|
||||
When an order is placed, the Medusa application creates a reservation item for each product variant with `manage_inventory` set to `true`.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
This flow is implemented within the [completeCartWorkflow](/references/medusa-workflows/completeCartWorkflow)
|
||||
|
||||
</Note>
|
||||
|
||||

|
||||
|
||||
---
|
||||
@@ -38,6 +56,12 @@ When an item in an order is fulfilled and the associated variant has its `manage
|
||||
- Resets the `reserved_quantity` to `0`.
|
||||
- Deletes the associated reservation item.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
This flow is implemented within the [createOrderFulfillmentWorkflow](/references/medusa-workflows/createOrderFulfillmentWorkflow)
|
||||
|
||||
</Note>
|
||||
|
||||

|
||||
|
||||
---
|
||||
@@ -46,6 +70,12 @@ When an item in an order is fulfilled and the associated variant has its `manage
|
||||
|
||||
When an item in an order is returned and the associated variant has its `manage_inventory` property set to `true`, the Medusa application increments the `stocked_quantity` of the inventory item's level with the returned quantity.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
This flow is implemented within the [confirmReturnReceiveWorkflow](/references/medusa-workflows/confirmReturnReceiveWorkflow)
|
||||
|
||||
</Note>
|
||||
|
||||

|
||||
|
||||
### Dismissed Returned Items
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import { CodeTabs, CodeTab } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Accept Payment Flow`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you’ll learn how to implement an accept-payment flow using the Payment Module's main service.
|
||||
In this document, you’ll learn how to implement an accept-payment flow using workflows or the Payment Module's main service.
|
||||
|
||||
<Note>
|
||||
|
||||
It's highly recommended to use Medusa's workflows to implement this flow. Use the Payment Module's main service for more complex cases.
|
||||
|
||||
</Note>
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
@@ -24,6 +32,25 @@ A payment collection holds all details related to a resource’s payment operati
|
||||
|
||||
For example:
|
||||
|
||||
<CodeTabs group="workflow-service">
|
||||
<CodeTab label="Using Workflow" value="workflow">
|
||||
|
||||
```ts
|
||||
import { createPaymentCollectionForCartWorkflow } from "@medusajs/medusa/core-flows";
|
||||
|
||||
// ...
|
||||
|
||||
await createPaymentCollectionForCartWorkflow(req.scope)
|
||||
.run({
|
||||
input: {
|
||||
cart_id: "cart_123"
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
<CodeTab label="Using Service" value="service">
|
||||
|
||||
```ts
|
||||
const paymentCollection =
|
||||
await paymentModuleService.createPaymentCollections({
|
||||
@@ -33,42 +60,8 @@ const paymentCollection =
|
||||
})
|
||||
```
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
Learn more about the `createPaymentCollections` method in [this reference](/references/payment/createPaymentCollections).
|
||||
|
||||
</Note>
|
||||
|
||||
Then, create a link between the payment collection and the resource it's storing payment details for, such as a cart in the Cart Module:
|
||||
|
||||
```ts
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
Modules,
|
||||
} from "@medusajs/framework/utils"
|
||||
|
||||
// ...
|
||||
|
||||
// resolve Link
|
||||
const link = container.resolve(
|
||||
ContainerRegistrationKeys.LINK
|
||||
)
|
||||
|
||||
link.create({
|
||||
[Modules.CART]: {
|
||||
cart_id: "cart_123",
|
||||
},
|
||||
[Modules.PAYMENT]: {
|
||||
payment_collection_id: paymentCollection.id,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
Learn more about Link in [this documentation](!docs!/learn/fundamentals/module-links/link).
|
||||
|
||||
</Note>
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
---
|
||||
|
||||
@@ -80,6 +73,26 @@ So, after creating the payment collection, create at least one payment session f
|
||||
|
||||
For example:
|
||||
|
||||
<CodeTabs group="workflow-service">
|
||||
<CodeTab label="Using Workflow" value="workflow">
|
||||
|
||||
```ts
|
||||
import { createPaymentSessionsWorkflow } from "@medusajs/medusa/core-flows";
|
||||
|
||||
// ...
|
||||
|
||||
const { result: paymentSesion } = await createPaymentSessionsWorkflow(req.scope)
|
||||
.run({
|
||||
input: {
|
||||
payment_collection_id: "paycol_123",
|
||||
provider_id: "stripe",
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
<CodeTab label="Using Service" value="service">
|
||||
|
||||
```ts
|
||||
const paymentSession =
|
||||
await paymentModuleService.createPaymentSession(
|
||||
@@ -96,11 +109,8 @@ const paymentSession =
|
||||
)
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about the `createPaymentSession` method in [this reference](/references/payment/createPaymentSession).
|
||||
|
||||
</Note>
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
---
|
||||
|
||||
@@ -110,24 +120,43 @@ Once the customer chooses a payment session, start the authorization process. Th
|
||||
|
||||
For example:
|
||||
|
||||
<CodeTabs group="workflow-service">
|
||||
<CodeTab label="Using Step" value="workflow">
|
||||
|
||||
```ts
|
||||
const payment =
|
||||
await paymentModuleService.authorizePaymentSession(
|
||||
paymentSession.id,
|
||||
{}
|
||||
)
|
||||
import { authorizePaymentSessionStep } from "@medusajs/medusa/core-flows";
|
||||
|
||||
// ...
|
||||
|
||||
authorizePaymentSessionStep({
|
||||
id: "payses_123",
|
||||
context: {}
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
<CodeTab label="Using Service" value="service">
|
||||
|
||||
```ts
|
||||
const payment = authorizePaymentSessionStep({
|
||||
id: "payses_123",
|
||||
context: {}
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
</CodeTabs>
|
||||
|
||||
When the payment authorization is successful, a payment is created and returned.
|
||||
|
||||
### Handling Additional Action
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about the `authorizePaymentSession` method in [this reference](/references/payment/authorizePaymentSession).
|
||||
If you used the `authorizePaymentSessionStep`, you don't need to implement this logic as it's implemented in the step.
|
||||
|
||||
</Note>
|
||||
|
||||
### Handling Additional Action
|
||||
|
||||
If the payment authorization isn’t successful, whether because it requires additional action or for another reason, the method updates the payment session with the new status and throws an error.
|
||||
|
||||
In that case, you can catch that error and, if the session's `status` property is `requires_more`, handle the additional action, then retry the authorization.
|
||||
@@ -162,7 +191,10 @@ try {
|
||||
|
||||
The payment flow is complete once the payment session is authorized and the payment is created.
|
||||
|
||||
You can then use the payment to capture the amount using the [capturePayment method](/references/payment/capturePayment). You can also refund captured amounts using the [refundPayment method](/references/payment/refundPayment).
|
||||
You can then:
|
||||
|
||||
- Capture the payment either using the [capturePaymentWorkflow](/references/medusa-workflows/capturePaymentWorkflow) or [capturePayment method](/references/payment/capturePayment).
|
||||
- Refund captured amounts using the [refundPaymentWorkflow](/references/medusa-workflows/refundPaymentWorkflow) or [refundPayment method](/references/payment/refundPayment).
|
||||
|
||||
<Note>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/inventory/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/inventory/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/inventory/concepts/page.mdx": "2024-10-08T15:11:27.634Z",
|
||||
"app/commerce-modules/inventory/inventory-in-flows/page.mdx": "2024-10-08T15:14:07.327Z",
|
||||
"app/commerce-modules/inventory/inventory-in-flows/page.mdx": "2025-01-08T12:21:12.157Z",
|
||||
"app/commerce-modules/inventory/page.mdx": "2024-12-25T15:55:02.850Z",
|
||||
"app/commerce-modules/order/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/order/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
@@ -47,7 +47,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/payment/module-options/page.mdx": "2024-10-15T12:51:40.574Z",
|
||||
"app/commerce-modules/payment/payment/page.mdx": "2024-10-09T10:59:08.463Z",
|
||||
"app/commerce-modules/payment/payment-collection/page.mdx": "2024-10-09T10:56:49.510Z",
|
||||
"app/commerce-modules/payment/payment-flow/page.mdx": "2025-01-06T11:19:35.592Z",
|
||||
"app/commerce-modules/payment/payment-flow/page.mdx": "2025-01-08T12:51:39.100Z",
|
||||
"app/commerce-modules/payment/payment-provider/stripe/page.mdx": "2024-12-16T13:21:03.554Z",
|
||||
"app/commerce-modules/payment/payment-provider/page.mdx": "2024-10-09T11:07:27.269Z",
|
||||
"app/commerce-modules/payment/payment-session/page.mdx": "2024-10-09T10:58:00.960Z",
|
||||
@@ -197,13 +197,13 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/auth/auth-identity-and-actor-types/page.mdx": "2025-01-07T09:02:27.235Z",
|
||||
"app/commerce-modules/api-key/page.mdx": "2024-12-25T15:55:02.846Z",
|
||||
"app/commerce-modules/auth/create-actor-type/page.mdx": "2024-12-25T13:26:27.176Z",
|
||||
"app/architectural-modules/page.mdx": "2024-12-11T10:33:53.064Z",
|
||||
"app/architectural-modules/page.mdx": "2025-01-08T12:13:50.333Z",
|
||||
"app/architectural-modules/workflow-engine/redis/page.mdx": "2024-10-15T12:50:59.507Z",
|
||||
"app/architectural-modules/notification/sendgrid/page.mdx": "2024-10-15T12:51:25.569Z",
|
||||
"app/commerce-modules/api-key/concepts/page.mdx": "2024-10-07T13:59:37.529Z",
|
||||
"app/architectural-modules/workflow-engine/page.mdx": "2024-05-28T13:25:03+03:00",
|
||||
"app/architectural-modules/workflow-engine/page.mdx": "2025-01-08T12:16:04.157Z",
|
||||
"app/_events-reference/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/architectural-modules/cache/page.mdx": "2024-05-28T13:25:03+03:00",
|
||||
"app/architectural-modules/cache/page.mdx": "2025-01-08T12:14:37.925Z",
|
||||
"app/architectural-modules/file/s3/page.mdx": "2024-10-15T12:51:14.315Z",
|
||||
"app/commerce-modules/api-key/_events/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
"app/commerce-modules/api-key/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00",
|
||||
@@ -215,11 +215,11 @@ export const generatedEditDates = {
|
||||
"app/architectural-modules/notification/local/page.mdx": "2024-10-15T12:51:21.284Z",
|
||||
"app/architectural-modules/file/local/page.mdx": "2024-10-16T15:48:42.839Z",
|
||||
"app/architectural-modules/notification/send-notification/page.mdx": "2024-09-30T08:43:53.151Z",
|
||||
"app/architectural-modules/file/page.mdx": "2024-12-11T10:27:50.510Z",
|
||||
"app/architectural-modules/event/page.mdx": "2024-05-28T13:25:03+03:00",
|
||||
"app/architectural-modules/file/page.mdx": "2025-01-08T12:15:19.981Z",
|
||||
"app/architectural-modules/event/page.mdx": "2025-01-08T12:15:08.454Z",
|
||||
"app/architectural-modules/cache/create/page.mdx": "2024-10-16T08:51:35.074Z",
|
||||
"app/admin-widget-injection-zones/page.mdx": "2024-12-24T08:48:36.154Z",
|
||||
"app/architectural-modules/notification/page.mdx": "2024-12-11T10:29:47.317Z",
|
||||
"app/architectural-modules/notification/page.mdx": "2025-01-08T12:15:40.159Z",
|
||||
"app/architectural-modules/event/create/page.mdx": "2024-12-09T14:46:40.248Z",
|
||||
"references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityValidationStep/page.mdx": "2024-08-20T00:10:58.913Z",
|
||||
"references/core_flows/Order/functions/core_flows.Order.orderEditUpdateItemQuantityWorkflow/page.mdx": "2024-08-20T00:10:58.949Z",
|
||||
|
||||
Reference in new issue
Block a user