You are here

protected function CreditCardPaymentMethodBase::displayCardNumber in Ubercart 8.4

Returns a credit card number with appropriate masking.

Parameters

string $number: Credit card number as a string.

Return value

string Masked credit card number - just the last four digits.

3 calls to CreditCardPaymentMethodBase::displayCardNumber()
CreditCardPaymentMethodBase::cartReview in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Returns the payment method review details.
CreditCardPaymentMethodBase::customerView in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Called when an order is being viewed by a customer.
CreditCardPaymentMethodBase::orderView in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Called when an order is being viewed by an administrator.

File

payment/uc_credit/src/CreditCardPaymentMethodBase.php, line 676

Class

CreditCardPaymentMethodBase
Defines a base credit card payment method plugin implementation.

Namespace

Drupal\uc_credit

Code

protected function displayCardNumber($number) {
  if (strlen($number) == 4) {
    return $this
      ->t('(Last 4) @digits', [
      '@digits' => $number,
    ]);
  }
  return str_repeat('-', 12) . substr($number, -4);
}