protected function AcceptJs::mapCreditCardType in Commerce Authorize.Net 8
Maps the Authorize.Net credit card type to a Commerce credit card type.
Parameters
string $card_type: The Authorize.Net credit card type.
Return value
string The Commerce credit card type.
1 call to AcceptJs::mapCreditCardType()
- AcceptJs::createPaymentMethod in src/
Plugin/ Commerce/ PaymentGateway/ AcceptJs.php - @todo Needs kernel test
File
- src/
Plugin/ Commerce/ PaymentGateway/ AcceptJs.php, line 793
Class
- AcceptJs
- Provides the Accept.js payment gateway.
Namespace
Drupal\commerce_authnet\Plugin\Commerce\PaymentGatewayCode
protected function mapCreditCardType($card_type) {
$map = [
'American Express' => 'amex',
'Diners Club' => 'dinersclub',
'Discover' => 'discover',
'JCB' => 'jcb',
'MasterCard' => 'mastercard',
'Visa' => 'visa',
'China UnionPay' => 'unionpay',
];
if (!isset($map[$card_type])) {
throw new HardDeclineException(sprintf('Unsupported credit card type "%s".', $card_type));
}
return $map[$card_type];
}