Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(IT Wallet): [SIW-951] Add user payment methods in new wallet section #5639

Merged
merged 49 commits into from
Apr 4, 2024

Conversation

mastro993
Copy link
Contributor

@mastro993 mastro993 commented Mar 27, 2024

Warning

This PR depends on #5626 and pagopa/io-dev-api-server#358

Short description

This PR adds the user's payment methods in the new wallet section

List of changes proposed in this pull request

  • Added store and saga for the payments' wallet feature
  • Added card mapping for payment methods
  • Fixed a glitch in the ID Pay cards in wallet

How to test

With the io-dev-api-server, make sure to checkout this branch: pagopa/io-dev-api-server#358
From the Profile section, enable the New wallet section FF.
You should be able to see payment cards in the wallet.

Preview

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 58.49057% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 48.17%. Comparing base (b816497) to head (badec5b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5639      +/-   ##
==========================================
+ Coverage   48.15%   48.17%   +0.02%     
==========================================
  Files        1461     1465       +4     
  Lines       30966    31001      +35     
  Branches     7512     7520       +8     
==========================================
+ Hits        14912    14936      +24     
- Misses      15986    15997      +11     
  Partials       68       68              
Files Coverage Δ
ts/features/idpay/wallet/components/IdPayCard.tsx 100.00% <ø> (ø)
ts/features/newWallet/screens/WalletHomeScreen.tsx 90.90% <100.00%> (+0.90%) ⬆️
ts/features/newWallet/store/selectors/index.ts 100.00% <100.00%> (ø)
ts/features/newWallet/types/index.ts 100.00% <ø> (ø)
...heckout/components/WalletPaymentConfirmContent.tsx 10.34% <ø> (ø)
...checkout/screens/WalletPaymentPickMethodScreen.tsx 6.54% <ø> (ø)
...eatures/payments/common/components/PaymentCard.tsx 100.00% <ø> (ø)
...s/features/payments/common/store/reducers/index.ts 100.00% <ø> (ø)
ts/features/payments/common/utils/index.ts 35.18% <ø> (ø)
...ts/details/screens/PaymentsMethodDetailsScreen.tsx 7.69% <ø> (ø)
... and 8 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b816497...badec5b. Read the comment docs.

@forrest57
Copy link
Contributor

I tested it and it works as intended, but I also noticed

  1. that there is some overhead when interacting with the card, no idea why really
  2. because of that I put a log in WalletCardsContainer and WalletHomeScreen, and noticed that it ran on any of the app's renders, so I narrowed it down to newWallet/store/selectors, where the selectWalletCards is non-memoized and causes constant rerenders, so I rewrote it and the screen now seems to correctly run and render only when needed.
export const selectWalletCards = createSelector(selectWalletFeature, wallet =>
  Object.values(wallet.cards)
)

I'm not sure if the change is done in this PR, in case I'll add a comment about this 👍
-- also -- I can add a repro of this issue if you'd like

@mastro993
Copy link
Contributor Author

mastro993 commented Apr 4, 2024

export const selectWalletCards = createSelector(selectWalletFeature, wallet =>
  Object.values(wallet.cards)
)

@forrest57 Nice catch! Added this improvement in badec5b

@mastro993 mastro993 merged commit 86087cc into master Apr 4, 2024
13 checks passed
@mastro993 mastro993 deleted the SIW-951-add-payment-methods-in-new-wallet-section branch April 4, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants