You are here

function uc_credit_display_number in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_credit/uc_credit.module \uc_credit_display_number()
  2. 7.3 payment/uc_credit/uc_credit.module \uc_credit_display_number()

Returns a credit card number with appropriate masking.

1 call to uc_credit_display_number()
uc_payment_method_credit in payment/uc_credit/uc_credit.module
Callback function for the Credit Card payment method.

File

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

Code

function uc_credit_display_number($number, $masked = FALSE) {
  if (strlen($number) == 4) {
    return t('(Last 4) ') . $number;
  }
  if (user_access('view cc numbers') && !$masked) {
    return $number;
  }
  else {
    return str_repeat('-', 12) . substr($number, -4);
  }
}