docs: migrate guides to TSDoc references (#6100)
This commit is contained in:
+29
-21
@@ -137,7 +137,7 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
### Parameters
|
||||
|
||||
<ParameterTypes parameters={[{"name":"container","type":"[MedusaContainer](../../medusa/types/medusa.MedusaContainer-2.mdx)","description":"An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"`Record<string, unknown>`","description":"If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} />
|
||||
<ParameterTypes parameters={[{"name":"container","type":"[MedusaContainer](../../medusa/types/medusa.MedusaContainer.mdx)","description":"An instance of `MedusaContainer` that allows you to access other resources, such as services, in your Medusa backend through [dependency injection](https://docs.medusajs.com/development/fundamentals/dependency-injection)","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"`Record<string, unknown>`","description":"If this fulfillment provider is created in a plugin, the plugin's options are passed in this parameter.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} />
|
||||
|
||||
___
|
||||
|
||||
@@ -212,8 +212,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<[PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| object>","optional":false,"defaultValue":"","description":"The authorization details or an error object.","expandable":false,"children":[{"name":"PaymentProcessorError \\| object","type":"[PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| `object`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### cancelPayment
|
||||
|
||||
This method is used to cancel an order’s payment. This method is typically triggered by one of the following situations:
|
||||
@@ -260,8 +258,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"Either an error object or a value that's stored in the `data` field of the Payment.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### capturePayment
|
||||
|
||||
This method is used to capture the payment amount of an order. This is typically triggered manually by the store operator from the admin.
|
||||
@@ -306,8 +302,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"Either an error object or a value that's stored in the `data` field of the Payment.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### deletePayment
|
||||
|
||||
This method is used to perform any actions necessary before a Payment Session is deleted. The Payment Session is deleted in one of the following cases:
|
||||
@@ -349,8 +343,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"Either an error object or an empty object.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### getPaymentStatus
|
||||
|
||||
This method is used to get the status of a Payment or a Payment Session. Its main usage is within the place order and create swap flows.
|
||||
@@ -387,8 +379,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<[PaymentSessionStatus](../../entities/enums/entities.PaymentSessionStatus.mdx)>","optional":false,"defaultValue":"","description":"The status of the Payment or Payment Session.","expandable":false,"children":[{"name":"PaymentSessionStatus","type":"`object`","description":"The status of a payment session.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### initiatePayment
|
||||
|
||||
This method is called either if a region has only one payment provider enabled or when [a Payment Session is selected](https://docs.medusajs.com/api/store#carts\_postcartscartpaymentsession),
|
||||
@@ -433,8 +423,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<[PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/payment.PaymentProcessorSessionResponse.mdx)>","optional":false,"defaultValue":"","description":"Either the payment's data or an error object.","expandable":false,"children":[{"name":"PaymentProcessorError \\| PaymentProcessorSessionResponse","type":"[PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/payment.PaymentProcessorSessionResponse.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### refundPayment
|
||||
|
||||
This method is used to refund an order’s payment. This is typically triggered manually by the store operator from the admin. The refund amount might be the total order amount or part of it.
|
||||
@@ -480,8 +468,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"Either an error object or a value that's stored in the `data` field of the Payment.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### retrievePayment
|
||||
|
||||
This method is used to provide a uniform way of retrieving the payment information from the third-party provider.
|
||||
@@ -518,8 +504,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"The payment's data, typically retrieved from a third-party provider.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### updatePayment
|
||||
|
||||
This method is used to update the payment session when the payment amount changes. It's called whenever the cart or any of its related data is updated.
|
||||
@@ -567,8 +551,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<void \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/payment.PaymentProcessorSessionResponse.mdx)>","optional":false,"defaultValue":"","description":"Either the payment's data or an error object.","expandable":false,"children":[{"name":"void \\| PaymentProcessorError \\| PaymentProcessorSessionResponse","type":"`void` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx) \\| [PaymentProcessorSessionResponse](../interfaces/payment.PaymentProcessorSessionResponse.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### updatePaymentData
|
||||
|
||||
This method is used to update the `data` field of a payment session. It's called when a request is sent to the
|
||||
@@ -622,8 +604,6 @@ class MyPaymentService extends AbstractPaymentProcessor {
|
||||
|
||||
<ParameterTypes parameters={[{"name":"Promise","type":"Promise<Record<string, unknown> \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)>","optional":false,"defaultValue":"","description":"the data to store in the `data` field of the payment session.\nYou can keep the data as-is, or make changes to it by communicating with the third-party provider.","expandable":false,"children":[{"name":"Record<string, unknown> \\| PaymentProcessorError","type":"`Record<string, unknown>` \\| [PaymentProcessorError](../interfaces/payment.PaymentProcessorError.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} />
|
||||
|
||||
___
|
||||
|
||||
### isPaymentProcessor
|
||||
|
||||
#### Parameters
|
||||
@@ -633,3 +613,31 @@ ___
|
||||
#### Returns
|
||||
|
||||
<ParameterTypes parameters={[{"name":"boolean","type":"`boolean`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} />
|
||||
|
||||
---
|
||||
|
||||
## Test Implementation
|
||||
|
||||
:::note
|
||||
|
||||
If you created your payment processor in a plugin, refer to [this guide on how to test plugins](https://docs.medusajs.com/development/plugins/create#test-your-plugin).
|
||||
|
||||
:::
|
||||
|
||||
After finishing your payment processor implementation:
|
||||
|
||||
1\. Run the `build` command in the root of your Medusa backend:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run build
|
||||
```
|
||||
|
||||
2\. Start the backend with the `develop` command:
|
||||
|
||||
```bash
|
||||
npx medusa develop
|
||||
```
|
||||
|
||||
3\. Enable your payment processor in one or more regions. You can do that either using the [Admin APIs](https://docs.medusajs.com/api/admin#regions_postregionsregionpaymentproviders) or the [Medusa Admin](https://docs.medusajs.com/user-guide/regions/providers#manage-payment-providers).
|
||||
|
||||
4\. There are different ways to test out your payment processor, such as authorizing payment on order completion or capturing payment of an order. You test payment in a checkout flow either using the [Next.js starter](https://docs.medusajs.com/starters/nextjs-medusa-starter) or [using Medusa's APIs and clients](https://docs.medusajs.com/modules/carts-and-checkout/storefront/implement-checkout-flow).
|
||||
|
||||
Reference in New Issue
Block a user