Skip to content
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

[HOLD for payment 2024-04-25] [LOW] [Splits] [$500] Split bill - Currency for split bill via Scan is USD instead of local currency #29709

Closed
6 tasks done
lanitochka17 opened this issue Oct 16, 2023 · 72 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 16, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.3.84-7
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Issue found when executing PR #29664

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to group chat > + > Split bill > Manual
  3. Note that the currency is the local currency
  4. Go to Scan > Upload a photo
  5. Select Split with a few users and split the bill
  6. Open the split preview and click Amount
  7. Create a Scan request (1:1)
  8. Go to Scan details page > Amount
  9. Note that the currency is also local currency

Expected Result:

In Step 6, when editing the amount for split bill, the currency should be in the local currency

Actual Result:

In Step 6, when editing the amount for split bill, the currency is USD. While the currency in Manual split bill (Step 2) and 1:1 Scan request (Step 8) follows the local currency

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6239337_1697475398336.29664_.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01eec1820774133ef4
  • Upwork Job ID: 1716906523802828800
  • Last Price Increase: 2023-10-24
Issue OwnerCurrent Issue Owner: @anmurali
Issue OwnerCurrent Issue Owner: @marcochavezf
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot changed the title Split bill - Currency for split bill via Scan is USD instead of local currency [$500] Split bill - Currency for split bill via Scan is USD instead of local currency Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~014b7a910d5416d07a

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)

@sicarius97
Copy link

sicarius97 commented Oct 16, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

USD instead of local currency shown when starting a split on a receipt

What is the root cause of that problem?

It looks to me like in the code below the currency is set to the constant USD on line 1310 & 1326 rather than the local currency being passed down in the startSplitBill function:

App/src/libs/actions/IOU.js

Lines 1294 to 1336 in 22874c7

function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, receipt, existingSplitChatReportID = '') {
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin);
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID));
const existingSplitChatReport =
existingSplitChatReportID || participants[0].reportID
? allReports[`${ONYXKEYS.COLLECTION.REPORT}${existingSplitChatReportID || participants[0].reportID}`]
: ReportUtils.getChatByParticipants(participantAccountIDs);
const splitChatReport = existingSplitChatReport || ReportUtils.buildOptimisticChatReport(participantAccountIDs);
const isOwnPolicyExpenseChat = splitChatReport.isOwnPolicyExpenseChat || false;
const {name: filename, source, state = CONST.IOU.RECEIPT_STATE.SCANREADY} = receipt;
const receiptObject = {state, source};
// ReportID is -2 (aka "deleted") on the group transaction
const splitTransaction = TransactionUtils.buildOptimisticTransaction(
0,
CONST.CURRENCY.USD,
CONST.REPORT.SPLIT_REPORTID,
comment,
'',
'',
'',
CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT,
receiptObject,
filename,
);
// Note: The created action must be optimistically generated before the IOU action so there's no chance that the created action appears after the IOU action in the chat
const splitChatCreatedReportAction = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit);
const splitIOUReportAction = ReportUtils.buildOptimisticIOUReportAction(
CONST.IOU.REPORT_ACTION_TYPE.SPLIT,
0,
CONST.CURRENCY.USD,
comment,
participants,
splitTransaction.transactionID,
'',
'',
false,
false,
receiptObject,
isOwnPolicyExpenseChat,
);

What changes do you think we should make in order to solve the problem?

Instead of setting the currency to be a constant we could add a variable to the startSplitBill function like so:

function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, receipt, existingSplitChatReportID = '', currency = CONST.CURRENCY.USD) {

And then on the money request confirmation page, pass down the users local currency like so:

IOU.startSplitBill(
                        selectedParticipants,
                        props.currentUserPersonalDetails.login,
                        props.currentUserPersonalDetails.accountID,
                        trimmedComment,
                        receipt,
                        existingSplitChatReportID,
                        props.iou.currency
                    );

So that it reflects the local currency like in other areas

@Victor-Nyagudi
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Split bill - Currency for split bill via Scan is USD instead of local currency

What is the root cause of that problem?

When splitting a bill, the optimistic transaction's currency is set to USD (line 1310).

App/src/libs/actions/IOU.js

Lines 1308 to 1319 in be44c93

const splitTransaction = TransactionUtils.buildOptimisticTransaction(
0,
CONST.CURRENCY.USD,
CONST.REPORT.SPLIT_REPORTID,
comment,
'',
'',
'',
CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT,
receiptObject,
filename,
);

In addition, the back end also sends us the currency as USD.

Images of network request and split bill transaction

expensify-RHP-split-bill-bug

expensify-split-bill-bug-network-request

What changes do you think we should make in order to solve the problem?

I propose two solutions.

  • Option 1

First, add a currency parameter at the end of the startSplitBill() function.

function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, receipt, existingSplitChatReportID = '', currency) {

Next, pass the props.iou.currency to startSplitBill() method call in MoneyRequestConfirmPage, similar to what happens in a regular money request.

IOU.startSplitBill(
    selectedParticipants,
    props.currentUserPersonalDetails.login,
    props.currentUserPersonalDetails.accountID,
    trimmedComment,
    receipt,
    existingSplitChatReportID,
    props.iou.currency // <- Added
);

Finally, replace CONST.CURRENCY.USD with this currency in splitTransaction.

const splitTransaction = TransactionUtils.buildOptimisticTransaction(
    0,
    currency, // <- currency replaced
    CONST.REPORT.SPLIT_REPORTID,
    comment,
    '',
    '',
    '',
    CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT,
    receiptObject,
    filename,
);

This solution improves consistency with what happens in a regular money request.

  • Option 2

Since we already have the current user's personal details, we can leverage this and replace CONST.CURRENCY.USD with currentUserPersonalDetails.localCurrencyCode.

const splitTransaction = TransactionUtils.buildOptimisticTransaction(
    0,
    currentUserPersonalDetails.localCurrencyCode, // <- currency replaced
    CONST.REPORT.SPLIT_REPORTID,
    comment,
    '',
    '',
    '',
    CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT,
    receiptObject,
    filename,
);

This second option has lesser changes.

Either of these solutions addresses the front end issue, but as you can see from the following video, the back end changes the currency back to USD, so a change will need to happen over there too.

Video of back end changing the currency back to USD
expensify-split-bill-changing-currency.mov

Another indicator of a back end issue is if you test either of my proposed solutions offline, the currency stays at the local one.

Video of solution tested while offline
expensify-split-bill-solution-tested-offline.mov

Once you go back online, the currency is reverted back to USD.

Video of back end changing the currency back to USD when coming back online
expensify-split-bill-solution-coming-back-online.mov

What alternative solutions did you explore? (Optional)

I thought about making one of my two proposed solutions an alternative, but I figured I'd propose them together since the difference between them isn't that great.

@melvin-bot melvin-bot bot added the Overdue label Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

@anmurali, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

@anmurali, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@anmurali anmurali added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Current assignee @aimane-chnaif is eligible for the External assigner, not assigning anyone new.

@Expensify Expensify deleted a comment from melvin-bot bot Oct 24, 2023
@anmurali
Copy link

@aimane-chnaif can you review proposals and pick one so we can proceed?

@melvin-bot melvin-bot bot removed the Overdue label Oct 24, 2023
@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Oct 24, 2023

As backend also sends the currency as USD for scan transaction, first wanna confirm if it's intentional.
🎀 👀 🎀

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Triggered auto assignment to @marcochavezf, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@marcochavezf @anmurali @aimane-chnaif this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@marcochavezf, @anmurali, @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?

@marcochavezf
Copy link
Contributor

Checking it out today

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@marcochavezf
Copy link
Contributor

@marcochavezf Is the payment going to be split 50/50?

Yes, @anmurali could you handle payment for @sicarius97 and @Victor-Nyagudi? since the solution used part of their proposals. Also, payment for @aimane-chnaif and @Santhosh-Sellavel for C+ review

@melvin-bot melvin-bot bot added the Overdue label May 1, 2024
@Victor-Nyagudi
Copy link
Contributor

Bump @anmurali for payment so we can close this out.

Copy link

melvin-bot bot commented May 2, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@anmurali
Copy link

anmurali commented May 6, 2024

Payment summary

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 6, 2024
Copy link

melvin-bot bot commented May 10, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented May 14, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@anmurali
Copy link

anmurali commented May 15, 2024

Not overdue.Still waiting on responses from @sicarius97 and @aimane-chnaif #29709 (comment)

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 15, 2024
Copy link

melvin-bot bot commented May 20, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?

@aimane-chnaif
Copy link
Contributor

I accepted offer

Copy link

melvin-bot bot commented May 22, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@anmurali
Copy link

@aimane-chnaif is paid
@sicarius97 - I still need your Upwork profile to send you an offer.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 22, 2024
Copy link

melvin-bot bot commented May 28, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented May 29, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@aimane-chnaif
Copy link
Contributor

I think we can close this for now. @sicarius97 can ping here or slack when they're available.

Copy link

melvin-bot bot commented May 30, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif Still overdue 6 days?! Let's take care of this!

@JmillsExpensify
Copy link

$250 approved for @Santhosh-Sellavel

Copy link

melvin-bot bot commented Jun 3, 2024

@marcochavezf, @anmurali, @Santhosh-Sellavel, @aimane-chnaif 10 days overdue. I'm getting more depressed than Marvin.

@anmurali anmurali closed this as completed Jun 4, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

9 participants