You are here

function uc_recurring_authorizenet_cim_renew in UC Recurring Payments and Subscriptions 6.2

Same name and namespace in other branches
  1. 7.2 includes/uc_recurring.uc_authorizenet.inc \uc_recurring_authorizenet_cim_renew()

Process a renewal using the CIM profile.

Parameters

$order: The order object.

$fee: The fee object.

Return value

TRUE if renewal succeeded

1 string reference to 'uc_recurring_authorizenet_cim_renew'
uc_recurring_uc_authorizenet_recurring_info in includes/uc_recurring.uc_authorizenet.inc
Implementation of hook_recurring_info().

File

includes/uc_recurring.uc_authorizenet.inc, line 76
Uc recurring implementation for the test gateway module.

Code

function uc_recurring_authorizenet_cim_renew($order, &$fee) {
  if (!empty($order->data['cc_txns']['references'])) {
    $data = array(
      'txn_type' => UC_CREDIT_REFERENCE_TXN,
      'ref_id' => end(array_keys($order->data['cc_txns']['references'])),
    );
    $result = uc_authorizenet_charge($order->order_id, $order->order_total, $data);
    if ($result['success'] == TRUE) {
      uc_payment_enter($order->order_id, $order->payment_method, $order->order_total, $fee->uid, $result['data'], $result['comment']);
      return TRUE;
    }
  }
  return FALSE;
}