Skip to content

[HOLD] [$1000] Payments - Option "Make default payment method" is unavailable for PayPal #23565

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com 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

Activity

  1. added
    Daily
    Bug
    on Jul 25, 2023
  2. melvin-bot commented on Jul 25, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 25, 2023

    @melvin-bot

    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
  4. samh-nl commented on Jul 25, 2023

    @samh-nl
    Contributor

    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

  5. added
    External
    on Jul 26, 2023
  6. changed the title [-]Payments - Option "Make default payment method" is unavailable for PayPal[/-] [+][$1000] Payments - Option "Make default payment method" is unavailable for PayPal[/+] on Jul 26, 2023
  7. melvin-bot commented on Jul 26, 2023

    @melvin-bot
  8. added
    Help Wanted
    on Jul 26, 2023
  9. melvin-bot commented on Jul 26, 2023

    @melvin-bot

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

  10. melvin-bot commented on Jul 26, 2023

    @melvin-bot

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

  11. dylanexpensify commented on Jul 28, 2023

    @dylanexpensify
    Contributor

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

  12. dylanexpensify commented on Jul 31, 2023

    @dylanexpensify
    Contributor
  13. kaushiktd commented on Aug 2, 2023

    @kaushiktd
    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

  14. melvin-bot commented on Aug 2, 2023

    @melvin-bot

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

  15. dylanexpensify commented on Aug 3, 2023

    @dylanexpensify
    Contributor

    bumping in slack c+ channel

  16. 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[/+] on Aug 3, 2023
  17. dylanexpensify commented on Aug 3, 2023

    @dylanexpensify
    Contributor

    Paypal element being discussed

  18. dylanexpensify commented on Aug 8, 2023

    @dylanexpensify
    Contributor

    Closing since no paypal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions