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-02-26] [$500] Cancel payment - "Next step" does not update after cancelling payment until page is refreshed #36705

Closed
6 tasks done
m-natarajan opened this issue Feb 16, 2024 · 19 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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 16, 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: 1.4.42-1
Reproducible in staging?: Y
Reproducible in production?: New Feature
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:

Action Performed:

Precondition:

  • Admin and employee are in Collect workspace.
  1. [Employee] Go to workspace chat.
  2. [Employee] Create a money request and submit it.
  3. [Admin] Pay elsewhere the request.
  4. [Admin] Go to expense report.
  5. [Admin] Cancel the payment.

Expected Result:

"Next step" message will automatically update after the payment is cancelled.

Actual Result:

"Next step" message does not update after cancelling the payment until the page is revisited.

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

Add any screenshot/video evidence

Bug6381987_1708096257674.20240216_223106.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012c18b3226de5d7de
  • Upwork Job ID: 1758514115060043776
  • Last Price Increase: 2024-02-16
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment 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 Feb 16, 2024
@melvin-bot melvin-bot bot changed the title Cancel payment - "Next step" does not update after cancelling payment until page is refreshed [$500] Cancel payment - "Next step" does not update after cancelling payment until page is refreshed Feb 16, 2024
Copy link

melvin-bot bot commented Feb 16, 2024

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

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

melvin-bot bot commented Feb 16, 2024

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

Copy link

melvin-bot bot commented Feb 16, 2024

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 16, 2024
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.

Copy link

melvin-bot bot commented Feb 16, 2024

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

@m-natarajan
Copy link
Author

We think this might be related to #wave5-free-submitters
cc @dylanexpensify

@shahinyan11
Copy link

@m-natarajan What means the Collect workspace. There is not a submit button in IOU preview ? Please provide more detailed steps

@amyevans
Copy link
Contributor

"Cancel" was a new feature implemented in #34719 - @Gonals mind tackling this one please? Looks like CancelPayment needs some reportNextStep Onyx data

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Feb 17, 2024

Proposal

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

"Next step" does not update after cancelling payment until page is refreshed

What is the root cause of that problem?

we have migrated the next steps to client side in #34450 but when we added the cancel command in #34719 we didn't implement optimistic nextStep generation in cancelPayment

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

  1. we should add CANCELED IN CONST.REPORT.STATUS_NUM
  2. add a case in buildNextStep to check if the report is canceled:
case CONST.REPORT.STATUS_NUM.CANCELED:
    optimisticNextStep = {
        type,
        title: 'Finished!',
        message: [
            {
                text: 'No further action required!',
            },
        ],
    };
    break;
  1. in cancelPayment we should add:
const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null;
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.APPROVED);

and in optimisticData:

{
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
    value: optimisticNextStep,
},

and in failureData:

{
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
    value: currentNextStep,
},

Result:

Cancel.payment.next.step.Recording.2024-02-17.010710.mp4

Branch for testing: https://github.com/rayane-djouah/z/tree/Fix-Next-step-does-not-update-after-cancelling-payment-until-page-is-refreshed

What alternative solutions did you explore? (Optional)

Instead of adding CANCELED IN CONST.REPORT.STATUS_NUM, we can add isCanceled parameter to buildNextStep:

function buildNextStep(report: Report | EmptyObject, predictedNextStatus: ValueOf<typeof CONST.REPORT.STATUS_NUM>, {isPaidWithWallet}: BuildNextStepParameters = {}, isCanceled = false): ReportNextStep | null {

and here:

if (!isOwner) {
optimisticNextStep.title = 'Finished!';
optimisticNextStep.message = [
{
text: 'No further action required!',
},
];
}

we should add || isCanceled to the condition:

if (!isOwner || isCanceled) {
    optimisticNextStep.title = 'Finished!';
    optimisticNextStep.message = [
        {
            text: 'No further action required!',
        },
    ];
}

and pass true to buildNextStep call in cancelPayment

const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.APPROVED, undefined, true);

@Gonals
Copy link
Contributor

Gonals commented Feb 19, 2024

"Cancel" was a new feature implemented in #34719 - @Gonals mind tackling this one please? Looks like CancelPayment needs some reportNextStep Onyx data

Seems like it! Taking a look!

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Hourly KSv2 labels Feb 19, 2024
@chiragsalian chiragsalian removed the DeployBlockerCash This issue or pull request should block deployment label Feb 19, 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 Feb 19, 2024
@melvin-bot melvin-bot bot changed the title [$500] Cancel payment - "Next step" does not update after cancelling payment until page is refreshed [HOLD for payment 2024-02-26] [$500] Cancel payment - "Next step" does not update after cancelling payment until page is refreshed Feb 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

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

Copy link

melvin-bot bot commented Feb 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 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 2024-02-26. 🎊

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

Copy link

melvin-bot bot commented Feb 19, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] 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:
  • [@parasharrajat] A discussion in #expensify-bugs 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:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@rayane-djouah
Copy link
Contributor

Am I eligible for a bounty for my proposal?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 26, 2024
Copy link

melvin-bot bot commented Feb 26, 2024

Payment Summary

Upwork Job

BugZero Checklist (@isabelastisser)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1758514115060043776/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@parasharrajat
Copy link
Member

I didn't review the PR.

@isabelastisser
Copy link
Contributor

@amyevans @Gonals was this fixed internally in this PR? I'm trying to figure out if payment needs to be processed here. Thanks!

@Gonals
Copy link
Contributor

Gonals commented Feb 27, 2024

It was fixed internally here, yep

@isabelastisser
Copy link
Contributor

Thanks @Gonals! All set, closing.

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

8 participants