-
Notifications
You must be signed in to change notification settings - Fork 72
Ensure meta to be excluded from subscriptions #11104
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
base: develop
Are you sure you want to change the base?
Ensure meta to be excluded from subscriptions #11104
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: 0 B Total Size: 873 kB ℹ️ View Unchanged
|
…ta-need-to-be-excluded-from-subs
…ta-need-to-be-excluded-from-subs
mgascam
left a comment
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.
Thanks for working on this @rtio! I've tested the 3DS failure scenario but I'm seeing a different pattern than described in the Linear issue 🤔
This is how I tested:
- Attempted checkout with 3DS card - failed authentication multiple times
- Switched to non-3DS card and completed payment successfully
- Checked database metadata
What I Found
Successful Order:
_intent_id:pi_3SUOiVR1trR43mlO1mtVDFcF_intention_status:succeeded✅
Subscription:
_intent_id:pi_3SUOeKR1trR43mlO2aKQHrdk❌ (different intent - from failed attempt)_intention_status:requires_payment_method❌- Plus all other excluded metadata from the failed attempt
WOOPMNT-5356 states:
"When a new one is created, the Subscription's Data Copier copy_data() ends up copying the first intent ID in parent order to the Subscription"
What I observed:
- Order and subscription have different intent IDs
- This suggests metadata wasn't copied from the order via
copy_data() - Instead, it appears to be written directly during failed subscription creation and never cleaned up
Perhaps both scenarios exist?
- Scenario A: copy_data() copies stale intent from order → subscription (original issue)
- Scenario B: Direct writes during subscription creation that are never cleaned up (what I observed)
Fixes WOOPMNT-5356
Changes proposed in this Pull Request
Keep in mind that I wasn't able to properly reproduce the behavior. On the other hand, the code I'm adding should be harmless.
Another observation, review the first commit to avoid getting confused by the phpcs fixes on this files
When a subscription is added to cart and 3DS authentication fails, WooCommerce Subscriptions deletes the previous pending subscription and creates a new one. During this process, the Subscription's Data Copier allegedly copies stale intent-related metadata from the parent order to the subscription.
This PR attempts to ensure we filter the data we copy properly.
Keys Excluded
The following WooPayments meta keys are now excluded from subscription data copying:
_intent_id,_intention_status,_wcpay_intent_currency_payment_method_id,_charge_id,_wcpay_payment_method_details_stripe_customer_id,_wcpay_fraud_*_wcpay_refund_*_wcpay_transaction_fee_wcpay_modeTesting instructions
Steps:
Expected Results:
_intent_id,_intention_status, etc. from failed attemptnpm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge