You are here

function uc_recurring_set_intervals in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 uc_recurring.module \uc_recurring_set_intervals()

Set the intervals after a successful charge.

Parameters

$fee: The fee object passed by reference.

1 call to uc_recurring_set_intervals()
uc_recurring_renew in ./uc_recurring.module
Process a renewal, either from the cron job or manually from a fee handler.

File

./uc_recurring.module, line 1219
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_set_intervals(&$fee) {
  $fee->next_charge = strtotime('+' . $fee->regular_interval, $fee->next_charge);
  if (!empty($fee->data['extension'])) {
    $fee->next_charge -= $fee->data['extension'];
  }
  if ($fee->remaining_intervals > 0) {
    $fee->remaining_intervals--;
  }
  else {
    $order = uc_order_load($fee->order_id);
  }
  $fee->charged_intervals++;
  $fee->attempts = 0;
  $fee->data['extension'] = 0;
}