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] [$1000] Payments - Option "Make default payment method" is unavailable for PayPal #23565

Closed
6 tasks done
kbecciv opened this issue Jul 25, 2023 · 13 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

@kbecciv
Copy link

kbecciv commented Jul 25, 2023

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


Issue found when executing PR #22886

Action Performed:

  1. Open the staging link
  2. Open Settings > Payments
  3. Click on PayPal method or add a new one
  4. Observe available options

Expected Result:

"Make default payment method" button should be available in popup menu

Actual Result:

Option "Make default payment method" is unavailable for PayPal

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.45.1
Reproducible in staging?: y
Reproducible in production?: y
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
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0153c1b5e7c672cc31
  • Upwork Job ID: 1684138148357074944
  • Last Price Increase: 2023-08-02
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot
Copy link

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

@samh-nl
Copy link
Contributor

samh-nl commented Jul 25, 2023

Proposal

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

The "Make default payment option" is unavailable for PayPal.

What is the root cause of that problem?

When rendering the "Make default payment method" option, an exception is made for PayPal, leading shouldShowMakeDefaultButton to become false.

const isPayPalMeSelected = this.state.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.PAYPAL;
const shouldShowMakeDefaultButton =
!this.state.isSelectedPaymentMethodDefault &&
Permissions.canUseWallet(this.props.betas) &&
!isPayPalMeSelected &&
!(this.state.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.BANK_ACCOUNT && this.state.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS);

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

To enable this option for PayPal, shouldShowMakeDefaultButton should return true when this payment method has been selected. For even padding between the buttons, we need to apply styles.mb4 to the button and remove styles.mt4 from the Delete button.

Secondly, we need to implement a condition for PayPal in the makeDefaultPaymentMethod function, where we should pass the account:

if (this.state.selectedPaymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) {
PaymentMethods.makeDefaultPaymentMethod(this.state.selectedPaymentMethod.bankAccountID, null, previousPaymentMethod, currentPaymentMethod);
} else if (this.state.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) {
PaymentMethods.makeDefaultPaymentMethod(null, this.state.selectedPaymentMethod.fundID, previousPaymentMethod, currentPaymentMethod);
}

Lastly, PaymentMethods.getMakeDefaultPaymentOnyxData must be adjusted to add the PayPal type and account here:

walletLinkedAccountID: bankAccountID || fundID,
walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD,

And use the appropriate payment methods here:

key: previousPaymentMethod.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.CARD_LIST,

key: currentPaymentMethod.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.CARD_LIST,

What alternative solutions did you explore? (Optional)

N/A

@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2023
@melvin-bot melvin-bot bot changed the title Payments - Option "Make default payment method" is unavailable for PayPal [$1000] Payments - Option "Make default payment method" is unavailable for PayPal Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

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

melvin-bot bot commented Jul 26, 2023

Current assignee @dylanexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jul 27, 2023
@dylanexpensify
Copy link
Contributor

@eVoloshchak let's get the proposal above reviewing today! 🙌

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 28, 2023
@dylanexpensify
Copy link
Contributor

bump @eVoloshchak

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@kaushiktd
Copy link
Contributor

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

Payments - Option "Make default payment method" is unavailable for PayPal

What is the root cause of that problem?

When you are selecting PayPal payment option shouldShowMakeDefaultButton condition is not match for PayPal, it is only checking with BANK_ACCOUNT on here.

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

We need to add a new condition that if the user selects PayPal then shouldShowMakeDefaultButton value should be true to make the default payment button visible. Need to change condition like below: just check isPayPalMeSelected value

const shouldShowMakeDefaultButton = isPayPalMeSelected ? true :
        !paymentMethod.isSelectedPaymentMethodDefault &&
        Permissions.canUseWallet(props.betas) &&
        !isPayPalMeSelected &&
        !(paymentMethod.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.BANK_ACCOUNT && paymentMethod.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS);

also, you need to add a condition to make payment default on the below file:
https://github.com/Expensify/App/blob/main/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js#L245

else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PAYPAL) {
            PaymentMethods.makeDefaultPaymentMethod(paymentMethod.selectedPaymentMethodType, null, previousPaymentMethod, currentPaymentMethod);
        }

after that, PaymentMethods.getMakeDefaultPaymentOnyxData need to be adjusted according to PayPal type on below mentions file:
location-1
location-2
location-3

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Aug 2, 2023
@dylanexpensify
Copy link
Contributor

bumping in slack c+ channel

@melvin-bot melvin-bot bot removed the Overdue label Aug 3, 2023
@dylanexpensify dylanexpensify changed the title [$1000] Payments - Option "Make default payment method" is unavailable for PayPal [HOLD] [$1000] Payments - Option "Make default payment method" is unavailable for PayPal Aug 3, 2023
@dylanexpensify
Copy link
Contributor

Paypal element being discussed

@melvin-bot melvin-bot bot added the Overdue label Aug 7, 2023
@dylanexpensify
Copy link
Contributor

Closing since no paypal

@melvin-bot melvin-bot bot removed the Overdue label Aug 8, 2023
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. Daily KSv2 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

5 participants