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

Fix duplicate token retrieval by using the correct payment method ID #4038

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ricardo
Copy link
Member

@ricardo ricardo commented Mar 11, 2025

This PR fixes an issue where duplicate payment tokens were being created for non-card payment methods due to an incorrect payment gateway ID being used. Previously, tokenization worked correctly only for card payments but failed for other reusable payment methods like ACH or ACSS (in progress).

Changes proposed in this Pull Request:

  • Ensure the correct payment gateway ID is used for token retrieval.
  • Prevent duplicate payment methods from being saved in "My Account" and during checkout.

Testing instructions

Test 1: Reproducing the issue (on develop)

  1. Switch to develop.
  2. Add a product to the cart and proceed to checkout.
  3. Select a reusable payment method other than card (e.g., ACH).
  4. Enable "Save payment information to my account for future purchases.".
  5. Complete the checkout.
  6. Repeat steps 2–5.
  7. Navigate to My Account > Payment Methods or return to checkout and observe that the payment method has been duplicated.
  8. Delete the duplicated payment methods from My Account.
  9. Add the payment methods again through My Account and observe that the duplication issue also happens from My account.

Test 2: Verify the Fix (on this branch)

  1. Switch to this branch.
  2. Repeat the same steps as Test 1 from checkout and from My Account.
  3. Observe that the payment method is no longer duplicated.

Test 3: Ensure No Regressions (Card payments)

  1. Switch to this branch.
  2. Add a product to the cart and proceed to checkout.
  3. Select the card payment method and enable "Save payment information to my account for future purchases.".
  4. Complete the checkout process.
  5. Repeat steps 2–4.
  6. Verify that the card payment method is stored correctly without duplication.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@ricardo ricardo self-assigned this Mar 11, 2025
@ricardo ricardo requested review from a team and cesarcosta99 and removed request for a team March 11, 2025 15:51
@ricardo
Copy link
Member Author

ricardo commented Mar 11, 2025

Setting an estimate of 1 as this took me some time to troubleshoot.

@bborman22 bborman22 requested review from bborman22 and removed request for cesarcosta99 March 12, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant