-
Notifications
You must be signed in to change notification settings - Fork 51
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(ras): sync purchase data only for most recent order/subscription #3086
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.
In my testing, only the "total paid" field gets updated*. I've two products with different prices:
- Add subscription w/ product A -> ESP updated as expected
- Add subscription w/ product B -> only "total paid" field updated
- Cancel subscription for product A -> only "end date" is updated
In other words, fields don't get overwritten, only previously empty fields are updated.
* by which I mean both what I see in ESP (AC) and the value of $metadata
here:
newspack-plugin/includes/reader-revenue/woocommerce/class-woocommerce-connection.php
Line 367 in 4df766b
$metadata = array_merge( $order_metadata, $metadata ); |
@adekbadek hmm, I can't replicate this. Are your subscription products set to both "virtual" and "downloadable"? If not, their orders might be stuck in "processing" status, and they won't be found by the method that looks for the last completed order ( |
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.
Are your subscription products set to both "virtual" and "downloadable"? If not, their orders might be stuck in "processing" status, and they won't be found
That was it! One of my test products was not "downloadable". Works fine now!
## [3.8.3](v3.8.2...v3.8.3) (2024-05-13) ### Bug Fixes * **ras:** sync purchase data only for most recent order/subscription ([#3086](#3086)) ([2c7763a](2c7763a))
🎉 This PR is included in version 3.8.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [4.0.0-alpha.4](v4.0.0-alpha.3...v4.0.0-alpha.4) (2024-05-15) ### Bug Fixes * autocomplete orders only for virtual products ([#3111](#3111)) ([bfbe554](bfbe554)) * **google-login:** get the email from the /tokeninfo endpoint ([#3117](#3117)) ([3296f1a](3296f1a)) * **google-oauth:** use a custom table for transients ([#3106](#3106)) ([d4a2f5c](d4a2f5c)) * **oauth-transients:** remove redundant cleanup ([#3112](#3112)) ([c123c02](c123c02)) * **ras:** sync purchase data only for most recent order/subscription ([#3086](#3086)) ([2c7763a](2c7763a))
🎉 This PR is included in version 4.0.0-alpha.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 4.0.0-epic-ras-acc.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Tweaks the reader data sync behavior so that any purchase-related fields only relate to the reader's most recent active order/subscription, if any. It's possible for a single reader to have more than one subscription in different states, so in this case an active one should take precedence when it comes to contact data in the connected ESP.
How to test the changes in this Pull Request:
release
, log in as the reader in a new session.NP_Current Subscription End Date
will reflect the time you changed the status of the cancelled subscription in step 3, but theNP_Membership Status
,NP_Billing Cycle
,* Payment Date
fields, etc. will all reflect the more recent active one.NP_Current Subscription End Date
has been emptied out (because there's an active subscription, so there shouldn't be an end date).Other information: