Describe the bug
The WC_Stripe_Subscriptions_Repairer_Legacy_SEPA_Tokens class to repair subscriptions using Legacy SEPA tokens must only be loaded when there are subscriptions to be repaired.
Currently, we always initialize this class on init. This is suboptimal given that there will be a point when no subscription is using a Legacy SEPA token.
When working on this issue, keep in mind that this repaired class must still be available when there are actions scheduled because this class contains their callbacks. The scheduled actions are wc_stripe_schedule_subscriptions_legacy_sepa_token_repairs and wc_stripe_subscriptions_legacy_sepa_token_repair.
To Reproduce
Steps to reproduce the behavior:
Enable WC Subscriptions
Ensure none of the subscriptions use a Legacy SEPA token
Notice that the repairer class is still initialized
Expected behavior
When there are no subscriptions using a Legacy SEPA token as its payment method, the repairer class must not be loaded.
When doing regression tests for the actual repairing, we can change the value of the payment_method to stripe_sepa of the subscriptions we want to repair in the wc_orders table, instead of following the full steps from this other PR.
Describe the bug The WC_Stripe_Subscriptions_Repairer_Legacy_SEPA_Tokens class to repair subscriptions using Legacy SEPA tokens must only be loaded when there are subscriptions to be repaired.
Currently, we always initialize this class on
init
. This is suboptimal given that there will be a point when no subscription is using a Legacy SEPA token.When working on this issue, keep in mind that this repaired class must still be available when there are actions scheduled because this class contains their callbacks. The scheduled actions are
wc_stripe_schedule_subscriptions_legacy_sepa_token_repairs
andwc_stripe_subscriptions_legacy_sepa_token_repair
.To Reproduce Steps to reproduce the behavior:
Expected behavior
When there are no subscriptions using a Legacy SEPA token as its payment method, the repairer class must not be loaded.
Additional context
Follow-up issue for the review by @james-allan in https://github.com/woocommerce/woocommerce-gateway-stripe/pull/3139#issuecomment-2174502742
When doing regression tests for the actual repairing, we can change the value of the
payment_method
tostripe_sepa
of the subscriptions we want to repair in thewc_orders
table, instead of following the full steps from this other PR.