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

Group subscriptions by subscription configurations #2

Merged
merged 8 commits into from
Feb 3, 2017

Conversation

qr8r
Copy link
Contributor

@qr8r qr8r commented Feb 3, 2017

When creating subscriptions from a collection of line items, ensure that the subscription line items all have compatible configuration values ( interval, end date, etc)

Create a new subscription for each group of similarly configured subscription line items

Brendan Deere added 8 commits February 3, 2017 10:08
:end_date, :interval_length and :interval_units are stored on the
subscription line items before the order is completed.

Once the order is completed we want a canonical source for these values.
These values will now be stored on the subscription itself, once it is
created
Add a method to group subscription line items by their subscription
configuration attributes:

- interval_length
- interval_units
- max_installments

This method should be used to group an order's subscription_line_items
into groups which can be fulfilled by a single subscription.
When creating subscriptions, persist the configuration values present on
the subscription_line_items on the subscription itself
Intervals have previously been stored as an enum on the
subscription_line_item model. They will now also be stored on the
subscription model.

Both models need to understand and calculate these durations in exactly
the same way.

This commit extracts the enum, validations and supporting methods into a
module which can be shared between these two models.
A separate subscription should be created for each group of similar
subscription line items.

ex. subscription line items with different fulfillment intervals cannot
be fulfilled by the same subscription. But if the line items have all
the same subscription configuration option, they can be fulfilled by the
same subscription
When referenced as a variable in specs
Add a spec to test that the checkout is successful when the subscription
includes multiple line items
@qr8r qr8r force-pushed the group_subscriptions_by_subscription_configurations branch from 1053102 to 48decc5 Compare February 3, 2017 18:08
@qr8r qr8r merged commit 003cf2e into master Feb 3, 2017
@qr8r qr8r deleted the group_subscriptions_by_subscription_configurations branch February 3, 2017 19:26
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.

1 participant