add LastPlanAddedDate__c value to all new subs to allow accurate cooling off period #7040
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
reminder: Before merging - add the custom field in Zuora PROD
We refund supporter plus subscriptions if they are cancelled within 14 days of taking out (or switching)
This means that we need to determine the date they are taken out or last switched accurately.
At the moment, we use the charge Effective start date, however that gets updated every time there's any amendment (switch, renewal, price rise, etc etc)
Having done some research, it doesn't seem easy to find the date of the first amendment that added a given rate plan (not to mention that price rises and migrations don't count). It would be possible to follow the chain of amendments, or query all the subscriptions with the same name and check the charges, or even run an export zoql query asynchronously.
However, another solution it just to store the value on the subscription or charge as a custom field, and update it at any point where they become eligiible for any kind of refund window.
I have added a field in zuora sandbox on Subscription called LastPlanAddedDate__c

I didn't put it on plan in the end, because if we do a price rise or migration, we should ideally copy it over. And we only put one plan on a subscription, so we can get away with putting it at that level.
This PR makes main site acqusisition add the field to all subscriptions when they are taken out. It's only needed on S+ at present, but it makes enough sense for all subscriptions to include by default. It is the date the agreement is made, rather than the first payment date.
Everything is open to question at this stage including the field name and even the whole approach, so please comment anything and everything.
Tested in sandbox locally

https://apisandbox.zuora.com/platform/subscriptions/71a1431927d970b055171cb4b74b1069
Followup work