From 13f12e1953fa0d23e2544a2f6d2dc602f254451f Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 9 Jan 2024 20:07:24 +0200 Subject: [PATCH] docs: documentation updates for v1.20 (#6031) * docs: documentation updates for v1.20 * fix stripe upgrade guide * fixed vale error * fix eslint errors * change stripe environment variables to options --- packages/types/src/pricing/service.ts | 7 ++- .../docs/content/plugins/payment/stripe.mdx | 2 + .../upgrade-guides/medusa-core/1-20.mdx | 63 +++++++++++++++++++ .../upgrade-guides/plugins/stripe/6-0-7.md | 58 +++++++++++++++++ .../plugins/stripe/_category.json | 6 ++ .../docs/content/user-guide/tips/languages.md | 5 ++ 6 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 www/apps/docs/content/upgrade-guides/medusa-core/1-20.mdx create mode 100644 www/apps/docs/content/upgrade-guides/plugins/stripe/6-0-7.md create mode 100644 www/apps/docs/content/upgrade-guides/plugins/stripe/_category.json diff --git a/packages/types/src/pricing/service.ts b/packages/types/src/pricing/service.ts index 9c9a7a10e3..bf433aaa89 100644 --- a/packages/types/src/pricing/service.ts +++ b/packages/types/src/pricing/service.ts @@ -1303,10 +1303,13 @@ export interface IPricingModuleService { * @param {string[]} ids - The IDs of the money amounts to delete. * @param {RestoreReturn} config - * Configurations determining which relations to restore along with each of the money amounts. You can pass to its `returnLinkableKeys` - * property any of the money_amount's relation attribute names, such as `price_set_money_amount_id`. + * property any of the money amount's relation attribute names, such as `price_set_money_amount`. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise | void>} - * An object that includes the IDs of related records that were restored, such as the ID of associated product variants. The object's keys are the ID attribute names of the product entity's relations, such as `variant_id`, and its value is an array of strings, each being the ID of the record associated with the product through this relation, such as the IDs of associated product variants. + * An object that includes the IDs of related records that were restored, such as the ID of associated price set money amounts. + * The object's keys are the ID attribute names of the money amount entity's relations, such as `price_set_money_amount_id`, + * and its value is an array of strings, each being the ID of the record associated with the money amount through this relation, + * such as the IDs of associated price set money amounts. * * @example * import { diff --git a/www/apps/docs/content/plugins/payment/stripe.mdx b/www/apps/docs/content/plugins/payment/stripe.mdx index e2b5c3f406..cf56140ba8 100644 --- a/www/apps/docs/content/plugins/payment/stripe.mdx +++ b/www/apps/docs/content/plugins/payment/stripe.mdx @@ -80,6 +80,8 @@ Other optional options include: - `payment_description`: a string that is used as the default description of a payment if none is provided. - `capture`: a boolean value that indicates whether payment should be captured manually or automatically. By default, it will be `false`, leading admins to capture the payment manually. - `automatic_payment_methods`: a boolean value that enables Stripe's automatic payment methods. This is useful if you're integrating services like Apple pay or Google pay. +- `webhook_delay`: a number indicating the delay in milliseconds before processing the webhook event. By default, it's `5000` (five seconds). +- `webhook_retries`: The number of times to retry the webhook event processing in case of an error. By default, it's `3`. ### Retrieve Stripe's Keys diff --git a/www/apps/docs/content/upgrade-guides/medusa-core/1-20.mdx b/www/apps/docs/content/upgrade-guides/medusa-core/1-20.mdx new file mode 100644 index 0000000000..d12416a358 --- /dev/null +++ b/www/apps/docs/content/upgrade-guides/medusa-core/1-20.mdx @@ -0,0 +1,63 @@ +--- +description: "Actions Required for v.1.20" +sidebar_custom_props: + iconName: "server-stack-solid" +--- + +# v1.20 + +Version 1.20 of Medusa ships performance improvements, bug fixes, and some breaking changes. + + + +## Breaking Changes + +### Stripe Plugin Changes + +v6.0.7 of the Stripe plugin introduces improvements and breaking changes. Refer to [its upgrade guide](../plugins/stripe/6-0-7.md) for more details on the breaking changes, required actions, and how to update it. + +### Service Registration Improvement + +Previously, when you create services such as a Payment Processor or Fulfillment Provider, the Medusa backend relied on the use of the `instanceof` operator to check and register a service: + +```ts +// previously +export function isPaymentProcessor(obj: unknown): boolean { + return obj instanceof AbstractPaymentProcessor +} +``` + +However, if you have a version mismatch in your packages, the `instanceof` check will fail even though the services are seemingly the expected type. + +In this release, the service class type checks are now performed with static properties to eliminate this issue: + + + +```ts +// now +static isPaymentProcessor(object): boolean { + return object?.constructor?._isPaymentProcessor +} +``` + +This change doesn't require any action from your side. + +--- + +## How to Update + +Run the following command in your Medusa backend: + +```bash npm2yarn +npm install @medusajs/medusa@1.20 +``` + +To avoid unexpected issues with dependencies, it's also recommended to update all other Medusa plugins or packages you have installed. diff --git a/www/apps/docs/content/upgrade-guides/plugins/stripe/6-0-7.md b/www/apps/docs/content/upgrade-guides/plugins/stripe/6-0-7.md new file mode 100644 index 0000000000..e294507586 --- /dev/null +++ b/www/apps/docs/content/upgrade-guides/plugins/stripe/6-0-7.md @@ -0,0 +1,58 @@ +--- +description: 'Actions Required for v.6.0.7' +sidebar_label: 'v6.0.7' +--- + +# Stripe Plugin: v6.0.7 + +v6.0.7 of Stripe introduces an improvement in Stripe's plugin's architecture and webhooks. + +:::note + +This version of Stripe requires at least v1.20 of `@medusajs/medusa`. Refer to its update guide [here](../../medusa-core/1-20.mdx). + +::: + +## Overview + +There are two important changes that have been introduced to the Stripe plugin, one of which is breaking. + +### Architectural Improvement + +The endpoints and subscribers in the plugin have been migrated to use our new API Routes and Subscribers. This significantly lowers the code footprint of the package and makes it easier to maintain. + +### Breaking Change: Webhooks and the Event Bus + +The webhook event management has changed significantly; previously, it used in-band processing of the webhook events. Following this update, the Event Bus Service is used to process the event in a background job instead. + +There were several motivations for this change: + +1. It's deemed best practice to respond with a 200 immediately upon receiving a webhook request. +2. It allows for the retry mechanism to kick-in in case the processing fails. +3. It provides more control of how the event is processed. + +One example of the latter: starting from this release, you can now set a delay on processing events to avoid conflicts stemming from race conditions between the webhook and client requests. By default, the delay is five seconds. + +Learn more about the new webhook options in [the stripe plugin's guide](../../../plugins/payment/stripe.mdx) + +--- + +## Required Actions + +Since webhooks now rely on the Event Bus Service, make sure to install and setup an Event Bus module on your backend, if you haven't already. For production, please use the [Redis Event Bus Module](../../../development/events/modules/redis.md). + +--- + +## How to Update + +:::warning [Important] + +Make sure you're using at least v1.20 of `@medusajs/medusa`. Refer to its update guide [here](../../medusa-core/1-20.mdx). + +::: + +Run the following command in the root directory of your Medusa backend: + +```bash npm2yarn +npm install medusa-payment-stripe@6.0.7 +``` diff --git a/www/apps/docs/content/upgrade-guides/plugins/stripe/_category.json b/www/apps/docs/content/upgrade-guides/plugins/stripe/_category.json new file mode 100644 index 0000000000..19f169cf48 --- /dev/null +++ b/www/apps/docs/content/upgrade-guides/plugins/stripe/_category.json @@ -0,0 +1,6 @@ +{ + "label": "Stripe", + "customProps": { + "reverse": true + } +} \ No newline at end of file diff --git a/www/apps/docs/content/user-guide/tips/languages.md b/www/apps/docs/content/user-guide/tips/languages.md index dc5f01a392..e66188f0ad 100644 --- a/www/apps/docs/content/user-guide/tips/languages.md +++ b/www/apps/docs/content/user-guide/tips/languages.md @@ -29,9 +29,14 @@ Languages listed in this section are contributed by the Medusa community. So, th - Hrvatski - Italiano - 한국어 +- 日本語 - Polski - Русский +- Slovenščina - Tamil - Tiếng Việt - Українська - العربية +- Čeština +- 简体中文 +- Български