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

Remove APM payment methods in Stripe when their tokens are deleted locally #2902

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

a-danae
Copy link
Contributor

@a-danae a-danae commented Feb 14, 2024

Fixes #2898

Changes proposed in this Pull Request:

  • Keep a static array with the names of our reusable gateways.
  • When UPE is enabled, check whether the token belongs to our reusable gateways, instead of only checking whether it belongs to the main gateway.

Testing instructions

  1. Enable Woo Subscriptions
  2. Enable an the iDeal APM
  3. Purchase a subscription product using iDeal
  4. Confirm the new iDeal token is saved in your wc_woocommerce_payment_tokens table
  5. Navigate to the Stripe dashboard (https://dashboard.stripe.com/test/customers/cus_XXXXXXX) and confirm the new iDeal/SEPA payment method in the list of the customers payment methods
  6. Navigate to My Account > Payment methods
  7. Delete the iDeal token (listed as SEPA IBAN)
  1. Navigate to the Stripe dashboard (https://dashboard.stripe.com/test/customers/cus_XXXXXXX)
  2. Confirm the iDeal/SEPA payment method was deleted

Test again using Bancontact and SEPA (and Sofort, once it's included in the base branch).


  • 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

Before, we were only checking it belonged to the main gateway. Since Split PE, APMs have their own gateway so we needed to change this check
@a-danae a-danae marked this pull request as ready for review February 14, 2024 16:33
@a-danae a-danae requested a review from Mayisha February 14, 2024 16:33
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 @a-danae! Code looks good!

  • Tested deleting an APM method
  • Tested deleting a refular Stripe card

@a-danae a-danae merged commit 9516976 into fix/2872-dPE-APM-subscription-support Feb 15, 2024
32 checks passed
@a-danae a-danae deleted the fix/delete-apm-tokens branch February 15, 2024 01:18
james-allan added a commit that referenced this pull request Feb 15, 2024
…rred intent (#2883)

* Add support flags to Stripe UPE methods

* Set the wc-stripe-is-deferred-intent flag when processing payments via tokens on the block checkout

* Add bancontact and ideal to the list of gateways that require a mandate

* Set the subscriptions payment method ID when setting the payment token source

* Fix saved tokens for APMs like iDEAL, Bancontact and SEPA

* fix typo and fetch the payment method object

* Make sure to pass offsession flag to block payment elements if the cart contains a subs
cription or saved tokens are enabled

* Set the payment method ID on the subscription when the payment method is updated

* Set the order and subscription payment method to the upe gateway's ID

* Map payment method to the gateway ID should be recorded on the subscription

* Set payment method title and ID to the APM used

* Make sure UPE methods can call methods on the main instance of the UPE gateway

* Fix undefined $name error

* Reinstate the process payment function for upe methods

* Only attach hooks in the subscriptions trait once

* Process UPE payment method refunds via the UPE gateway

* Always use the source object's payment type when processing off session payments

* Use new helper function for determining the payment method id of a upe method object

* Remove APM payment methods in Stripe when their tokens are deleted locally (#2902)

* Check whether the deleted token belongs to a reusable gateway

Before, we were only checking it belonged to the main gateway. Since Split PE, APMs have their own gateway so we needed to change this check

* Move the try/catch blocks up in the method

* Add Bancontact, Ideal, and Sofort to the static list of reusable gateways

* Add subscription support for Sofort

* Add multiple subscription support flags to Bancontact, iDEAL, Sofort methods

---------

Co-authored-by: Danae Millan <41606954+a-danae@users.noreply.github.com>
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.

2 participants