You are here

function uc_recurring_test_gateway_renew in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 includes/uc_recurring.test_gateway.inc \uc_recurring_test_gateway_renew()

@todo Please document this function.

See also

http://drupal.org/node/1354

2 string references to 'uc_recurring_test_gateway_renew'
hook_recurring_info in ./uc_recurring.api.php
Define the recurring payment method/gateway function callbacks.
uc_recurring_test_gateway_recurring_info in includes/uc_recurring.test_gateway.inc
Implements hook_recurring_info().

File

includes/uc_recurring.test_gateway.inc, line 73
Uc recurring implementation for the test gateway module.

Code

function uc_recurring_test_gateway_renew($order, &$fee) {
  if ($key = uc_credit_encryption_key()) {
    $crypt = new UbercartEncryption();
    $fee->data['payment_details']['cc_number'] = $crypt
      ->decrypt($key, $fee->data['payment_details']['cc_number']);
    if (variable_get('uc_credit_debug', FALSE)) {
      $fee->data['payment_details']['cc_cvv'] = $crypt
        ->decrypt($key, $fee->data['payment_details']['cc_cvv']);
    }
    $fee->data['payment_details']['cc_exp_month'] = $crypt
      ->decrypt($key, $fee->data['payment_details']['cc_exp_month']);
    $fee->data['payment_details']['cc_exp_year'] = $crypt
      ->decrypt($key, $fee->data['payment_details']['cc_exp_year']);
    uc_store_encryption_errors($crypt, 'uc_recurring');
  }

  // Cache the CC details stored by the handler.
  uc_credit_cache('save', $fee->data['payment_details'], FALSE);

  // Run the charge.
  $result = test_gateway_charge($order->order_id, $order->order_total, NULL);

  // Handle the result.
  if ($result['success'] === TRUE) {
    uc_payment_enter($order->order_id, 'credit', $order->order_total, 0, '', t('Recurring fee payment.') . '<br />' . $result['comment']);
  }
  return $result['success'];
}