Problem/Motivation

A bug has come to our attention: if a customer adds a license to their cart, the existing license will never expire and the customer's roles will not be revoked.

Steps to reproduce

  1. Create a new license for yourself.
    Granting you a role or another.
    In a rooling interval of 1 year.
    Expiring some 20 days from now.
  2. Activate the license.
    Now find a product associated to the same license.
    Add it to the cart.
    The license from step 1 will go into renewal in progress.
  3. Edit the license from step 1 to expire two days ago.
  4. Now execute:
    drush eval "Drupal::service('commerce_license.cron')->run()";
    drush advancedqueue:queue:process commerce_license;

Expected result: the license will expire and roles revoked.
Actual result: nothing happens, the user keep their roles.

That's because the license cannot transit from renewal_in_progress to expire, only from active to expire.

Which is strange, because LicenseExpire.php suggests it should allow such transition.

I would suggest updating the workflow to enable this transition.

CommentFileSizeAuthor
#2 3466297-2.patch1.38 KBadinancenci
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

adinancenci created an issue. See original summary.

adinancenci’s picture

StatusFileSize
new1.38 KB

I hope what I did here makes sense.

adinancenci’s picture

Alternatively we could update LicenseExpire.php to activate the license before expiring it ...

joekers’s picture

Priority: Normal » Major

I've changed the priority to major as this issue allows users to prolong their license without renewing. Depending on the implementation, it would allow users to bypass paying for the renewal and/or retain user roles that they should no longer have.

hockey2112’s picture

Experiencing the same issue.

qaiser iqbal’s picture

Experiencing the same issue.

zaporylie’s picture

Version: 3.0.0 » 3.0.x-dev

zaporylie’s picture

Status: Active » Needs review
zaporylie’s picture

Added test for it and reformatted the condition.

zaporylie’s picture

Version: 3.0.x-dev » 3.x-dev
tbkot’s picture

Status: Needs review » Reviewed & tested by the community

jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Merged, thank you!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.