I'm currently trying out Commerce License along with Billing and I'm a bit confused. I've done the following:

1. Created an annual billing cycle (12 months)
2. Created a product that uses the annual billing cycle and has "License duration" set to "Limited" and 6 months.
3. Created an order with the aforementioned product
4. Payed the order in full using commerce example payment

What I expect that to result in:
- A license that expires in 6 months
- A recurring order that is activated in 12 months.

What I get:
- A license that expires in 12 months (and actually, it doesn't ever expire, see #2366607: License billing change status never fires)
- A recurring order that stays the same even after 12 months (I've fast-forwarded the time and ran cron + advancedqueue)

This, to me, is very confusing.

1. What does the billing cycle have to do with the license duration? Why are they interfering with each other?
2. Shouldn't the license automatically expire (i.e change status) when the expiry date has passed?
3. Why do the recurring orders reference the "old" license duration - shouldn't the upcoming order reference the upcoming duration? (see the "analyze" link on admin/commerce/billing)

CommentFileSizeAuthor
#4 license-commerce-issue.jpg95.89 KBAdamGerthel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AdamGerthel’s picture

Issue summary: View changes
AdamGerthel’s picture

Issue summary: View changes
bojanz’s picture

1. What does the billing cycle have to do with the license duration? Why are they interfering with each other?

The license duration is used when you're not using license billing, it is a one time thing.
If the license duration is 30 days, the license expires after 30 days and that's it, the end.
The billing cycle offers continuous periods (after 30 days the license doesn't expire, the customer gets recharged),

You didn't mention whether your 12-month cycle was prepaid or postpaid, but the behavior you're seeing looks correct.

AdamGerthel’s picture

FileSize
95.89 KB

Thanks for your reply.

The license duration is used when you're not using license billing, it is a one time thing.
If the license duration is 30 days, the license expires after 30 days and that's it, the end.
The billing cycle offers continuous periods (after 30 days the license doesn't expire, the customer gets recharged),

I've done some more testing and I think I might have found the culprit. In my example the billing cycle was longer than the license. This is most certainly not a common use-case. I any case, I still think it's weird that it overrides the license expiry date. Look at this example:
------------------------------------
Issue
------------------------------------
Now, it's pretty weird to have a prepaid billing cycle that is shorter than the actual license is. But my question is: why does the license (in this example) expire in one month, when it's clearly stated on the product that it's a yearly license?

If the license duration is 30 days, the license expires after 30 days and that's it, the end.

The license doesn't actually expire. It does when I use Commerce License (without Billing) but when Billing is activated and used, the licenses stop expiring (even if expiry date has passed, cron has run, advancedqueue has run etc.).

Maybe I'm just thick-headed here but this has been one of the most difficult modules to understand that I've come across in years :)

Kazanir’s picture

Status: Active » Needs review

What exactly are you attempting to accomplish? If you want your license to have a fixed duration, then what purpose will the recurring order serve?

The intention is that Commerce License Billing will "take over" the expiration management for a license. When you are just using Commerce License, you assign a fixed duration to your license. But if you are using CLB, you intend for your licenses to renew perpetually and charge the user on a recurring basis for that renewal. This is why CLB removes the license expiration date -- the recurring order and billing process is supposed to manage the license's status each billing cycle (year, month, whatever) based on whether the customer pays their bill or not.

If someone were to not pay their bill (most commonly this means if an order were to hit the dunning_past_due status in the Commerce Dunning cycle) you would use Rules to revoke the license at that point rather than relying on automatic expiration.

Let me know if this makes more sense.

AdamGerthel’s picture

@Kazanir yes that makes sense if you know that's how it works, but there's nothing in your docs or project description explaining that logic.

CLB should at least override the product form and remove the (now) meaningless license duration setting, no?

Kazanir’s picture

Status: Needs review » Needs work

We should probably add a #description to the License Duration via a form alter. But even with CLB active it is still possible to have a license product where no billing cycle type is selected, which would mean that it is a strict License-based product with no recurring billing. So we can't just remove the field from all products -- both need to be present. Adding a note to the Billing Cycle Type field saying that this will enable recurring billing and override the License Duration is probably best. I'll add some notes to the module's description page to make it explicit that this is the intention. Thanks!

OnkelTem’s picture

I wish I would find this explanations EARLY, before I traced the code for two hours lol.
I was searching exactly why licenses doen't expire, while they shouldn't as this is exactly what I do not want.

I propose CLB should modify licenses View to overwrite expire field for licenses created for CLB. Can we do that?

JoshRickert’s picture

Yes, it would be very helpful to document this better. Very confusing when I'm going through the initial process of understanding the module.

nickonom’s picture

I wish I would find this explanations EARLY, before I traced the code for two hours lol.

OnkelTem, how about spending two days like myself trying to figure out what is what till hitting this page? :)

CLB should at least override the product form and remove the (now) meaningless license duration setting, no?

AdamGerthel, I fully support your suggestion.

But even with CLB active it is still possible to have a license product where no billing cycle type is selected, which would mean that it is a strict License-based product with no recurring billing. So we can't just remove the field from all products -- both need to be present.

Kazanir, you'd be right here if AdamGerthel was suggesting to remove the "License billing cycle type", however he is suggesting just the opposite - to remove the "License duration", which is by your own words:

The intention is that Commerce License Billing will "take over" the expiration management for a license. When you are just using Commerce License, you assign a fixed duration to your license. But if you are using CLB, you intend for your licenses to renew perpetually and charge the user on a recurring basis for that renewal. This is why CLB removes the license expiration date...

Collins405’s picture

Ah finally found this! We need better docs!

swelljoe’s picture

I also found this very confusing (and it's taken me weeks to figure out why my recurring CLB orders weren't recurring after the first recurrence). The language of this definitely needs an update; I don't think I understand what it's actually supposed to mean to make a patch, however. The logic of all of this confuses me.

On another front, with this working the way it does (instead of the way I thought it did), I don't see how to handle showing the date when the current billing period ends to my users. I was using the expires field in my license plugin in order to set that date in the database for licenses, and then I could show that field to the user in the View for the license. The only way I'm seeing to do this now is to add yet another field to my license for the duration. Is there an easy way to get the "end of billing cycle" date in my license plugin so I can have that info available in the view for my users without having to add another field?

And, finally, when I change my products to have an "unlimited" license duration, will that solve the problem I'm currently having where none of those orders have recurred (some are two or three months out of date now, having only recurred once, with me gnashing my teeth trying to figure out why) and make them start recurring, or will all of those need to become new orders somehow in order to start recurring?

shi99’s picture

Thanks for clarifying this.
I couldn't figure out what was happening, but now I see what happens.

Kazanir’s picture

Kazanir, you'd be right here if AdamGerthel was suggesting to remove the "License billing cycle type", however he is suggesting just the opposite - to remove the "License duration", which is by your own words:

The reason we cannot remove either field is because it is possible for a site builder to want some products to be licenseable (with expiration) and others to be licenseable on a recurring basis (which makes the "license duration" field superfluous.)

I have added documentation to the CLB documentation page to make this clear. I will try to come back to this to patch the module to disable the "duration" field as soon as a billing cycle type is selected for a product.

nickonom’s picture

If someone were to not pay their bill (most commonly this means if an order were to hit the dunning_past_due status in the Commerce Dunning cycle) you would use Rules to revoke the license at that point rather than relying on automatic expiration.

I wonder is it possible to change the license status on payment failure without Commerce Dunning module? Anyone could share such a Rule that changes license status on payment failure?

I could find only "Activates all licenses of the provided order" action in Rules and no any single action that would let revoking or cancelling licenses.