docs: replace ModuleRegistrationName with Modules (#9142)

This commit is contained in:
Shahed Nasser
2024-09-16 15:30:03 +03:00
committed by GitHub
parent 8829f89402
commit 8584031041
55 changed files with 389 additions and 391 deletions
@@ -11,7 +11,7 @@ The Payment Module is the `@medusajs/payment` NPM package that provides payment-
## How to Use Payment Module's Service
You can use the Payment Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.PAYMENT` imported from `@medusajs/utils`.
You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.PAYMENT` imported from `@medusajs/utils`.
For example:
@@ -21,14 +21,14 @@ For example:
```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
import { Modules } from "@medusajs/utils"
export async function GET(
req: MedusaRequest,
res: MedusaResponse
): Promise<void> {
const paymentModuleService: IPaymentModuleService = req.scope.resolve(
ModuleRegistrationName.PAYMENT
Modules.PAYMENT
)
res.json({
@@ -43,11 +43,11 @@ export async function GET(
```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa"
import { IPaymentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
import { Modules } from "@medusajs/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) {
const paymentModuleService: IPaymentModuleService = container.resolve(
ModuleRegistrationName.PAYMENT
Modules.PAYMENT
)
const payment_collections =
@@ -61,11 +61,11 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
```ts title="src/workflows/hello-world/step1.ts"
import { createStep } from "@medusajs/workflows-sdk"
import { IPaymentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
import { Modules } from "@medusajs/utils"
const step1 = createStep("step-1", async (_, { container }) => {
const paymentModuleService: IPaymentModuleService = container.resolve(
ModuleRegistrationName.PAYMENT
Modules.PAYMENT
)
const payment_collections =