summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-01-25Change static factory attrs to dynamicfastjames
FactoryBot 5.0 will no longer support static factory attributes, so we need to update our factories in advance to silence the deprecation warnings.
2018-12-12Realign specs and solidus versionsfastjames
Update specs for newer versions of Solidus. This only required one version-specific code branch. I know 2.2 is still not EOL but we can reintroduce it to the matrix separately if people want that.
2018-07-31Update factory_girl to factory_botfastjames
2017-07-24Authorize subscriptions admin sidebar linkBrendan Deere
Only show the admin sidebar link if the user is authorized to see it. Before: The link to the subscriptions area of the subscriptions administrative area would be displayed on the admin login screen. Clicking this link without authenticating would redirect the user to the log in page After: The link to the subscriptions area of the admin is hidden until after the user authenticates
2017-06-09Support Rails 5.1John Hawthorn
2017-05-23Only load permitted attributes onceBrendan Deere
Previous Behaviour: The to_prepare block was reloading the permitted attributes module. This resulted in the subscription parameters being appended to the spree premitted attributes multiple times. New behaviour: Do not auto load the lib directory Only load the permitted attributes once during the initalization process
2017-05-23Ensure user exists when setting CC#default=trueJohn Hawthorn
This is necessary to support the new wallet schema in Solidus 2.2
2017-02-03Add Subscription configuration valuesBrendan Deere
: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
2017-01-12Merge pull request #121 from brendandeere/change_dates_to_date_timesBrendan Deere
Change dates to date times
2017-01-12Subscription actionable_date is a DateTimeBrendan Deere
Migrate away from tracking this value as simply a date and track it as a date time. This gives us more granularity to work with
2017-01-12Deactivate expired subscriptionsBrendan Deere
While processing subscriptions, after the actionalble date has been advanced, if the next actionable date is after the subscriptions#end_date then deactivate the subscription.
2017-01-12Replace max_installments with end_dateBrendan Deere
The max_installments concept of a specific number of times to processa subscription was complicated and diffcult to understand. It was originally meant to allow for subscriptions to be active only for a given periode of time (ie, a 1 years magazine subscription). To better model this behaviour, this column is being changed to :end_date. A date after which the subscription will become inactive and not be processed. If a subscription has no value for this field, it will be processed until some action is taken to stop it (ex. cancelling the subscription).
2017-01-12Subscription ship_address can be updatedBrendan Deere
The api allows subscription shipping addresses to be updated as a nested parameter
2017-01-12Process user subs by addressBrendan Deere
Subscriptions are grouped together by user and and by shipping address. A user has 3 subscriptions (A, B and C). A and B have the same shipping address, but C will be shipped to a different location. The processor will group and process installments for A and B together and they will be fulfilled by the same order. A second order will be created to fulfill C.
2017-01-12Use subscription address for consolidated intallmentBrendan Deere
Try to send the consolidated installment order to the address associated to the subscription and gracefully fallback to then the user
2017-01-12Merge pull request #119 from brendandeere/speed_up_subscription_processing_jobBrendan Deere
Remove some n+1 queries from processing
2017-01-09Remove some n+1 queries from processingBrendan Deere
The processor looks up a number of users, subscriptions and installments and passes them off to an Active Job. Before we were doing a number of n+1 queries and relying on the rails global id when passing objects to the consolidated installments. This commit removes the greedy queries and passes a list of ids to the active job object so that all affected objects can be looked up in a single query
2017-01-09Subs have many subs line itemsBrendan Deere
We are going to support multiple items per subscription. This commit changes the subscription -> subscription_line_item relationship from a has_one to a has_many. Most of the changes here are simply pluralization changes. Somethat are not: Api params now take: `line_items_attributes instead` of `line_item_attributes` for nested params to a subscription `subscription_line_items_attributes` instead of `subscription_line_item_attributes` Only the interval of the first subscription_line_item is considered
2017-01-06Merge pull request #113 from brendandeere/remove_root_orderBrendan Deere
Remove root order
2017-01-06Remove root order referencesBrendan Deere
The subscription must always have an associated user. use the ship address and last default credit cards from the users. And not from the root order which is deprecated
2017-01-06Add user trait to include addressesBrendan Deere
This included in solidus in > v1.1. but for compatibility (and it will likely become more useful as the requirements for a user associated to a subscription grow) I am adding a special trait to the user factory
2017-01-06Subscriptions belong to a storeBrendan Deere
Given that not all subscriptions will have a root order (example: a subscription created by an admin in the admin interface) We should be tracking which store a subscription belongs to on the subscription itself
2017-01-06Spec against Solidus 2.0Brendan Deere
2016-11-03make_subs_permitted_attriubtes_configurableBrendan Deere
2016-10-20Explicitly capture the default gateway blockBrendan Deere
This is more clear as to whats happening than implicitly capturing the block
2016-10-19Installments no longer track their order directlyBrendan Deere
An order is generated with every attept to fulfill the installment. Each installment detail now has its own order
2016-10-17Initialize the gateway with a blockBrendan Deere
So Ive been running into the problem of the gateway being evaluated too early (before the db is created) having it be explicitely set in an initializer. Im now specifying the default gateway in a block so that it will not be evaluated until it is actually needed
2016-10-12Make the dispatchers pluggableBrendan Deere
The dispatcher classes are intended to be hooks into the proccing algorithm. Allowing these classes to be plugged into the gem gives users more flexibility as to how their app handles certain events during handling. These events are: Success - All installments were processed and fulfilled by a single order Failure - No installments were fulfilled due to a generic error OutOfStock - Some installments were not fulfilled because there was insufficient stock to do so PaymentFailed - No installments were fulfilled due do a payment error. When plugging in a new class it is highly recommented to subclass from the dispatcher you are replacing, and call super if you override the #dipatch method. This ensures the internal models handled correctly. Custom behaviour should be added in addition to the existing behaviour. ex. ```ruby Class MyAppFailureHandler < SolidusSubscriptions::FailureHandler def dispatch(installments) email_client(installment.first.subscription.user) super # very important end def email_client(user) Mailer.send_later(:subscription_error, user) end end ```
2016-10-12Merge pull request #89 from brendandeere/skipsBrendan Deere
Skips
2016-10-07Add a link to the subscriptions backend areaBrendan Deere
Jam this link into the admin sidebar
2016-10-06Fix abilitiesBrendan Deere
Dont give default customers the manage ability, it opens too many doors. Create a second set of abilities for admin users
2016-10-06Reset successive skip countBrendan Deere
When the subscription is processed its successive skip count should be reset to 0
2016-10-06Add config options for skipsBrendan Deere
maximum_successive_skips: maximum number of times a subscription can be skipped before it must be processed. maximum_total_skips: Total limit on number of skips, once a subscription has been skipped this many times, the subscription can no longer be skipped
2016-10-05Merge pull request #80 from brendandeere/config_minimum_cancellation_noticeBrendan Deere
Config minimum cancellation notice
2016-10-05Merge pull request #84 from brendandeere/preferred_abilitiesBrendan Deere
Prefer hash conditions over blocks
2016-10-05Merge pull request #83 from brendandeere/subs_indexBrendan Deere
Subs index
2016-10-05Prefer hash conditions over blocksBrendan Deere
The hash conditions are more flexible and allow the permission set to be used in more circumstances https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities%3A-Best-Practice
2016-10-04Allow guests to edit their subss line itemsBrendan Deere
Previously the ability assumed that all subscription_line_items would have a user through the order. This however is not the case since the user login is not enforced until after the user tries to transition out of the cart step. Allow guests to edit their line items if the line item matches the current checkout_id (order guest token )
2016-10-04Set the Completed at time for fulfilled installmentsBrendan Deere
the completed_order_with_totals factory doesnt set the completed_at time
2016-10-04Processor cancels subsBrendan Deere
If the processor processed a subscription in the pending_cancellation state, it cancels the subscription after creating one last installment for it
2016-10-04Processor advances actionable datesBrendan Deere
When an installment is created for a subscrption, the subscription should have its actionable date advanced.
2016-10-04Configurable minimum cancellation noticeBrendan Deere
This value will be used to define what notice is required for cancel a subscription
2016-10-03Usefully qualified names in processor#runBrendan Deere
Something about the inheritance from the singleton class here is interrupting normal rails constant lookup. As an interm fix, use the fully qualified class names
2016-10-03Remove duplicated lib autoloadBrendan Deere
2016-10-03Correctly specc SolidusBrendan Deere
2016-09-30Merge pull request #68 from brendandeere/subscription_order_promo_ruleBrendan Deere
Subscription order promo rule
2016-09-30Require all of solidusBrendan Deere
Not just core
2016-09-28Hook SubscriptionOrder promo up to solidusBrendan Deere
Register the subscription order promotion rule up to solidus
2016-09-28Merge pull request #67 from brendandeere/promo_ruleBrendan Deere
Promo rule
2016-09-28Merge pull request #47 from brendandeere/rake_task_and_jobBrendan Deere
Rake task and job