Repos that we’ll change:
Whitelabel: https://github.com/rbilabs/intl-whitelabel-app
Figma: Schroer, Gabriel (Deactivated)
Task summary - Whitelabel:
Components tree architecture
Business rules
The new payment method should only be available if the user selects “delivery mode” inside the Whitelabel App
The confirmation/tracking page should show the correct text in the payment reminder for this new payment method
The receipt email should show the correct payment option for this new payment method
The new method should be available in the user account methods list
Tasks breakdown
The solution was based on the Sodexo Cheque Gourmet Voucher implementation: https://github.com/rbilabs/intl-whitelabel-app/pull/686/files
Task 1: Create a new feature flag
Flag should be added in: frontend/src/utils/launchdarkly/flags.ts
Suggestion name: ENABLE_CARD_AT_HOME_PAYCOMET
The user can pay using credit or debit mode, so “card” is a generic name
Task 2: Add the new payment method in the payment state and structure
Create a new placeholder for the new payment method
The idea is to send this new payment method identified as cash
Add the new payment method in
getPaymentMethodsState
:
Adjust the payment hook
Adjust
use-order-payment
hook
Extend the
getCurrentSelectedMethodType
:
Adjust order-payment comp:
Task 3: Add the new method in payment-method structure
Create new styled component for the new payment method
Add a new type
Add the new method in payment-method comp
Add the new method in payment-method-options comp
Add the new method in paycomet-hosted-page-payment comp
Task 4: Create and add a new method in payment-method-option structure
Add the new icon for the new payment method in:
frontend/src/components/icons/new-payment-method/index.tsx
(replace “new-payment-method” for the new name, hahaha).We can use the https://react-svgr.com/playground/ to convert the svg code from Figma to use in our code (following the pattern of the application)
Add the new method option in the interface of payment methods:
Add new file in
frontend/src/components/payment-method-option/
as the following example:Remember to add the translation that will be used in
formatMessage
Use the created payment method option in
payment-method-option
:
Task 5: Adjust account payment method lists to deal with the new method
Nice to have - not considered now
Task 6: Adjust the confirmation text for confirmation page and tracking modal
The same component is used to show both cases:
frontend/src/pages/order-confirmation/delivery/delivery-details.tsx
Suggestion of implementation:
Add a new property/flag inside the
cart.payment
structure to enable a new condition to show new texts for these case (I think that perhaps we should not change thecardType
, not sure yet)
For the payment reminder tip we have some options:
Create new component as the
<CashPaymentReminder />
that we have today for the new condition/new textAdjust the
<CashPaymentReminder />
to deal with other types of texts and perhaps rename this component to have a generic name (for example<PaymentReminder />
)
Task 7: Adjust the receipt email to show the correct message for the new payment method
NEEDS TO BE DISCOVERED - WIP
Add Comment