Skip to content
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

compute the doNotProcessUntil timespan for cancellation saves #1099

Merged
merged 5 commits into from
Nov 28, 2024

Conversation

shtukas
Copy link
Contributor

@shtukas shtukas commented Nov 28, 2024

This updates the logic of the interaction between subscriptions in "cancellation save" status and a pending price migration, a feature that we added for Supporter+ 2024.

In this update the time that the item is going to wait before being re-estimated, is computed as a function of the billing period. In essence we want to wait (at least) two billing periods before notifying the user of a price migration, instead of 6 months.

@shtukas shtukas requested a review from a team as a code owner November 28, 2024 13:40
@@ -79,16 +79,30 @@ object NotificationHandler extends CohortHandler {
item: CohortItem,
subscription: ZuoraSubscription
): ZIO[CohortTable with Zuora, Failure, Unit] = {
// Known keys for this mapping can be found in the BillingPeriod object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not very important, but a more robust approach is to use BillingPeriod.fromString and have an exhaustive pattern match instead of a Map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you are right, let me do that....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrf1
That one did the trick :)
6e16895

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I was imagining a match on BillingPeriod -

def billingPeriodToInt(period: BillingPeriod): Int =
  period match {
    case Monthly => 1
    case Quarterly => 3
    case SemiAnnual => 6
    case Annual => 12
  }

So that you can call:
BillingPeriod.billingPeriodToInt(BillingPeriod.fromString(billingPeriod))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrf1
This one: 1717f95 :)

Copy link
Member

@tomrf1 tomrf1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shtukas shtukas merged commit 373347f into main Nov 28, 2024
3 checks passed
@shtukas shtukas deleted the ph-20241128-1330-splus branch November 28, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants