Skip to content

Commit

Permalink
fix: [IOBP-901] Missing header in payment methods (#6318)
Browse files Browse the repository at this point in the history
## Short description
This pull request includes a change to the `PaymentsMethodDetailsScreen`
component to enhance the `getCardHeaderTitle` function. The update adds
specific handling for BPAY and PayPal payment methods.

## List of changes proposed in this pull request
- Update `getCardHeaderTitle` function to handle missing edge cases

## How to test

### io-dev-server
To test all card cases, update the `generateWalletData` function by
adding this line: `generateUserWallet(3)`

### io-app

- Tap in _Portafoglio_
- BPAY or PayPal card
- Verify the correct card header title is displayed

---------

Co-authored-by: Alessandro <[email protected]>
  • Loading branch information
2 people authored and LazyAfternoons committed Oct 23, 2024
1 parent 2e4a696 commit 5af3ad0
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ const PaymentsMethodDetailsScreen = () => {
};

const getCardHeaderTitle = (details?: UIWalletInfoDetails) => {
if (details?.lastFourDigits !== undefined) {
const capitalizedCardCircuit = capitalize(
details.brand?.toLowerCase() ?? ""
);
return `${capitalizedCardCircuit} ••${details.lastFourDigits}`;
switch (details?.type) {
case "BPAY":
return "BANCOMAT Pay";
case "PAYPAL":
return "PayPal";
default:
if (details?.lastFourDigits !== undefined) {
const capitalizedCardCircuit = capitalize(
details.brand?.toLowerCase() ?? ""
);
return `${capitalizedCardCircuit} ••${details.lastFourDigits}`;
}
return "";
}

return "";
};

export default PaymentsMethodDetailsScreen;

0 comments on commit 5af3ad0

Please sign in to comment.