-
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
[Wave Collect] [Workflows] Display meaningful message when currency is not available for Direct Reimbursement #38318
Conversation
@robertjchen 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] |
Please keep in mind that I'll be OOO tomorrow. |
Putting this on HOLD. We'll need to change the error location for direct reimbursement and prevent setting direct reimbursement as soon as See discussion here. |
@luacmartins @robertjchen @mountiny ready for review! |
autoReportingErrorMessage: 'The delayed submission parameter could not be changed. Please try again or contact support.', | ||
autoReportingFrequencyErrorMessage: 'The submission frequency could not be changed. Please try again or contact support.', | ||
monthlyOffsetErrorMessage: 'The monthly frequency could not be changed. Please try again or contact support.', | ||
}, | ||
workflowsApprovalPage: { | ||
genericErrorMessage: 'The approver could not be changed. Please try again or contact support.', |
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.
Has marketing reviewed these copies?
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.
Asked about it here
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.
@lakchote This is usually done using Marketing label autoassigner on the linked issue so we get one dedicated person for this
src/libs/actions/Policy.ts
Outdated
const CURRENCY_AU = 'AUD'; | ||
const CURRENCY_CA = 'CAD'; | ||
const CURRENCY_GB = 'GBP'; | ||
const CURRENCY_US = 'USD'; | ||
const CURRENCY_EUR = 'EUR'; | ||
|
||
const DIRECT_REIMBURSEMENT_CURRENCIES: string[] = [CURRENCY_AU, CURRENCY_CA, CURRENCY_EUR, CURRENCY_GB, CURRENCY_US]; | ||
|
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.
We already have these defined here, it also seems like we support NZD, which is missing in your list above
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.
+1 definitely lets reuse this from Const or add there what is missing there
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.
src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx
Outdated
Show resolved
Hide resolved
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.
Looking good, couple comments
src/libs/actions/Policy.ts
Outdated
const CURRENCY_AU = 'AUD'; | ||
const CURRENCY_CA = 'CAD'; | ||
const CURRENCY_GB = 'GBP'; | ||
const CURRENCY_US = 'USD'; | ||
const CURRENCY_EUR = 'EUR'; | ||
|
||
const DIRECT_REIMBURSEMENT_CURRENCIES: string[] = [CURRENCY_AU, CURRENCY_CA, CURRENCY_EUR, CURRENCY_GB, CURRENCY_US]; | ||
|
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.
+1 definitely lets reuse this from Const or add there what is missing there
@jjcoffee this would be an important PR to prioritize review. |
src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx
Outdated
Show resolved
Hide resolved
@@ -219,10 +217,10 @@ function WorkspaceWorkflowsPage({policy, betas, route, reimbursementAccount, ses | |||
</> | |||
), | |||
isEndOptionRow: true, | |||
isActive: policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO, | |||
isActive: policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES, |
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 prevents the toggle getting toggled on if a workspace has a non-USD currency (as the toggle will set it to REIMBURSEMENT_MANUAL
). I think the previous commit worked fine for this.
const effectiveReimbursementChoice = shouldUseDirectReimbursement ? newReimbursementChoice : CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL; | ||
const effectiveReimbursementChoice = shouldUseDirectReimbursement | ||
? CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES | ||
: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL; |
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.
Almost there! If I revert the change I commented on here, I can't toggle off, because we now never set REIMBURSEMENT_NO
. The way I see it, we need to check if we are enabling the toggle (reimbursementChoice === REIMBURSEMENT_NO
), then switch between REIMBURSEMENT_YES
and REIMBURSEMENT_MANUAL
based on shouldUseDirectReimbursement
, otherwise we are turning the toggle off so should set to REIMBURSEMENT_NO
.
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.
Since this slightly edge-case flow seems to be causing a bit of trouble, I'm pulling out some test steps here. It might be worth adding them to the PR test steps @lakchote so QA pick up on it too:
|
dfc3e8b
to
adb5d5e
Compare
Good point, test steps updated! |
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.
LGTM and tests well!
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.
LGTM!
✋ 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/luacmartins in version: 1.4.56-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.56-8 🚀
|
Details
Currently, there are no meaningful message displayed to the user when he has a currency not compatible with direct reimbursement, and he wants to use
Make or track payments
in Simplified Collect Workflows.See #38235 and #38206
and latest updates from discussion here.
In addition to that, error messages were not handled for
Delayed Submissions
Add approvals
.Moreover, errors were not taken care of in
Workspace > Profile
forCurrency
,Description
, andWorkspace name
.This PR aims to solve these issues.
Fixed Issues
$ #38206
PROPOSAL:
Tests
Prerequisites:
Make or track payments
in Workflows toggled to off.Test 1
Workspace > Profile
, select an unsupport currency for direct reimbursement such asUGX
Workspace > Workflows
, toggle onMake or track payments
Connect bank account
Connect bank account
Update to USD
Test 2
(Only for Expensify engineers)
In order to test
Delayed Submission
andAdd approval
errors, we'll need to force an error being thrown in the backend.Throw an exception in
PolicyAPI:update
forAdd approval
, and do the same inPolicyAPI::setAutoHarvesting
forDelayed Submission
.You should see something like this after trying to toggle them:
Offline tests
Complete the same steps as in the
Tests
section above. Whenever you come back online, the error messages should display.QA Steps
Same as in Tests section above (except for the section related to Expensify engineers).
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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
Screenshots are in `Tests` section above.MacOS: Desktop