refactor hasCardAuthenticatedError to use amountedOwed#80409
refactor hasCardAuthenticatedError to use amountedOwed#80409tgolen merged 3 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bae5e1871c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| function hasCardAuthenticatedError(stripeCustomerId: OnyxEntry<StripeCustomerID>, amountOwed: number) { | ||
| return stripeCustomerId?.status === 'authentication_required' && amountOwed === 0; |
There was a problem hiding this comment.
Treat missing amountOwed as 0 for auth-required check
Because callers now pass amountOwed directly from useOnyx(..., {canBeMissing: true}), this argument can be null when the key is missing. The strict comparison amountOwed === 0 will then be false, so users with stripeCustomerId.status === 'authentication_required' and no stored amount owed will not see the authentication-required error/red dot. Previously this path used getAmountOwed() which coerces null/undefined to 0, so the regression only appears after this change. Consider normalizing with getAmountOwed(amountOwed) or amountOwed ?? 0 before the comparison.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
we already added the default value when getting it from useOnyx
|
@shubham1206agra Can you please review this PR? |
|
@dukenv0307 Is there a way to simulate the test conditions? |
|
@shubham1206agra, I think we can mock data. I asked AI to help mock data to display the cardExpired message |
|
@dukenv0307 You need to provide the exact mock steps. Otherwise, QA too will struggle to repro this. |
JmillsExpensify
left a comment
There was a problem hiding this comment.
Refactoring that improves the product experience. Looks good to me.
|
@shubham1206agra I tried, but couldn't find a way to set up the account with an expired card. Do you have any ideas? QA may have that account, so I think that's fine to add |
|
@dukenv0307 Can you give me mock Onyx state for the test? This should work. |
|
@shubham1206agra Here you are |
JmillsExpensify
left a comment
There was a problem hiding this comment.
Still all good from a product perspective.
Reviewer Checklist
Screenshots/Videos
|
@dukenv0307 This does not work btw |
|
@shubham1206agra Are you still testing this or is it OK to merge? |
|
@tgolen You can merge the PR |
|
🚧 @tgolen has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.3.25-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.3.25-13 🚀
|

Explanation of Change
Fixed Issues
$ #66443
PROPOSAL:
Tests
Your payment card expired. Please add a new payment card to clear your x outstanding balance.Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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