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

[WIP] Clarify the difference in active vs valid states #511

Closed
wants to merge 1 commit into from
Closed

[WIP] Clarify the difference in active vs valid states #511

wants to merge 1 commit into from

Conversation

@timacdonald
Copy link
Contributor

@timacdonald timacdonald commented May 5, 2018

Been using this on my latest project and found it fantastic to work with.

One hurdle I ran into was understanding the difference in active() vs valid() states for subscriptions. In trying to understand them I made this:

Trial Trial + Cancelled Recurring Recurring + Cancelled Cancelled [ended]
onTrial()
active()
valid()
cancelled()
onGracePeriod()

Unless I am missing a potential state a subscription can be in - it seems that these methods will always return the same thing. The tests in this PR also pass - which confirm the results in the table.

My thinking is that an "active" subscription is one that you are going to make money off - i.e. it is going to renew.

A "valid" subscription is any subscription that has not ended, i.e. all active subscriptions and all subscriptions on a grace period.

Unless I'm missing something else - I think it would be good to fix the methods in the package and adjust the PR'd tests to match.

If you agree with my thinking let me know and I'll submit the fixes for you - otherwise I'm more than happy to adjust with your guidance on what active vs valid means to Cashier.

This has been submitted to master as I am unsure if the fix (if wanted) would be a breaking change or a bug fix.

@timacdonald
Copy link
Contributor Author

@timacdonald timacdonald commented May 6, 2018

I should add that I'm happy to wind these tests into the existing tests - I just wanted to put them all together so it was clear what was happening.

@taylorotwell
Copy link
Member

@taylorotwell taylorotwell commented May 6, 2018

I don't think active and valid are even documented in the Cashier documentation as something you should be calling and there aren't really something I call when building an application that uses Cashier. The documented "state" methods are subscribed, cancelled, onGracePeriod, onTrial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants