Problem/Motivation

Let's port Commerce License.

Proposed resolution

The main change we're making is to merge the role of Commerce Recurring (for products and orders) and Commerce License Billing (for subscriptions) into a single module which will leverage the plugin system to serve both roles. There is a spec document for this which I'm going to turn into issues in the queues over the coming days. ??Can we link to these or list them in the remaining tasks???

Remaining tasks

List here the outstanding tasks for an Alpha 1.
The minimum needed for an alpha:
#2879261: Entity scaffolding
#2879301: Time handling and periodic field/form element type (?)

Nice to have for an alpha:

Original summary

Okay. Sorry for the delay everyone. I started on this and then was waylaid by both travel and real life crap for nearly a month. We are proceeding with the port of this module backed by Platform.sh and AcroMedia, with supporting fire from the core Commerce Guys team. Here is the announcement I wrote in the Drupal #commerce Slack channel, which is where most of the development feedback and discussion here will happen:

Ok I'm going to write this while I have the time. My schedule has been a bit wild but I am actively pursuing ports of the Commerce License and Commerce License Billing suite to Drupal 8 + 2.x. We discussed this at the Paris sprint in January and finally I'm following up with support from AcroMedia and Platform (this will also involve cleaning up and making final releases of the 7.x/1.x modules.)

The main change we're making is to merge the role of Commerce Recurring (for products and orders) and Commerce License Billing (for subscriptions) into a single module which will leverage the plugin system to serve both roles. There is a spec document for this which I'm going to turn into issues in the queues over the coming days. I already have a bunch of scaffolding for the Commerce License module and there will be issues for the remainder of that port shortly also, so anyone interested can feel free to take a crack at various small tasks.

I will probably set up a weekly office hours for this overall Big Project sometime next week after conferring with Bojan. One of our big goals is to make this a core supported component of Drupal Commerce 2.x and have recurring implementations be as natural and seamless as in any recurring-focused SaaS product out there.

Some other stuff:

  • I'm going to personally follow up with others who have started ports before. I wanted to get some ground up scaffolding in place first to wrap my head around what is needed. The intention is not to discard the work of others but to bring it in piecemeal as patches. No offense was intended, I just got distracted right after taking the first major step and it looked bad.
  • To systematize my own work on this as well as provide an easy way for others to help, my second step was to sit down and document (very roughly) the main logic points that are required for Commerce License to work. These will all be turned into linked issues, but my notes will appear in the first comment to this issue.

Comments

Kazanir created an issue. See original summary.

Kazanir’s picture

  1. Rules triggers for synchronization or failed synchronization
  2. Depends on AQ for processing of live queue items (rather than waiting on cron)
  3. Rule to activate all licenses of a provided order, used at checkout completion
  4. Function to make sure a timestamp is consistent within a single request
  5. Bundle plugin functionality for license entities, class-specific logic on the bundle plugin
  6. General entity scaffolding, forms, etc. No revisions this time -- we need to in general strip all boilerplate that can now be handled by the entity API module.
  7. Decent permissions scheme is needed
  8. Logic to manipulate licenses based on order workflow:
    1. Create license when a licensable order item is saved with a licensable product, and attach to the cart order item
    2. Delete the associated license when a line item is removed, if it hasn't been activated yet
    3. When a cart order w/ licenses is canceled, delete all unactivated licenses.
  9. Sync queue processing callback -- just calls synchronize() bundle plugin method and records results appropriately
  10. Prevent changing the product quantity on the add to cart form for licensable products (? there have been support requests about this...)
  11. Prevent combining licensable products in cart order items and also prevent quantity changes
  12. Ensure that licenseable product types and line item types have appropriate fields created for them
  13. IEF to allow license editing as part of order items form - IEF form has lots of custom logic I need to understand
  14. Proper time handling so that months are months instead of 30 days...
  15. Proper API functions for handling product changes, renewals, etc.
  16. Commerce License Role example
  17. Commerce License File example
  18. Commerce License Node Grant example
  19. Base license class needs to be written implementing the interface
  20. Checkout pane for license forms and configuration with IEF
  21. Checkout pane for completion which activates licenses, refreshes, waits for sync, etc.
  22. JS to refresh the checkout pane properly with configurable timeouts, etc.
joachim’s picture

heddn’s picture

Issue summary: View changes
Related issues: +#2879261: Entity scaffolding
chrisrockwell’s picture

Issue summary: View changes

Adding #2879301: Time handling and periodic field/form element type (?) for alpha since I don't think we can use this without. AFAIK it doesn't default to unlimited.

joachim’s picture

I'm tagging issues as 'Novice', for people who want to help but don't feel they have the skills or familiarity with the code: https://www.drupal.org/project/issues/search/commerce_license?project_is...

Lukas von Blarer’s picture

This needs a IS update. Alpha is released. We should have a list of issues needed for a beta release and the stable release to make it easier to contribute. @joachim could you do that?

joachim’s picture

Issue tags: -meta

> We should have a list of issues needed for a beta release and the stable release to make it easier to contribute. @joachim could you do that?

I made a list of missing features for my presentation at DrupalEurope, so I'll dig that out and check there is an issue for each item.

joachim’s picture

Here's my 'What's next' slide from my presentation at DrupalEurope:

These were also in the list in my presentation, but are on Commerce Recurring:

  • Customer UI to view subscriptions
  • Admin UI to create/edit subscriptions
  • Ability to cancel / end a subscription
  • Ability to repurpose a subscription
  • Grandfathering options, for subscriptions to update with product price changes -- that's ar
Lukas von Blarer’s picture

Thank you! Is there a recording of your session?

Which of the issues are required for a beta release and which are targeted for the stable release? That overview would help a lot to collaborate and evaluate commerce_license.

joachim’s picture

> Thank you! Is there a recording of your session?

It was recorded, but I don't know if it's available yet. Maybe ask @DrupalEurope on twitter?

> Which of the issues are required for a beta release and which are targeted for the stable release? That overview would help a lot to collaborate and evaluate commerce_license.

I would say for beta we need:

- Customer UI to view licenses
- For OG license support, some way of allowing customers to select values for their license, whether it's either of:
-- Checkout form for license entity
-- Add to cart form additions for license entity
- It would also be nice to figure out how remote licenses are going to work before we hit a beta, as it might have implications for the API, but as I have NO idea about the use cases or how it's meant to work, I don't think it's going to happen.

For the rest, it depends on what your own use case is and what features you need. For example, I considered 'Re-purchase a product to extend a license' a nice-to-have, but it's ended up getting lots of work done on it because someone needs it for their site.

zenimagine’s picture

Hello, I work on a marketplace project (several store and owner on the same site).

Here are its operation (example for two stores):

- the store "A" belongs to the user "1" and contains 20 products.
- the store "B" belongs to the user "2" and contains 50 products.

The shop owner must buy a recurring license (every month), to sell online.

If the user "1" does not have a license, visitors can see the products of the store "A", but they can not buy them online.

For example by automatically disabling the "Add to Cart" button.

Can the license module do that?

Is it stable enough for a site in production?

joachim’s picture

> For example by automatically disabling the "Add to Cart" button.
> Can the license module do that?

You'll need a custom license plugin for that part.

> Is it stable enough for a site in production?

Probably... It's in use on several production sites, but as it's still in alpha, API may change. So you'll need to manage any custom code you have, and also keep an eye on the state of the module for any changes.

zenimagine’s picture

@joachim Thank you. I see that there is a module "Recurring Time Period".

What is the difference with "Commerce Recurring"?

joachim’s picture

You're taking this issue further and further off-topic -- please read the READMEs!

mrweiner’s picture

These were also in the list in my presentation, but are on Commerce Recurring:

Customer UI to view subscriptions
Admin UI to create/edit subscriptions
Ability to cancel / end a subscription
Ability to repurpose a subscription
Grandfathering options, for subscriptions to update with product price changes -- that's ar

Are there issues tracking the state of these needs/tasks? You note that they are "on Commerce Recurring", but wouldn't the issues be related to this module since Commerce Recurring is being integrated into Commerce License? I've got a build on the horizon that will require at least 2 and 3, and possibly 1, so I'm interested in contributing to dev but haven't worked on any ports before so not sure what the overhead is.

On another note, do you know if there are any plans for migration of licenses from D7 to D8?

mrweiner’s picture

I try not to bump issues, but given that my last post was ~5 months it seems alright. Still interested in helping! :)

joachim’s picture

> Are there issues tracking the state of these needs/tasks?

In some cases yes, but I'm not sure any more. If you can't find an issue, feel free to create one.

> wouldn't the issues be related to this module since Commerce Recurring is being integrated into Commerce License

It depends which module they come under!

> On another note, do you know if there are any plans for migration of licenses from D7 to D8?

No, though I did do a migration and I could dig out the code. I thought I put some of it into License already.

bojanz’s picture

Assigned: Kazanir » Unassigned

It's now been two years since the first Commerce Recurring betas, and their use on various sites. Recurring itself is close to its first production-ready RC1 release (though it remains to be seen when there will be enough funding or Centarro time for that to happen). License remains a bit stuck on the road to beta due to lack of backing (sponsors, please reach out to joachim).

The Recurring+License combo has seen enough usage for us to be able to draw some conclusions. My impression is that users are generally confused about how License and Recurring interact, and what is provided by which module. The duplication between license expiration settings (which are not used in a recurring context) and billing schedules (provided by recurring) is a frequent discussion point on Drupal Slack. Furthermore, license doesn't provide a lot in a recurring context. In D7 the license entity also served as a subscription entity, but in D8 the recurring module has its own subscription entity.

So, my conclusion is this: We should encourage people to use either License or Recurring, never both. Use License for manual billing (buy a product to get access, re-buy the product to extend access). Use Recurring for automatic billing (buy product to get access, get billed weekly/monthly/yearly etc). Modules that allow licensing files/media/etc should integrate with both, providing both a license type plugin and a subscription type plugin, with the real logic in a shared service as needed. This clarity will also make it easier to develop both modules, since their use cases are now better defined.

Note that for this to be doable we need to support awarding roles from Recurring only: #3108259: Add a subscription type for roles

zenimagine’s picture

Thank you, have you planned one in this update, uninstalling the module? Currently impossible to remove the module from a site.

dercheffe’s picture

We should encourage people to use either License or Recurring, never both.

Hi,

I implemented 2 checkout flows in my site with commerce and commerce_licence: One for private customers and one for business customers. In my case manual billing and automatic recurring are both required. IMO it should be possible to co exist the two modules so a site builder is able to decide what way he want to choose for each customer journey.

Second point is that I don't really understand why there is a commerce recurring framework as a standalone module.
Normally in a online shop selling physical products (e.g. let's say a t-shirt), I buy it once and pay once. The recurring functionality makes more sense when selling a digital product like a site access or am I wrong? The name "commerce license" is more intuitive for a commerce noob like I'm one :)
So what's speaking against merging reccurring functionality in commerce license and have at the end one module with a intuitive name?

The site builder or the user itself (depending on site configuration) should also have a choice to disable auto recurring a access by default when purchase a product or later during a view, a field etc (As far as I know there is already a issue for that: #3091587)

Edit:
If there is no way that commerce_license and commerce_recurring_framework can co-exist at one site will there be an upgrade path later?
This would be very important imo to avoid problems with license contracs.

joachim’s picture

> We should encourage people to use either License or Recurring, never both.

It's been a while since I finished working on the project I built License for, but I'm fairly sure we had some products that were one-off purchases, and some that were recurring subscriptions.

> Second point is that I don't really understand why there is a commerce recurring framework as a standalone module.

IIRC it's because the plan was that Recurring could also handle things like post-paid subscriptions for things like metered usage, which would not involve a license. Or possibly things like recurring orders that are for physical products, e.g. 'order the same basket of groceries every week'.

> Modules that allow licensing files/media/etc should integrate with both, providing both a license type plugin and a subscription type plugin, with the real logic in a shared service as needed.

That doesn't sound like elegant architecture to me. It might be the quickest fix given the lack of support for these modules, but it doesn't seem like the best fix.

bojanz’s picture

That doesn't sound like elegant architecture to me. It might be the quickest fix given the lack of support for these modules, but it doesn't seem like the best fix.

My point exactly. If we continue chasing the most complex requirements while having 0 funding and very little community engagement, we'll reach 2022 in the same alpha/beta non-production-ready state.