You are here

protected function PayPalWebsitePaymentsPro::cardType in Ubercart 8.4

Returns the PayPal approved credit card type for a card number.

1 call to PayPalWebsitePaymentsPro::cardType()
PayPalWebsitePaymentsPro::chargeCard in payment/uc_paypal/src/Plugin/Ubercart/PaymentMethod/PayPalWebsitePaymentsPro.php
Called when a credit card should be processed.

File

payment/uc_paypal/src/Plugin/Ubercart/PaymentMethod/PayPalWebsitePaymentsPro.php, line 318

Class

PayPalWebsitePaymentsPro
Defines the PayPal Website Payments Pro payment method.

Namespace

Drupal\uc_paypal\Plugin\Ubercart\PaymentMethod

Code

protected function cardType($cc_number) {
  switch (substr(strval($cc_number), 0, 1)) {
    case '3':
      return 'Amex';
    case '4':
      return 'Visa';
    case '5':
      return 'MasterCard';
    case '6':
      return 'Discover';
  }
  return FALSE;
}