Table of Contents | ||
---|---|---|
|
...
Platform wide change, this should work on every market;
This should affect delivery orders only.
Identify Payment Methods as Online or Physical Payment
...
.
...
Frontend: Add onlinePayment at Payment Method Interface
Add a new property called onlinePayment at this interface
Update the constants that implement this interface adding the onlinePayment method here, the configuration should be:
...
const
...
onlinePayment value
...
PAYPAL_PAYMENT_METHOD_PLACEHOLDER
...
true
...
...
true
...
SODEXO_VOUCHER_PAYMENT_METHOD_PLACEHOLDER
...
false
...
CHEQUE_GOURMET_VOUCHER_PAYMENT_METHOD_PLACEHOLDER
...
false
...
SODEXO_PAYMENT_METHOD_PLACEHOLDER
...
true
...
CHEQUE_GOURMET_PAYMENT_METHOD_PLACEHOLDER
...
true
...
PAYMENT_ON_DELIVERY_CARD_PAYMENT_METHOD_PLACEHOLDER
...
false
...
BIZUM_PAYMENT_METHOD_PLACEHOLDER
...
true
...
WAYLET_PAYMENT_METHOD_PLACEHOLDER
...
true
Create a new method to verify if a payment type is online or not. This method should grant that cash will always be considered false regardless the configuration. (as you can see, there’s no configuration for cash in the table above, that represents the state/payment/constats.ts file)
Creating Editable Configurations
Note |
---|
Alternative check sanity payment method sort feature, having this map in LD or Sanity we can retrieve in the backend to add extra layer |
Sanity Option
We can create a new field on Sanity that will map the available payment methods with the flag TRUE or FALSE for isOnlinePayment question.
...
Code Block |
---|
{ "payment_methods": { "cash": false, "cc": true, "debit_online": true }, "rules": { "limit_first_order": { "active": true, "amount": 20, "amount_in_cents": 2000 }, "limit_total_amount": { "active": true, "amount": 50, "amount_in_cents": 5000 }, "limit_last_delivery_failed": { "active": false, "reasons_to_limit": { "customer_absence": true, "reason2": false, "reason3": true } } } } |
Frontend Preparation
Status colour Blue title Ready for dev
Rules Implementation
Rule 1 - First Order Physical Payment Limit
Status colour Blue title Ready for dev Rule 2 - Physical Payment Amount Limit
Status colour Blue title Ready for dev Rule 3 - Repeated Delivery Failure Limitation
Status colour Red title BLOCKED