rinvex/laravel-subscriptions

[Proposal] Making it possible to extend the current subsciption period

wojciechgabrys opened this issue · 1 comments

Hello,

I'd like to propose a new feature that would fix #66 by allowing to extending an existing subscription (by keeping its remaining period and adding a new interval to the end) instead of starting a new interval the moment the renew() method is called.

Current problem

  1. January 1st: The user starts a new monthly subscription that ends on February 1st.
  2. January 20th: User gets notified about the upcoming end of the subscription
  3. January 20th: User renews the subscription
  4. January 20th: Backend executes $user->subscription('main')->renew();. The user's subscription expiration date is set a month into the future – it will end on February 20th.

By renewing early, the user lost 10 days of his subscription.

Proposed solution:

Adding new API: $user->subscription('main')->extend();

  1. January 1st: The user starts a new monthly subscription that ends on February 1st.
  2. January 20th: User gets notified about the upcoming end of the subscription
  3. January 20th: User renews the subscription
  4. January 20th: Backend executes $user->subscription('main')->extend();. The user's subscription expiration date is set a month into the future based on its current expiration date (February 1st + 1 month = March 1st).

Despite renewing early, the user doesn't get punished and keeps all of the days of his subscription (that's already paid for).

Hope you like the idea – please let me know if you'd be willing to accept a PR for this feature.

Thank you for your time and all of the hard work that you've put into this package ❤️

Thank you @wojciechgabrys for your detailed proposal, I like it, and I agree that we need this logic.

I would be happy to consider any PRs adjusting the current logic to accommodate this new feature. Any help would be appreciated.