You are here

function uc_recurring_test_gateway_process 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_process()

@todo Please document this function.

See also

http://drupal.org/node/1354

2 string references to 'uc_recurring_test_gateway_process'
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 33
Uc recurring implementation for the test gateway module.

Code

function uc_recurring_test_gateway_process($order, &$fee) {
  $data = array(
    'billing' => array(
      'first_name' => $order->billing_first_name,
      'last_name' => $order->billing_last_name,
      'phone' => $order->billing_phone,
      'company' => $order->billing_company,
      'street1' => $order->billing_street1,
      'street2' => $order->billing_street2,
      'city' => $order->billing_city,
      'zone' => $order->billing_zone,
      'postal_code' => $order->billing_postal_code,
      'country' => $order->billing_country,
    ),
    'payment_details' => $order->payment_details,
  );
  if ($key = uc_credit_encryption_key()) {
    $crypt = new UbercartEncryption();
    $data['payment_details']['cc_number'] = $crypt
      ->encrypt($key, $data['payment_details']['cc_number'], 32);
    if (variable_get('uc_credit_debug', FALSE)) {
      $data['payment_details']['cc_cvv'] = $crypt
        ->encrypt($key, $data['payment_details']['cc_cvv'], 32);
    }
    $data['payment_details']['cc_exp_month'] = $crypt
      ->encrypt($key, $data['payment_details']['cc_exp_month'], 32);
    $data['payment_details']['cc_exp_year'] = $crypt
      ->encrypt($key, $data['payment_details']['cc_exp_year'], 32);
    uc_store_encryption_errors($crypt, 'uc_recurring');

    // Set gateway specific fee information for renewals.
    $fee->data['billing'] = $data['billing'];
    $fee->data['payment_details'] = $data['payment_details'];
  }
  return TRUE;
}