? uc_recurring_prepare.patch
? uc_recurring_renew_pending.patch
Index: uc_recurring.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/uc_recurring/uc_recurring.module,v
retrieving revision 1.1.4.17
diff -u -p -r1.1.4.17 uc_recurring.module
--- uc_recurring.module	22 Jun 2009 01:35:35 -0000	1.1.4.17
+++ uc_recurring.module	30 Jul 2009 01:22:58 -0000
@@ -269,6 +269,15 @@ function uc_recurring_cron() {
   while ($fee = db_fetch_array($result)) {
     $fee['data'] = unserialize($fee['data']);
 
+    // run the prepare function for this fee handler if it exists
+    $prepare_func = 'uc_recurring_'. $fee['fee_handler'] .'_prepare';
+    if (function_exists($prepare_func)) {
+      if (!$prepare_func($fee)) {
+        // prepare function returned false, skip this fee this time round
+        continue;
+      }
+    }
+
     $order_id = uc_recurring_renew($fee);
     if ($order_id) {
       $successes++;
@@ -348,6 +357,7 @@ function uc_recurring_renew($fee, $check
     $fee['fee_amount'] = uc_order_get_total($new_order);
     uc_order_update_status($new_id, 'processing');
 
+
     if ($check_handler == FALSE || ($check_handler && $renew_func($new_order, $fee))) {
       uc_order_update_status($new_id, 'payment_received');
       // payment was successful save the new order
@@ -1024,7 +1034,7 @@ function uc_recurring_fee_delete($featur
       db_query("DELETE FROM {uc_recurring_products} WHERE pfid = %d", $feature['pfid']);
       break;
     case 'user':
-      module_invoke_all('recurring_api', 'delete', $feature['fid']);
+      module_invoke_all('recurring_api', 'delete', $feature['pfid']);
       db_query("DELETE FROM {uc_recurring_users} WHERE rfid = %d", $feature['pfid']);
       break;
   }
