-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[WAVE7] Hold Requests: Approving/Paying expense reports with held requests #33124
[WAVE7] Hold Requests: Approving/Paying expense reports with held requests #33124
Conversation
@allroundexperts 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] |
@allroundexperts FYI - I think @robertjchen will be handling review here |
|
||
return ( | ||
<DecisionModal | ||
title={translate(isApprove ? 'iou.confirmApprove' : 'iou.confirmPay')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: just making a note for later cleanup- we can probably move these string constants to https://github.com/Expensify/App/blob/main/src/CONST.ts
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
@robertjchen looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ 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/robertjchen in version: 1.4.58-0 🚀
|
not an emergency, all jobs were/are passing. |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.58-8 🚀
|
if (ReportUtils.hasHeldExpenses(moneyRequestReport.reportID)) { | ||
setIsHoldMenuVisible(true); | ||
} else if (chatReport) { | ||
IOU.payMoneyRequest(type, chatReport, moneyRequestReport, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
value should have been passed since this function is handling full payment. ref: #39357
if (ReportUtils.hasHeldExpenses(expenseReport.reportID) && !full && !!expenseReport.unheldTotal) { | ||
total = expenseReport.unheldTotal; | ||
} | ||
const optimisticApprovedReportAction = ReportUtils.buildOptimisticApprovedReportAction(total, expenseReport.currency ?? '', expenseReport.reportID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from #39342, we need to optimistic clear hold reason as well
const shouldShowRBR = | ||
hasViolations || hasFieldErrors || (!(isSettled && !isSettlementOrApprovalPartial) && !(ReportUtils.isReportApproved(iouReport) && !isSettlementOrApprovalPartial) && isOnHold); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This eventually caused #45064 – we should optimistically clear the 'hold' violations when unholding a request.
} else if (!(isSettled && !isSettlementOrApprovalPartial) && isOnHold) { | ||
message += ` • ${translate('iou.hold')}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition was put in wrong place which caused #42138
@@ -78,8 +80,32 @@ function MoneyReportHeader({session, policy, chatReport, nextStep, report: money | |||
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextStep; | |||
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); | |||
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableSpend, moneyRequestReport.currency); | |||
const [nonHeldAmount, fullAmount] = ReportUtils.getNonHeldAndFullAmount(moneyRequestReport); | |||
const displayedAmount = ReportUtils.hasHeldExpenses(moneyRequestReport.reportID) && canAllowSettlement ? nonHeldAmount : formattedAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BartoszGrajdek Is there a reason that the canAllowSettlement
condition is required here?
Details
This PR adds a possibility to partially or fully pay/approve expense reports that contain requests on hold.
Fixed Issues
$ #31345
Tests
Assumptions:
Scenarios to test out - test both for approvals & payment flow:
All requests should be put off hold, and then everything should be settled/approved like it used to before
All requests on hold should be put off hold, and then everything should be settled/approved like it used to before
All unheld requests should be paid/approved with appropriate updates in request previews, all requests on hold should be moved to a new money report
Offline tests
Assumptions:
Scenarios to test out - test both for approvals & payment flow:
a. If the money report includes requests with different currencies (or just one money request with currency different than your default currency) pay/approve button should be disabled.
b. If the money report includes only one currency pay/approve button should be available
All held request previews shouldn't display the "· Hold" instead they should display "· Paid",, green checkmarks should be shown the same way it's currently working on staging the system message should have opacity of 0.5
All held request previews shouldn't display the "· Hold" instead they should display "· Paid",, green checkmarks should be shown the same way it's currently working on staging the system message should have opacity of 0.5
All requests will have opacity of 0.5, green checkmarks should be shown the same way it's currently working on staging, but only in the unheld requests preview
QA Steps
Important
There are currently some problems with the backend for this feature, so it may not be fully working while you're online
Nevertheless, all of test scenarios are mentioned in
Tests
&Offline tests
sectionsPR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop