refactor shouldRestrictUserBillableActions to use amountOwed from useOnyx#83188
refactor shouldRestrictUserBillableActions to use amountOwed from useOnyx#83188tgolen merged 4 commits intoExpensify:mainfrom
Conversation
|
@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] |
| */ | ||
| function hasInsufficientFundsError(billingStatus: OnyxEntry<BillingStatus>) { | ||
| return billingStatus?.declineReason === 'insufficient_funds' && getAmountOwed() !== 0; | ||
| function hasInsufficientFundsError(billingStatus: OnyxEntry<BillingStatus>, amountOwed: OnyxEntry<number>) { |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
Inconsistent parameter type: hasCardExpiredError (line 132) takes amountOwed: number, but hasInsufficientFundsError takes amountOwed: OnyxEntry<number> (i.e., number | undefined). These sibling functions serve the same purpose for the amountOwed parameter and should use the same type.
When amountOwed is undefined, undefined \!== 0 evaluates to true, which would incorrectly indicate an insufficient funds error exists even when no amount owed data is available.
Use number consistently, matching hasCardExpiredError:
function hasInsufficientFundsError(billingStatus: OnyxEntry<BillingStatus>, amountOwed: number) {
return billingStatus?.declineReason === 'insufficient_funds' && amountOwed \!== 0;
}Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
JmillsExpensify
left a comment
There was a problem hiding this comment.
No concerns from a product perspective.
|
@dukenv0307 Merge main please |
|
@shubham1206agra Done |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-03-04.at.10.07.16.PM.mov |
|
@tgolen Please review this 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.32-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.32-3 🚀
|
Explanation of Change
Fixed Issues
$ #66443
PROPOSAL:
Tests
Requirement: Login with the account that has amountOwed > 0
Dev: For testing on dev, we can mock the data by using the following commands
Restricted actionpage is shownOffline tests
QA Steps
Requirement: Login with the account that has amountOwed > 0
Restricted actionpage is shownPR 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
Screen.Recording.2026-02-23.at.15.34.12.mov