Update logic to display pay button in paid policies#35347
Conversation
|
Hi @c3024, the PR is on hold for a backend change, but meanwhile, can you provide me a few emails to add you as a member, approver, and admin for the testing policy? |
|
@c3024 added to the testing collect workspace:
The backend changes were deployed to production, so this PR is ready for review |
| const isAutoReimbursable = ReportUtils.canBeAutoReimbursed(moneyRequestReport, policy); | ||
| const isPaidGroupPolicy = ReportUtils.isPaidGroupPolicy(moneyRequestReport); | ||
| const isManager = ReportUtils.isMoneyRequestReport(moneyRequestReport) && session?.accountID === moneyRequestReport.managerID; | ||
| const isReimburser = session?.email === policy?.reimburserEmail; |
There was a problem hiding this comment.
Might it be better to send the reimburser's accountID and compare it with session.accountID?
I think we standardised all to compare accountIDs. With comparing accountIDs, even if the reimburser changes their primary email, this check works fine. Reimbursers's email address can also remain hidden if we send only reimburser's accountID (though I don't think this is of much use.)
There was a problem hiding this comment.
Oh good point, the problem is that we're setting the reimburser email in the backend from OldDot. I agree we should compare accountIDs but that means we'd need to refactor also OldDot to save the accountID when the reimburser is selected.
Said that, let's go for now with this change and we can refactor later to send the accountID when it becomes a problem or when the dashboard for policy settings is migrated to NewDot.
There was a problem hiding this comment.
If the reimburser changes their primary email, then we might check to see if any of the reimbursers' validated email ids match with policy reimburser email. This is a rare and unlikely case and I am not sure if extra verbosity added is worth it. @marcochavezf
There was a problem hiding this comment.
@marcochavezf should we just update BE now to send the accountID? Or do we assume that all policy users should have access to this email info
Reviewer Checklist
Screenshots/VideosAndroid: NativepayButtonAndroid.mp4Android: mWeb ChromepayButtonAndroidChrome.mp4iOS: NativepayButtoniOS.mp4iOS: mWeb SafaripayButtoniOSSafari.mp4MacOS: Chrome / SafaripayButtonChrome.mp4MacOS: DesktoppayButtonDesktop.mp4 |
grgia
left a comment
There was a problem hiding this comment.
LGTM, I kind of agree on the accountID argument- but I can let you decide if you want to merge now
|
I will merge for now, since we're saving the reimburser email in the policy object, and in order to use the accountID in a standardized way (as we do it in other cases for App) we'd also need to change how we're saving it in the backend |
|
✋ 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/marcochavezf in version: 1.4.40-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.40-5 🚀
|

On hold for https://github.com/Expensify/Web-Expensify/pull/40709Details
We don't want to display the Pay button in paid policies for all admins, only for the policy reimburser. This PR checks if the logged-in user is a reimburser; if so, we display the Pay button for group policies.
Fixed Issues
$ #34951
Tests
Screen.Recording.2024-01-29.at.8.03.21.p.m.mov
Offline tests
N/A
QA Steps
Same as test steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
MacOS: Desktop