-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[CP Staging] Use selected currency when utilising tax rate #42064
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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid build not working locally Android: mWeb ChromeScreen.Recording.2024-05-14.at.12.29.53.AM.moviOS: NativeScreen.Recording.2024-05-14.at.12.21.52.AM.moviOS: mWeb SafariScreen.Recording.2024-05-14.at.12.19.05.AM.movMacOS: Chrome / SafariScreen.Recording.2024-05-13.at.11.47.37.PM.movMacOS: DesktopScreen.Recording.2024-05-14.at.12.13.12.AM.mov |
@ShridharGoel TS errors. |
@@ -34,13 +34,13 @@ type IOURequestStepTaxAmountPageProps = IOURequestStepTaxAmountPageOnyxProps & | |||
transaction: OnyxEntry<Transaction>; | |||
}; | |||
|
|||
function getTaxAmount(transaction: OnyxEntry<Transaction>, policy: OnyxEntry<Policy>, isEditing: boolean): number | undefined { | |||
function getTaxAmount(transaction: OnyxEntry<Transaction>, policy: OnyxEntry<Policy>, currency: string | undefined, isEditing: boolean): number | undefined { |
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.
Can you pass currency from all function usages also, please
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.
Passing currency from src/pages/iou/request/step/IOURequestStepAmount.tsx might fix #42049 NVM
Updating |
Should we pass currency to |
Yes, I think we should update all usages |
We don't have currency in |
Looks like |
@@ -371,7 +371,7 @@ function MoneyRequestConfirmationList({ | |||
|
|||
// Calculate and set tax amount in transaction draft | |||
useEffect(() => { | |||
const taxAmount = getTaxAmount(transaction, policy).toString(); | |||
const taxAmount = getTaxAmount(transaction, policy, currency).toString(); |
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.
@MonilBhavsar Added here as well, does this look fine?
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 doesn't look good to me as currency is related to mileage rate or policy default currency. const currency = (mileageRate as MileageRate)?.currency ?? policyCurrency;
We should either use selected currency or transaction currency
👍 we can leave it. Thanks for checking! |
@allroundexperts over to you |
Hm... isn't the lint failing? |
@ShridharGoel could you please fix the lint errors |
I found another bug which we can fix in this, updating it. |
Just a small feedback, as a reviewer force pushing commits make difficult to know what has been updated since last commit as it deletes commit history. |
@ShridharGoel Are you done? |
The issue which I'm trying to fix: When we change the currency for the first time, on the money request confirmation page it starts showing the max tax amount instead of the amount set by the user. This happens because we have a diff tax calculation logic in |
Updated. |
Screen.Recording.2024-05-13.at.11.18.14.PM.mov |
I believe it is already the case. Looking... |
It's a regression from https://github.com/Expensify/App/pull/40159/files |
@MonilBhavsar No, it's actually from #40443 only. |
But actually we should always have |
Nice, thanks! |
The changes have been completed. Summary:
|
Thanks for letting us know. I'm on the review. |
@ShridharGoel Can you please update the screen recordings? |
On it. |
Changing the currency resets the tax amount. Is that expected? |
I think yes since the tax percent changes. |
Can you please explain "reset". Perhaps with an example |
Added all videos except native Android where I have some build issues. Can we start an adhoc build? |
Also, I think older tax amount doesn't make sense when the currency is changed so it gets calculated again. |
@MonilBhavsar Notice how the tax amount changes from 5 to 5.76 after I change the currency at the end. Screen.Recording.2024-05-14.at.12.13.12.AM.mov |
Yes, Expected |
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.
Tests good!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
[CP Staging] Use selected currency when utilising tax rate (cherry picked from commit 2304a1f)
CPing 👍 |
…ng-42064-1 🍒 Cherry pick PR #42064 to staging 🍒
🚀 Deployed to staging by https://github.com/lakchote in version: 1.4.73-3 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.73-7 🚀
|
Details
Use selected currency when utilising tax rate.
Fixed Issues
$ #42047
PROPOSAL: #42047 (comment)
Tests
QA Steps
PR 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
Screenrecording_20240514_002141.mp4
iOS: Native
Screen.Recording.2024-05-14.at.12.16.13.AM.mov
iOS: mWeb Safari
Screen.Recording.2024-05-14.at.12.18.08.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-05-13.at.11.18.14.PM.mov
MacOS: Desktop
Screen.Recording.2024-05-14.at.12.28.01.AM.mov