Problem/Motivation

InvalidArgumentException: Invalid credit card type "master_card" when performing a checkout with master card.

Steps to reproduce

Set up paypal commerce preffered payment gateway with `Accept credit card` option. Perform a checkout and enter master card as credit card

Proposed resolution

Sanitize the value coming from paypal and remove the underscore (_) as drupal commerce expects credit card to be without any underscores

Comments

Safallia Joseph created an issue. See original summary.

safallia joseph’s picture

The attached patch fixes the issue by removing special characters from credit card brand name.

jsacksick’s picture

Component: PayPal / IPN » PayPal Checkout
Status: Active » Needs review

We probably need to map the credit card type we get from Paypal.

jsacksick’s picture

This is weird, because if I look at the possible card "brands", PayPal lists the following (https://developer.paypal.com/docs/api/orders/v2/#definition-card_brand)

MASTERCARD is listed there, and not "master_card".

jsacksick’s picture

Status: Needs review » Fixed

Reproduced the bug, and decided to go with your fix. The problem is that the PayPal documentation is wrong and doesn't indicate the right credit card types to expect...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.