docs: update imports and package names across docs (#9375)
* docs: update imports and package names across docs + reference configs * generate files * fix import * change preview to rc
This commit is contained in:
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Payment Modu
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -46,7 +46,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
@@ -77,8 +77,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -110,7 +110,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
@@ -143,8 +143,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -170,7 +170,7 @@ export async function GET(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
@@ -197,8 +197,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -225,7 +225,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
@@ -253,8 +253,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -280,7 +280,7 @@ export async function GET(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
@@ -307,8 +307,8 @@ export async function GET(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -334,7 +334,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializePaymentModule } from "@medusajs/payment"
|
||||
import { initialize as initializePaymentModule } from "@medusajs/medusa/payment"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const paymentModuleService = await initializePaymentModule()
|
||||
|
||||
@@ -102,7 +102,7 @@ When the Medusa application starts, these providers are registered and can be us
|
||||
For example:
|
||||
|
||||
```js title="medusa-config.js"
|
||||
const { Modules } = require("@medusajs/utils")
|
||||
const { Modules } = require("@medusajs/framework/utils")
|
||||
|
||||
// ...
|
||||
|
||||
@@ -110,11 +110,11 @@ module.exports = defineConfig({
|
||||
// ...
|
||||
modules: {
|
||||
[Modules.PAYMENT]: {
|
||||
resolve: "@medusajs/payment",
|
||||
resolve: "@medusajs/medusa/payment",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
resolve: "@medusajs/payment-stripe",
|
||||
resolve: "@medusajs/medusa/payment-stripe",
|
||||
id: "stripe",
|
||||
options: {
|
||||
// ...
|
||||
|
||||
@@ -7,11 +7,11 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
The Payment Module is the `@medusajs/payment` NPM package that provides payment-related features in your Medusa and Node.js applications.
|
||||
The Payment Module is the `@medusajs/medusa/payment` NPM package that provides payment-related features in your Medusa and Node.js applications.
|
||||
|
||||
## How to Use Payment Module's Service
|
||||
|
||||
You can use the Payment Module's main service by resolving from the Medusa container the resource `Modules.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/framework/utils`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -20,8 +20,8 @@ For example:
|
||||
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -42,8 +42,8 @@ export async function GET(
|
||||
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const paymentModuleService: IPaymentModuleService = container.resolve(
|
||||
@@ -59,9 +59,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
<CodeTab label="Workflow Step" value="workflow-step">
|
||||
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { IPaymentModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { createStep } from "@medusajs/framework/workflows-sdk"
|
||||
import { IPaymentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const paymentModuleService: IPaymentModuleService = container.resolve(
|
||||
|
||||
@@ -30,7 +30,7 @@ The Payment Module provides a `system` payment provider that acts as a placehold
|
||||
|
||||
## How are Payment Providers Created?
|
||||
|
||||
A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/utils`. It can then be exported as the main service of a module.
|
||||
A payment provider is a TypeScript or JavaScript class that extends the `AbstractPaymentProvider` imported from `@medusajs/framework/utils`. It can then be exported as the main service of a module.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ These features are also available in a safe test environment, allowing for a con
|
||||
|
||||
---
|
||||
|
||||
## Install the Stripe Module Provider
|
||||
## Register the Stripe Module Provider
|
||||
|
||||
<Prerequisites items={[
|
||||
{
|
||||
@@ -37,22 +37,10 @@ These features are also available in a safe test environment, allowing for a con
|
||||
}
|
||||
]} />
|
||||
|
||||
To install the Stripe Module Provider, run the following command in the directory of your Medusa application:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install @medusajs/payment-stripe@preview
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future.
|
||||
|
||||
</Note>
|
||||
|
||||
Next, add the module to the array of providers passed to the Payment Module:
|
||||
Add the module to the array of providers passed to the Payment Module:
|
||||
|
||||
```js title="medusa-config.js"
|
||||
const { Modules } = require("@medusajs/utils")
|
||||
const { Modules } = require("@medusajs/framework/utils")
|
||||
|
||||
// ...
|
||||
|
||||
@@ -60,11 +48,11 @@ module.exports = defineConfig({
|
||||
// ...
|
||||
modules: {
|
||||
[Modules.PAYMENT]: {
|
||||
resolve: "@medusajs/payment",
|
||||
resolve: "@medusajs/medusa/payment",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
resolve: "@medusajs/payment-stripe",
|
||||
resolve: "@medusajs/medusa/payment-stripe",
|
||||
id: "stripe",
|
||||
options: {
|
||||
apiKey: process.env.STRIPE_API_KEY,
|
||||
|
||||
Reference in New Issue
Block a user