Skip to content

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
mainfrom
feat/payment-gated-subs-3/apply-activation-rules-on-starting-in-the-future-upgrades
Open

feat(payment-gated-subs): Apply activation rules on upgrade of a subscription starting in the future#5506
osmarluz wants to merge 1 commit into
mainfrom
feat/payment-gated-subs-3/apply-activation-rules-on-starting-in-the-future-upgrades

Conversation

@osmarluz
Copy link
Copy Markdown
Contributor

@osmarluz osmarluz commented May 13, 2026

Context

First slice of Milestone 3 (Upgrade Path). Subscriptions::PlanUpgradeService currently ignores params[:activation_rules]; on an upgrade of a starting_in_the_future? subscription, rules should land on the pending subscription so ActivateService evaluates them when the activation date arrives — same lifecycle as a new subscription with rules.

Description

  • Subscriptions::PlanUpgradeService calls Subscriptions::ActivationRules::ApplyService against the current subscription in the starting_in_the_future? branch when params[:activation_rules] is provided.

@osmarluz osmarluz changed the title feat(payment-gated-subs): Apply activation rules on upgrade of a starting_in_the_future subscription feat(payment-gated-subs): Apply activation rules on upgrade of a subscription starting in the future May 13, 2026
@osmarluz osmarluz requested a review from ancorcruz May 13, 2026 14:53
Copy link
Copy Markdown
Contributor

@ancorcruz ancorcruz left a comment

Choose a reason for hiding this comment

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

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]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this and the update_pending_subscription call should be wrapped within a transaction to ensure atomicity on the rules application and subscription update.

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