function uc_credit_uc_payment_method in Ubercart 7.3
Implements hook_uc_payment_method().
File
- payment/
uc_credit/ uc_credit.module, line 297 - Defines the credit card payment method and hooks in payment gateways.
Code
function uc_credit_uc_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' => t('Visa'),
'mastercard' => t('MasterCard'),
'discover' => t('Discover'),
'amex' => t('American Express'),
);
foreach ($cc_types as $type => $label) {
if (variable_get('uc_credit_' . $type, TRUE)) {
$title .= ' ' . theme('image', array(
'path' => drupal_get_path('module', 'uc_credit') . '/images/' . $type . '.gif',
'alt' => $label,
'attributes' => array(
'class' => array(
'uc-credit-cctype',
'uc-credit-cctype-' . $type,
),
),
));
}
}
$methods['credit'] = array(
'name' => t('Credit card'),
'title' => $title,
'desc' => t('Pay by credit card.'),
'callback' => 'uc_payment_method_credit',
'weight' => 2,
'checkout' => TRUE,
);
return $methods;
}