feat(payment-gated-subs): Apply activation rules on upgrade of a subscription starting in the future#5506
Open
osmarluz wants to merge 1 commit into
Conversation
…ting_in_the_future subscription
ancorcruz
approved these changes
May 25, 2026
Contributor
ancorcruz
left a comment
There was a problem hiding this comment.
I'm approving this PR but it should not be merged without first wrapping the apply_activation_rules call along with the update_pending_subscription call in a database transaction to ensure the changes are atomic.
|
|
||
| def call | ||
| if current_subscription.starting_in_the_future? | ||
| apply_activation_rules if params[:activation_rules] |
Contributor
There was a problem hiding this comment.
this and the update_pending_subscription call should be wrapped within a transaction to ensure atomicity on the rules application and subscription update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
First slice of Milestone 3 (Upgrade Path).
Subscriptions::PlanUpgradeServicecurrently ignoresparams[:activation_rules]; on an upgrade of astarting_in_the_future?subscription, rules should land on the pending subscription soActivateServiceevaluates them when the activation date arrives — same lifecycle as a new subscription with rules.Description
Subscriptions::PlanUpgradeServicecallsSubscriptions::ActivationRules::ApplyServiceagainst the current subscription in thestarting_in_the_future?branch whenparams[:activation_rules]is provided.