-
Notifications
You must be signed in to change notification settings - Fork 207
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 subscription processing with mandates #3359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work This PR perfectly fixed the issue of switching variable subscriptions. @wjrosa 🎉
I have noticed a few problems while testing.
- No mandate is created when I use a saved card.
- Renewal fails when the shipping charge of the subscription order and the recurring order are different. Suppose the subscription price is 1000, the initial shipping charge is free and the recurring shipping charge is 20. Then it fails with the following error-
payment_intent_mandate_invalid This mandate can only be used for a payment of 12000. You attempted a payment of 10000.
- The text is wrong when the subscription is not editable.
Approving this PR as I can reproduce the above issues in the develop
branch as well. I will create separate issues to fix them.
@@ -87,6 +87,9 @@ public function maybe_init_subscriptions() { | |||
*/ | |||
add_action( 'template_redirect', [ $this, 'remove_order_pay_var' ], 99 ); | |||
add_action( 'template_redirect', [ $this, 'restore_order_pay_var' ], 101 ); | |||
|
|||
// Disable editing for Indian subscriptions with mandates. Those need to be recreated as mandates does not support upgrades (due fixed amounts). | |||
add_filter( 'wc_order_is_editable', [ $this, 'disable_subscription_edit_for_india' ], 10, 2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good idea. 👍
Thank you, @Mayisha ! I will grab some of these |
Fixes #3230
Changes proposed in this Pull Request:
This PR fixes the processing of subscriptions when using mandates (i.e., when using Indian credit cards).
Testing instructions
Renewal
fix/subscriptions-switch-with-mandates
)Indian Rupee
wp-admin/admin.php?page=wc-settings&tab=subscriptions
develop
branch it should fail* You can force the renewal on the subscription details page (wp-admin) by selecting "Process renewal" in the dropdown box. @james-allan gave some tips on how to easily test this here.
Subscription edit
Indian Rupee
, purchase a subscriptionchangelog.txt
andreadme.txt
(or does not apply)Post merge