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 2025-01-13] [$125] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish #53916

Closed
8 tasks done
IuliiaHerets opened this issue Dec 11, 2024 · 30 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 External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Dec 11, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.74-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • App language is Spanish.
  • Default workspace currency is USD.
  • Invoices feature is enabled.
  1. Go to staging.new.expensify.com
  2. Go to Account settings.
  3. Note that the currency and amount in the Wallet (Billetera) badge is in the format of 0,00 US$
  4. Go to workspace settings.

Expected Result:

The currency and amount in the Invoices (Facturas) badge will change to the format of 0,00 US$

Actual Result:

The currency and amount in the Invoices (Facturas) badge is still $0.00.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6690644_1733899866488.20241211_144650.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866918061086756277
  • Upwork Job ID: 1866918061086756277
  • Last Price Increase: 2024-12-11
  • Automatic offers:
    • nkdengineer | Contributor | 105375971
Issue OwnerCurrent Issue Owner: @sonialiap / @jliexpensify
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Dec 11, 2024

Edited by proposal-police: This proposal was edited at 2024-12-11 11:33:12 UTC.

Proposal

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

Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish

What is the root cause of that problem?

We are using CurrencyUtils.convertToFrontendAmountAsString to format the amount to a floating number and then we prefix it with currency. convertToFrontendAmountAsString doesn't return a localized floating number as convertToDisplayString

badgeText: `${CurrencyUtils.getCurrencySymbol(currencyCode)}${CurrencyUtils.convertToFrontendAmountAsString(
policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0,
currencyCode,

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

We should use convertToDisplayString instead of convertToFrontendAmountAsString to localize the amount as we are doing on WorkspaceInvoiceBalanceSection. And remove CurrencyUtils.getCurrencySymbol call

badgeText: `${CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, currencyCode)}`,

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A
UI issue

What alternative solutions did you explore? (Optional)

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@melvin-bot melvin-bot bot changed the title Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish [$250] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish Dec 11, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@sonialiap sonialiap changed the title [$250] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish [$125] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

Upwork job price has been updated to $125

@nkdengineer
Copy link
Contributor

Proposal

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

The currency and amount in the Invoices (Facturas) badge is still $0.00.

What is the root cause of that problem?

The invoice badge is always displayed with the format ${currency}{amount} that is inconsistent with the balance that we displayed in WorkspaceInvoiceBalanceSection here and I notice that the badge is also displayed with the wrong currency. It displays with the workspace currency while in WorkspaceInvoiceBalanceSection we display with USD currency with the same value is policy?.invoice?.bankAccount?.stripeConnectAccountBalance

Screenshot 2024-12-12 at 02 07 27

badgeText: `${CurrencyUtils.getCurrencySymbol(currencyCode)}${CurrencyUtils.convertToFrontendAmountAsString(
policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0,
currencyCode,
)}`,

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

We should use convertToDisplayString function without currency code then it will default to USD as we did here

badgeText: CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0),

badgeText: `${CurrencyUtils.getCurrencySymbol(currencyCode)}${CurrencyUtils.convertToFrontendAmountAsString(
policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0,
currencyCode,
)}`,

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

If the correct currency should be the workspace currency, we need to add the worksapce currency to convertToDisplayString here

badgeText: CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, currencyCode),

badgeText: `${CurrencyUtils.getCurrencySymbol(currencyCode)}${CurrencyUtils.convertToFrontendAmountAsString(
policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0,
currencyCode,
)}`,

and here

CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, policy?.outputCurrency)

title={CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0)}

@hungdannt
Copy link

Proposal

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

The Invoices badge displays '$0.00', but it should be formatted as 0,00 US$ when the app language is set to Spanish

What is the root cause of that problem?

badgeText: `${CurrencyUtils.getCurrencySymbol(currencyCode)}${CurrencyUtils.convertToFrontendAmountAsString(
policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0,
currencyCode,

The Invoices badge manually concatenates the currency symbol with function convertToFrontendAmountAsString that just converts the amount to a string, but does not handle localization or currency formatting

function convertToFrontendAmountAsString(amountAsInt: number | null | undefined, currency: string = CONST.CURRENCY.USD, withDecimals = true): string {
    if (amountAsInt === null || amountAsInt === undefined) {
        return '';
    }
    const decimals = withDecimals ? getCurrencyDecimals(currency) : 0;
    return convertToFrontendAmountAsInteger(amountAsInt, currency).toFixed(decimals);
}

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

Should use convertToDisplayString instead of convertToFrontendAmountAsString. This will properly handle currency formatting and localization in a single function call and provides a more consistent user experience across the application

function convertToDisplayString(amountInCents = 0, currency: string = CONST.CURRENCY.USD): string {
    const convertedAmount = convertToFrontendAmountAsInteger(amountInCents, currency);
    let currencyWithFallback = currency;
    if (!currency) {
        currencyWithFallback = CONST.CURRENCY.USD;
    }
    return NumberFormatUtils.format(BaseLocaleListener.getPreferredLocale(), convertedAmount, {
        style: 'currency',
        currency: currencyWithFallback,
        minimumFractionDigits: getCurrencyDecimals(currency),
        maximumFractionDigits: 2,
    });
}

The suggested change:

badgeText: `${CurrencyUtils.convertToDisplayString(policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0, currencyCode)}`,

POC :
https://github.com/user-attachments/assets/b30785d3-f8a6-4233-a73c-c64b7c67340f

What alternative solutions did you explore? (Optional)

N/A

@maxawad
Copy link

maxawad commented Dec 12, 2024

Proposal

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

The currency symbol displayed on the Invoices / Facturas button is misplaced in Spanish.
Zero US Dollars is displayed as $0.00 in English while 0,00 US$ in Spanish

What is the root cause of that problem?

The root cause for this mismatch between Billetera and Facturas button is that Facturas is using a non-localized approach and needs to be refactored into using the new helper method.

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

As stated by other proposals, CurrencyUtils.convertToDisplayString should be used.
Note that this change should be made on all display points of currency digits.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

Given the language is set to Spanish and currency to US Dollars when checking for the wallet badge then it should display ' US$' Given the language is set to Spanish and currency to US Dollars when checking for the invoice badge then it should display ' US$'

What alternative solutions did you explore? (Optional)

I would make sure the rest of the application is using the correct method for displaying currency values to the customer. It should be using localized display method.

Copy link

melvin-bot bot commented Dec 12, 2024

📣 @maxawad! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@maxawad
Copy link

maxawad commented Dec 12, 2024

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01df6e764dfa05027a

Copy link

melvin-bot bot commented Dec 12, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@sonialiap sonialiap removed their assignment Dec 13, 2024
@sonialiap sonialiap added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Dec 13, 2024
Copy link

melvin-bot bot commented Dec 13, 2024

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@sonialiap
Copy link
Contributor

I'm OOO Dec 16-20, I think this might be a quick fix so adding a leave buddy

next steps:

@sonialiap sonialiap removed their assignment Dec 13, 2024
@sonialiap sonialiap added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Dec 13, 2024
Copy link

melvin-bot bot commented Dec 13, 2024

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@dukenv0307
Copy link
Contributor

@jliexpensify I will give the update by EOD.

@melvin-bot melvin-bot bot removed the Overdue label Dec 16, 2024
@dukenv0307
Copy link
Contributor

After changing the currency, for example to AED, the balance currency on the right side is still shown USD, is it correct? cc @sonialiap @rezkiy37 (you're the author of this PR)

Screenshot 2024-12-16 at 11 07 14

@dukenv0307
Copy link
Contributor

@jliexpensify I need to confirm the expectation here before choosing the proposal

@rezkiy37
Copy link
Contributor

Hi!
The app has to display the same and currently selected currency so it is a bug.

cc @cristipaval

@dukenv0307
Copy link
Contributor

Thank you @rezkiy37. Let's go with @nkdengineer's alternative proposal

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 17, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 17, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 18, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 6, 2025
@melvin-bot melvin-bot bot changed the title [$125] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish [HOLD for payment 2025-01-13] [$125] Invoices - Invoices badge is $0.00 instead of 0,00 US$ when app language is Spanish Jan 6, 2025
Copy link

melvin-bot bot commented Jan 6, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 6, 2025
Copy link

melvin-bot bot commented Jan 6, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.80-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-01-13. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jan 6, 2025

@dukenv0307 @sonialiap / @jliexpensify @dukenv0307 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 7, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/50565/files#r1904876773

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. Yes

Regression Test Proposal Template

Regression Test Proposal

Test:

  1. Create a new workspace
  2. Go to More Features -> enable Invoice
  3. Go to the Invoice page
  4. Verify that: invoice badge displays selected currency of the workspace

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 13, 2025
@sonialiap
Copy link
Contributor

Payment summary:

@JmillsExpensify
Copy link

$125 approved for @dukenv0307

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests