Filter unassigned cards by encrypted card number instead of masked PAN#90927
Filter unassigned cards by encrypted card number instead of masked PAN#90927MelvinBot wants to merge 7 commits into
Conversation
The getFilteredCardList function filtered commercial feed cards by cardName (masked PAN), which incorrectly hid unassigned cards when another card with the same masked PAN was already assigned. This swaps the filtering to use encryptedCardNumber (unique per physical card) and updates the key/value mapping to match the inverted backend cardList format. Co-authored-by: Rachael Hopkins <RachCHopkins@users.noreply.github.com>
…format
The cardList format is {maskedPAN: encryptedCardNumber}, not the inverse.
Fix the filter and map to correctly interpret keys as masked PANs and values
as encrypted card numbers. Use both encrypted and name-based filtering to
handle cases where assigned cards may not have encryptedCardNumber.
Co-authored-by: Rachael Hopkins <RachCHopkins@users.noreply.github.com>
|
Fixed the failing tests. The commercial feed
|
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
The new cardListByEncrypted property leaks into rest-spreads that only destructured cardList, causing Object.values() to include Record<string, string> in the union type alongside Card. Co-authored-by: Rachael Hopkins <RachCHopkins@users.noreply.github.com>
|
Fixed the typecheck failure: the new |
Remove leading-underscore aliases for destructured cardListByEncrypted properties and add no-shadow disable for the inner-scope usage that shadows the outer declaration. Co-authored-by: Rachael Hopkins <RachCHopkins@users.noreply.github.com>
|
Fixed the failing ESLint check: removed leading-underscore aliases ( |
|
All CI checks are passing. The only "failing" check is the PR Author Checklist, which is expected — it requires the human co-author to complete the testing steps and checkboxes before marking the PR as ready for review. No code fix is needed. |
Explanation of Change
The
getFilteredCardListfunction filtered commercial feed cards bycardName(masked PAN), which incorrectly hid unassigned cards when another card with the same masked PAN was already assigned (e.g. two cards both ending in "7012"). This changes the filtering to useencryptedCardNumber(unique per physical card) and updates the key/value mapping to match the inverted backendcardListformat where the key is the encrypted card number and the value is the masked PAN.Companion backend PR: https://github.com/Expensify/Auth/pull/21675
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/637310
PROPOSAL:
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
N/A — no changes to offline behavior.
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari