fix(subscription upgrade): Upgrade subscriptions previously considered downgrade on amount increase #2823
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
Currently, when a user updates the subscription fee amount for a plan associated with a pending downgrade (scheduled to activate at the end of the billing period), the system does not treat the pending subscription as an upgrade. As a result, the new subscription is not activated, and the previous one is not terminated.
Description
This change extracts the subscription upgrade logic into a dedicated service, ensuring it can be consistently applied across flows that trigger subscription upgrades. Currently, this includes plan updates and initial subscription creation.
An additional edge case, involving plan subscription overrides, is not addressed in this PR. Handling this scenario introduces extra technical and product complexities that require further consideration.