You are here

function uc_recurring_cybersource_renew in UC Recurring Payments and Subscriptions 6.2

Same name and namespace in other branches
  1. 7.2 includes/uc_recurring.uc_cybersource.inc \uc_recurring_cybersource_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_cybersource_renew'
uc_recurring_uc_cybersource_recurring_info in includes/uc_recurring.uc_cybersource.inc
Implements hook_recurring_info().

File

includes/uc_recurring.uc_cybersource.inc, line 70
Uc recurring implementation for the CyberSource module.

Code

function uc_recurring_cybersource_renew($order, &$fee) {
  if (!empty($order->data['cc_txns']['references'])) {
    $refs = array_keys($order->data['cc_txns']['references']);
    $data = array(
      'txn_type' => UC_CREDIT_REFERENCE_TXN,
      'ref_id' => end($refs),
    );
    $result = uc_cybersource_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;
}