docs: general fixes and enhancements (#5429)

* fix #5427

* fixes #5424

* add new s3 option

* make learning path steps clickable

* remove admin demo link

* fix documentation job conditions

* update user guide images

* update commerce modules titles to match their respective pages

* change icon of discount card

* change ref to head_ref in action condition

* remove refs prefix

* fix vale action's condition
This commit is contained in:
Shahed Nasser
2023-10-20 13:34:40 +03:00
committed by GitHub
parent 26833a48a0
commit 83f46b9b32
11 changed files with 129 additions and 64 deletions
@@ -35,11 +35,12 @@ The Payment Processor is also required to implement the following methods:
2. `retrievePayment`: Used to retrieve payment session data, which can be retrieved from a third-party provider.
3. `getPaymentStatus`: Used to get the status of a Payment or Payment Session.
4. `updatePayment`: Used to update the Payment Session whenever the cart and its related data are updated.
5. `deletePayment`: Used to perform any action necessary before a Payment Session is deleted. For example, you can cancel the payment with the third-party provider.
6. `authorizePayment`: Used to authorize the payment amount of the cart before the order or swap is created.
7. `capturePayment`: Used to capture the payment amount of an order or swap.
8. `refundPayment`: Used to refund a payment amount of an order or swap.
9. `cancelPayment`: Used to perform any necessary action with the third-party payment provider when an order or swap is canceled.
5. `updatePaymentData`: Used to update the `data` of a payment session.
6. `deletePayment`: Used to perform any action necessary before a Payment Session is deleted. For example, you can cancel the payment with the third-party provider.
7. `authorizePayment`: Used to authorize the payment amount of the cart before the order or swap is created.
8. `capturePayment`: Used to capture the payment amount of an order or swap.
9. `refundPayment`: Used to refund a payment amount of an order or swap.
10. `cancelPayment`: Used to perform any necessary action with the third-party payment provider when an order or swap is canceled.
:::note
@@ -130,6 +131,15 @@ class MyPaymentProcessor extends AbstractPaymentProcessor {
> {
throw new Error("Method not implemented.")
}
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
throw new Error("Method not implemented.");
}
}
export default MyPaymentProcessor
@@ -346,7 +356,7 @@ class MyPaymentService extends AbstractPaymentProcessor {
### updatePayment
This method is used to perform any necessary updates on the payment. This method is called whenever the cart or any of its related data is updated. For example, when a [line item is added to the cart](https://docs.medusajs.com/api/store#carts_postcartscartlineitems) or when a [shipping method is selected](https://docs.medusajs.com/api/store#carts_postcartscartshippingmethod).
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. For example, when a [line item is added to the cart](https://docs.medusajs.com/api/store#carts_postcartscartlineitems) or when a [shipping method is selected](https://docs.medusajs.com/api/store#carts_postcartscartshippingmethod).
:::tip
@@ -413,6 +423,41 @@ class MyPaymentService extends AbstractPaymentProcessor {
}
```
### updatePaymentData
This method is used to update the `data` field of a payment session. It's called when a request is sent to the [Update Payment Session API Route](https://docs.medusajs.com/api/store#carts_postcartscartpaymentsessionupdate), or when the `CartService`'s `updatePaymentSession` is used.
This method can also be used to update the data in the third-party payment provider, if necessary.
The method accepts the following parameters:
1. `sessionId`: A string that indicates the ID of the payment session.
2. `data`: An object containing the data to be updated.
The method returns the data to store in the `data` field of the payment session. You can keep the data as-is, or make changes to it by communicating with the third-party provider.
An example of a minimal implementation of `updatePaymentData` that returns the `data` field as-is:
```ts
import {
PaymentProcessorError
} from "@medusajs/medusa"
// ...
class MyPaymentService extends AbstractPaymentProcessor {
// ...
async updatePaymentData(
sessionId: string,
data: Record<string, unknown>
): Promise<
Record<string, unknown> |
PaymentProcessorError
> {
return data
}
}
```
### 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:
+36 -18
View File
@@ -126,25 +126,42 @@ Medusa's products configuration allows managing products of different types incl
</LargeCard>
<LargeCard
Icon={Icons['currency-dollar-solid']}
title='Price Lists'
action={{
label: 'Learn more',
href: '/modules/price-lists/overview'
}}
>
- Override product prices or offer sales using price lists.
- Set special conditions for price lists such as specific customer groups.
- Override the price selection strategy used to show customers the best prices.
- Bulk-edit prices in a price list when managing them using the Medusa Admin.
</LargeCard>
<LargeCard
Icon={Icons['receipt-percent']}
title='Discounts'
action={{
label: 'Learn more',
href: '/modules/discounts/overview'
}}
>
- Create discounts and deals with advanced conditions and rules such as minimum cart quantity or specific products.
- Offer free shipping, fixed discount, or percentage discount to your customers.
- Set start and end dates for your discounts to ensure they run for a specified period of time
</LargeCard>
</LargeCardList>
<LargeCard
Icon={Icons['currency-dollar-solid']}
title='Price Lists and Discounts'
action={{
label: 'Learn more',
href: '/modules/price-lists/overview'
}}
>
- Create discounts and deals with advanced conditions and rules such as minimum cart quantity or specific products.
- Offer free shipping, fixed discount, or percentage discount.
- Override product prices using price lists and set special conditions such as specific customer groups.
</LargeCard>
### Ready Configurations for International Selling
Medusa's multi-region setup and sales channels allow businesses to sell internationally and sell across platforms. Medusa allows configuring regions differently to cater for different markets across the globe.
@@ -152,13 +169,14 @@ Medusa's multi-region setup and sales channels allow businesses to sell internat
<LargeCardList colSize={6}>
<LargeCard
Icon={Icons['globe-europe-solid']}
title='Multi-Region'
title='Region and Currencies'
action={{
label: 'Learn more',
href: '/modules/regions-and-currencies/overview'
}}
>
- Support multi-region and multi-currencies in your store.
- Create an unlimited number of regions, each associated with a currency and at least one country.
- Manage each regions settings including payment processors, shipping options, and more.
- Set prices for products and shipping options specific to a currency or a region.