You are here

function uc_credit_payment_method in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_credit/uc_credit.module \uc_credit_payment_method()

Implementation of hook_payment_method().

File

payment/uc_credit/uc_credit.module, line 378
Defines the credit card payment method and hooks in payment gateways.

Code

function uc_credit_payment_method() {
  if (arg(0) == 'cart' && uc_credit_encryption_key() === FALSE) {
    return;
  }
  $path = base_path() . drupal_get_path('module', 'uc_credit');
  $title = t('Credit card:');
  $cc_types = array(
    'visa',
    'mastercard',
    'discover',
    'amex',
  );
  foreach ($cc_types as $type) {
    if (variable_get('uc_credit_' . $type, TRUE)) {
      $title .= ' <img src="' . $path . '/images/' . $type . '.gif" style="position: relative; top: 5px;">';
    }
  }
  $methods[] = array(
    'id' => 'credit',
    'name' => t('Credit card'),
    'title' => $title,
    'desc' => t('Pay by credit card.'),
    'callback' => 'uc_payment_method_credit',
    'weight' => 2,
    'checkout' => TRUE,
  );
  return $methods;
}