Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

[Search v1.2] - Pay button can be clicked many times without error when bank account is not set up #52371

Open IuliiaHerets opened 4 days ago

IuliiaHerets commented 4 days ago

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: 9.0.60-0 Reproducible in staging?: Y Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Email or phone of affected tester (no customers): applausetester+kh011102@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Submit an expense.
  4. Go to Search.
  5. Click Pay.
  6. Click on the dropdown.
  7. Select Pay with Expensify (select the same option even when the button shows Pay with Expensify).
  8. Close the RHP.
  9. Click Pay button.

Expected Result:

There should be a message informing that the payment cannot be carried out because bank account is not set up.

Actual Result:

The pay button can be clicked several times and there is no error message at all.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/68c2020e-780e-414b-8dd0-e76af71ca812

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @luacmartins
melvin-bot[bot] commented 4 days ago

Triggered auto assignment to @greg-schroeder (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.

melvin-bot[bot] commented 4 days ago

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

melvin-bot[bot] commented 4 days ago

💬 A slack conversation has been started in #expensify-open-source

github-actions[bot] commented 4 days ago

:wave: 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.
rlinoz commented 4 days ago

Probably related to this PR https://github.com/Expensify/App/pull/51445

But I am not sure we have a pattern for showing errors in Search, checking here https://expensify.slack.com/archives/C01GTK53T8Q/p1731409542501669

rlinoz commented 4 days ago

We are adding RBR in another PR https://github.com/Expensify/App/pull/52333 and this is still under construction, so we don't need to block on this and can close it.

etCoderDysto commented 4 days ago

Proposal

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

Pay button can be clicked many times without error when bank account is not set up

What is the root cause of that problem?

Here we are only check for if lastPolicyPaymentMethod is not undefined before we call payMoneyRequestOnSearch. https://github.com/Expensify/App/blob/cd3f30f73a18c29532d6886b4bb3744fd700ab9d/src/libs/actions/Search.ts#L46 When user selects Pay with Expensify on step 7, lastPolicyPaymentMethod becomes 'ACH' payMoneyRequestOnSearch will be called. And the payment won't be settled since Pay with Expensify is not configured

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

Instead we should call payMoneyRequestOnSearch if lastPolicyPaymentMethod is equal to Elsewhere or if the user has an expensify payment method configured

const [fundList = {} ] = useOnyx(ONYXKEYS.FUND_LIST);
const [bankAccountList = {}] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);

const hasExpensifyPaymentMethod = PaymentUtils.hasExpensifyPaymentMethod(paymentCardList, bankAccountList, false))

lastPolicyPaymentMethod === 'Elsewhere' || hasExpensifyPaymentMethod ? payMoneyRequestOnSearch(hash, [{reportID: item.reportID, amount, paymentType: lastPolicyPaymentMethod}], transactionID) : goToItem();

What alternative solutions did you explore? (Optional)

luacmartins commented 3 days ago

I'll reopen this issue and assign it to me so I can make sure it's fixed in my PR

melvin-bot[bot] commented 3 days ago

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

melvin-bot[bot] commented 3 days ago

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

If no regressions arise, payment will be issued on 2024-11-20. :confetti_ball:

melvin-bot[bot] commented 3 days ago

@rlinoz / @luacmartins @greg-schroeder @rlinoz / @luacmartins 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]

luacmartins commented 2 days ago

@rlinoz @greg-schroeder we fixed the issue via a revert. I'll unassign you but keep the issue open to make sure I address it in the v2 of my PR

melvin-bot[bot] commented 2 days ago

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

If no regressions arise, payment will be issued on 2024-11-21. :confetti_ball:

melvin-bot[bot] commented 2 days ago

@luacmartins @luacmartins 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]