Licenses under renewal in progress do not expire

Created on 6 August 2024, 4 months ago

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.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil adinancenci

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024