We need to do some fancy footwork with UC role assignment and product kits- would it be possible to get a hook when recurring billing fires so we can add our own logic?

CommentFileSizeAuthor
#1 uc_payflowpro_roles_hook.patch1.11 KBkwinters

Comments

kwinters’s picture

Title: Add hook for recurring payments » Add hook to customize role renewal during recurring payment processing
Assigned: Unassigned » kwinters
Status: Active » Needs review
StatusFileSize
new1.11 KB

Give this patch a try. After patching, that section should look like this:

        // For now, integration with uc_roles is direct.  After integration
        // with uc_recurring is done, this should no longer be needed because
        // uc_recurring will already take care of it. @see #525222
        // This hook allows custom logic or skipping renewal and replaces the default behavior.  @see #862806
        $rolesOverrides = module_implements('uc_payflowpro_roles_renew');
        if (!empty($rolesOverrides))
        {
          module_invoke_all('uc_payflowpro_roles_renew', $row, $profile, $order);
        }
        elseif (is_callable('uc_roles_action_order_renew')) {
          uc_roles_action_order_renew($order, array());
        }

If you define a hook mymodule_uc_payflowpro_roles_renew then it will skip the default uc_roles_action_order_renew call and let you do whatever you want. I didn't test this very thoroughly, so let me know if it doesn't work for you.

Long term, I'm undecided on committing this. It seems like hooking some part of uc_roles is a better plan (may need to file an issue in the ubercart project), because then you don't have to care what the gateway code is doing, and I don't think the 2.x branch is going to call uc_roles_action_order_renew at all anyway (uc_recurring will do that automatically). So, this is really just a temporary situation.

kwinters’s picture

Status: Needs review » Closed (fixed)