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 payment method detachment in live mode #3580

Merged
merged 5 commits into from
Nov 5, 2024

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Nov 4, 2024

Fixes #3582

Changes proposed in this Pull Request:

This PR fixes some issues that may happen with staging sites detaching payment methods from production accounts. Basically, some additional checks were added before detaching a payment method (with the new checkout experience enabled).

Testing instructions

  1. Create a WooCommerce Subscription
  2. Subscribe to a service with a test user
  3. Login to the dashboard.stripe.com and confirm that the Customer was created and has a Payment Method in place
  4. Setup a clone of that site, e.g. with WP Staging.
  5. Check if Stripe is connected on the clone. It might have to be re-connected given the new Stripe connection flow/mechanism.
  6. From WP Admin panel of the clone site, go to Users and delete the customer you created on Step 2.
  7. Go back to the Stripe Dashboard and look for the Customer. On this branch (fix/pm-dettachment-in-live-mode) the payment method will not be detached

  • 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

cc @grig-23

@wjrosa wjrosa self-assigned this Nov 4, 2024
@wjrosa wjrosa marked this pull request as ready for review November 4, 2024 17:50
@wjrosa wjrosa requested review from a team and mattallan and removed request for a team November 4, 2024 17:53
Copy link
Contributor

@mattallan mattallan left a comment

Choose a reason for hiding this comment

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

Nice changes @wjrosa! I don't have live saved payment methods to fully test this however I mocked various configurations by setting WP_ENVIRONMENT_TYPE and hard coding the 'testmode' pulled from settings.

Confirmed cards were not removed when environment was set to 'development' and stripe was in live mode.

@wjrosa wjrosa merged commit d6c5821 into develop Nov 5, 2024
34 of 35 checks passed
@wjrosa wjrosa deleted the fix/pm-dettachment-in-live-mode branch November 5, 2024 12:32
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.

Payment Method is detached after WordPress user is deleted on a cloned site
2 participants