How and when are commerce licenses created, and when does the state change to "active"? I'm working on a module that attempts to tie commerce_license in with the ACL (Access Control Lists) module. 

I am attempting to sell access to an individual node. I have a product type, product, and product display which does this. I have a node reference field which allows an admin to select which node to license on product creation, and this reference field is being correctly referenced in my license class (the one in plugins/license_type/ which extends CommerceLicenseBase). 

In my save() function, I'm checking to see if the status is COMMERCE_LICENSE_ACTIVE before I add the license owner to the acl, but it appears that the license never gets in this state. I have gone through the checkout process, and even manually completed the order, but I don't ever see the license get to the "active" state.

I've also noticed that the license seems to be created (the save() function is called) when a product that is associated with a license is added to the cart, and NOT on checkout, as is stated in the documentation. 

I think the real issue is in my lack of understanding of how the commerce license module works (and possibly how the ACL module works, but that's a different discussion). I've read through the documentation, watched a few tutorials, and looked through the example code, the commerce_license_role module, as well as the commerce_license_og and commerce_file modules, and I'm still not sure what I'm doing wrong - I'm beginning to suspect that my error is not in the code itself, but rather in configuration.

Here is my code:

&lt;?php

  public function save() {

    if ($this-&gt;uid &amp;&amp; $this-&gt;product_id) {

      // Get the entity referenced 
      // (this works fine - field is defined in the .module file)
      $node = $this-&gt;wrapper-&gt;product-&gt;commerce_license_acl_node-&gt;value();
      $acl_name = 'ACL_' . $this-&gt;product_id . '_' . $node-&gt;nid;

      // Get the acl associated with this node and product ID
      $acl_id = acl_get_id_by_name('commerce_license_acl', $acl_name);

      // If the ACL doesn't already exist, create it
      if(empty($acl_id)){

        // Create ACL if one is not already associated with this license
        $acl_id = acl_create_acl('commerce_license_acl', $acl_name);

        // Grant ACL users read access to this node
        $read   = TRUE;
        $update = FALSE;
        $delete = FALSE;
        acl_node_add_acl($nid, $acl_id, $read, $update, $delete, 0);


      }

      $owner = $this-&gt;wrapper-&gt;owner-&gt;value();

      // I realize a lot of this is redundant. I'm covering all the cases here for my benefit
      // in trying to understand what is going on.
      switch($this-&gt;status){
        case COMMERCE_LICENSE_ACTIVE:
          // *** This case is never true
          acl_add_user($acl_id, $owner-&gt;uid);
          drupal_set_message('license_acl set to active');
          break;
        case COMMERCE_LICENSE_CREATED:
          // **** This is the state that it always seems to be in
          drupal_set_message('license_acl created');
          break;
        case COMMERCE_LICENSE_PENDING:
           drupal_set_message('license_acl set to pending');
         break;
        case COMMERCE_LICENSE_EXPIRED:
          acl_remove_user($acl_id, $owner-&gt;uid);
          drupal_set_message('license_acl set to expired');
          break;
        case COMMERCE_LICENSE_SUSPENDED:
          acl_remove_user($acl_id, $owner-&gt;uid);
          drupal_set_message('license_acl set to suspended');
          break;
        case COMMERCE_LICENSE_REVOKED:
          acl_remove_user($acl_id, $owner-&gt;uid);
          drupal_set_message('license_acl set to revoked');
          break;


    }

    parent::save();

  }
  ?&gt;


Is there any documentation out there which goes into depth explaining the workflow of commerce license creation and statuses? Thanks in advance.
It looks the license is being activated when the "order paid in full" trigger fires, and I didn't have a payment system in place. I thought I had it configured to bypass this, but enabling the example payment system and the payment ui solved the problem.

However, the user still doesn't have access to the node associated with the ACL, so I need to figure that one out, as well.