Repos that we’ll change:
Whitelabel: https://github.com/rbilabs/intl-whitelabel-app
Figma: Schroer, Gabriel (Deactivated)
Task summary - Whitelabel:
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Components tree architecture
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
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Add the new payment method in
getPaymentMethodsState
:
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Update the interface:
Adjust the
|
Adjust the payment hook
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Update cash account variable:
Add the new feature flag here and then pass through the
Adjust the unit tests mocking the new flag where necessary: |
Adjust
use-order-payment
hook
Expand | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||
Add a new state for the new payment method:
Update the
Clear our new method in the
Update the
Adjust the
Adjust the
|
Extend the
getCurrentSelectedMethodType
:
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Add the new payment in the enum
Adjust the
Add the new condition in
|
Adjust order-payment comp:
Expand | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||
Return the new create state from
Pass the returned value to the
Pass the new method to the
|
Task 3: Add the new method in payment-method structure
Create new styled component for the new payment method
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Add a new type
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Add the new method in payment-method comp
Expand | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
Add new props in
Create new item inside
Add the new method in the map structure:
Pass the new prop in the
|
Add the new method in payment-method-options comp
Expand | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||
Add the new prop in
Add new condition in
Add a new handle for our new method (using useCallback) where we’ll clear the other methods and set your:
Add in the
Add a new block for for the case where we not have the
Add the new payment method in the
Add a new logic to the filter
|
Add the new method in paycomet-hosted-page-payment comp
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Return the new values from the
Pass down the values to the <PaymentMethod> 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:
Expand | |||||
---|---|---|---|---|---|
| |||||
|
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
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Use the created payment method option in
payment-method-option
:
Expand | |||||
---|---|---|---|---|---|
| |||||
Adjust the
|
Task 5: Adjust account payment method lists to deal with the new method
Expand | |||||
---|---|---|---|---|---|
| |||||
We’ll exclude the new payment method if it is not actually stored in the user account:
|
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