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

Workspace chat - Incorrect amount shown in preview card after payment. #46310

Closed
1 of 6 tasks
izarutskaya opened this issue Jul 26, 2024 · 15 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Hourly KSv2

Comments

@izarutskaya
Copy link

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: v9.0.12-0
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): biruknew45+2d2gg@gmail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Prerequisite: A workspace is created and 2 expenses are submitted in the workspace chat.

  1. Go to [staging.new.expensify.com].
  2. Navigate to the workspace chat created.
  3. Go to the expense details page.
  4. Click on the first expense.
  5. Click on the header, then select "hold."
  6. Write any reason and then click on "hold."
  7. Turn off the connection.
  8. Click on the "pay with expensify" dropdown and then select "pay elsewhere."
  9. Pay the amount.
  10. Navigate back to the main workspace chat by clicking on the subtitle link.

Expected Result:

After paying ETB 300, the preview card on the workspace chat page should show that ETB 300 is paid.

Actual Result:

After paying ETB 300, the preview card on the workspace chat page incorrectly shows that ETB 400 is paid.

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

Bug6553590_1721992163219!1

Bug6553590_1721992163178.1.mp4

View all open jobs on GitHub

@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jul 26, 2024
Copy link

melvin-bot bot commented Jul 26, 2024

Triggered auto assignment to @madmax330 (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Jul 26, 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.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@izarutskaya
Copy link
Author

Production

Recording.2653.mp4

@nkdengineer
Copy link
Contributor

nkdengineer commented Jul 26, 2024

Proposal

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

After paying ETB 300, the preview card on the workspace chat page incorrectly shows that ETB 400 is paid.

What is the root cause of that problem?

If we paid partial the expense report, we don't update the total of the expense report in optimistic data

const optimisticData: OnyxUpdate[] = [

And then the ReportPreview show the amount is the old total amount

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

We should update the total of the expense report here if the paid partial

{
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`,
    value: {
        ...iouReport,
        lastMessageText: ReportActionsUtils.getReportActionText(optimisticIOUReportAction),
        lastMessageHtml: ReportActionsUtils.getReportActionHtml(optimisticIOUReportAction),
        hasOutstandingChildRequest: false,
        statusNum: CONST.REPORT.STATUS_NUM.REIMBURSED,
        pendingFields: {
            preview: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
            reimbursed: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
            partial: full ? null : CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
        },
        total: full ? iouReport.total : total
    },
},

key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`,

We should do the same when we approve the report here

const optimisticIOUReportData: OnyxUpdate = {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.reportID}`,
    value: {
        ...expenseReport,
        lastMessageText: ReportActionsUtils.getReportActionText(optimisticApprovedReportAction),
        lastMessageHtml: ReportActionsUtils.getReportActionHtml(optimisticApprovedReportAction),
        stateNum: CONST.REPORT.STATE_NUM.APPROVED,
        statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
        pendingFields: {
            partial: full ? null : CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
        },
        total: full ? iouReport.total : total
    },
};

key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.reportID}`,

What alternative solutions did you explore? (Optional)

NA

@nkdengineer
Copy link
Contributor

@madmax330 Since it's a blocker, I can raise a PR quickly.

@francoisl
Copy link
Contributor

Hi @nkdengineer, with any deploy blocker, can you please also link to the PR from the current checklist that caused the regression? Thanks!

@nkdengineer
Copy link
Contributor

@francoisl It comes from this PR #42573.

@kpadmanabhan
Copy link

Proposal

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

Preview card showing incorrect amount after payment while offline.

What is the root cause of that problem?

When one payment was on hold, payment amount correctly reflects in "Pay XXX Elsewhere". But the same does not reflect in card amount. It still shows total amount before going offline.
Onyx is not updated while making part payments. Hence while offline, when we do not receive API response, we fetch data from onyx and display, which still contains the total amount.

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

Update onyx on every payment irrespective of online or offline.

What alternative solutions did you explore? (Optional)

N.A.

@nkdengineer
Copy link
Contributor

Updated proposal

  • Add the fix for approving money request

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@war-in
Copy link
Contributor

war-in commented Jul 29, 2024

Hi all 👋 I'm the author of the #42573

We decided not to update the value of the old (original) report because we can have expenses in different currencies.

Example:

  • report (A) has two expenses (A1, A2)
    • A1 - 10 USD
    • A2 - 30 some other currency which is 10x cheaper
  • A has value = 13 USD
  • we put A2 on hold
  • we can't perform conversion on FE so we set A value to 13 - 30 = -17 which is of course wrong

That's why we can't do it and behaviour is like that

@luacmartins
Copy link
Contributor

Ok, so this seems to be the expected behavior then. @war-in can you confirm so we can close this issue?

@luacmartins luacmartins removed the DeployBlocker Indicates it should block deploying the API label Jul 29, 2024
@luacmartins luacmartins assigned luacmartins and unassigned madmax330 Jul 29, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jul 29, 2024
@war-in
Copy link
Contributor

war-in commented Jul 29, 2024

@luacmartins Yes, I confirm :)

@luacmartins
Copy link
Contributor

Thanks! Gonna close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Hourly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants