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 fingerprint set error on legacy checkout #3743

Merged
merged 6 commits into from
Jan 20, 2025

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Jan 20, 2025

Fixes #3718

Changes proposed in this Pull Request:

This PR fixes a fatal error being thrown when saving payment method tokens with the legacy checkout enabled. The error happens when setting the fingerprint property (used to identify duplicate tokens). The expected object structure was different from the actual format received (fingerprint exists inside the payment method details key, source).

Testing instructions

You can follow the test instructions from the related issue:

  1. Configure a test WP install with the WC, WC Stripe, and WC Subscriptions plugins
  2. Enable Stripe legacy checkout
  3. Add a credit card via the "Payment Methods" page
  4. Purchase a subscription, entering a different credit card during checkout
  5. Using a database admin tool, delete the first credit card you added from wp_woocommerce_payment_tokens to simulate the case where a card is defined in Stripe but not synced to the WC database
  6. Attempt to add another card via the "Payment Methods" page
  7. Confirm no fatal errors are thrown

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@wjrosa wjrosa self-assigned this Jan 20, 2025
@wjrosa wjrosa marked this pull request as ready for review January 20, 2025 15:28
Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good, and testing by deleting the first credit card from the db works as expected.

@wjrosa I'm approving this, but let's revert the spacing fixes/changes before merging.

I'll open a PR to fix the linting checks (and the 19 files that need changes)

includes/payment-tokens/class-wc-stripe-payment-tokens.php Outdated Show resolved Hide resolved
@wjrosa wjrosa merged commit 1e9031d into develop Jan 20, 2025
33 of 37 checks passed
@wjrosa wjrosa deleted the fix/fix-fingerprint-set-error-on-legacy-checkout branch January 20, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants