You are here

function uc_recurring_get_extension in UC Recurring Payments and Subscriptions 7.2

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

Returns the time to extend for a payment attempt.

Parameters

$fee_id: The id of the recurring fee to get extensions.

$attempt: The attempt number to return.

2 calls to uc_recurring_get_extension()
uc_recurring_process_extensions in ./uc_recurring.module
Handle extensions when a recurring payment was unsuccessful.
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 570
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_get_extension($fee_id, $attempt) {
  $extension = db_query("SELECT * FROM {uc_recurring_extensions} WHERE (pfid = :pfid OR pfid IS NULL) AND rebill_attempt = :rebill_attempt ORDER BY pfid DESC", array(
    ':pfid' => $fee_id,
    ':rebill_attempt' => $attempt,
  ))
    ->fetchObject();
  $extend_seconds = 0;
  if ($extension != FALSE) {
    $extend_seconds = $extension->time_to_extend;
  }
  return $extend_seconds;
}