Just been doing some trial test and the UK Maestro card number on the SagePay test card doesn't work.

http://www.sagepay.com/help/faq/how_can_i_test_the_different_card_types

Visa, Mastercard and International Maestro work.

I am also wondering if there are any switch cards with the shorter number now?

Comments

kingandy’s picture

Card number validation is carried out by the Commerce module, in the function commerce_payment_validate_credit_card_type(). In particular, the 'Maestro' block checks for numbers beginning with 5018, 5020, or 5038, which does not include the UK Maestro number given on the SagePay site (5641820000000005).

Similarly, I've experienced a failure with the listed Visa number (4929000000006), as Commerce believes all Visa numbers are 16 digits long.

I'm reluctant to ask Commerce to change its validation rules to allow these test numbers. Is there any way the SagePay module can subvert the validation with its own while it's in test mode?

Running through that table I find:

Card type Card type selected Card number Result
Visa Visa 4929000000006 rejected
Visa Delta (Debit) Visa 4462000000000003 accepted
Visa Electron UK Debit Visa 4917300000000008 rejected
Mastercard Mastercard 5404000000000001 accepted
UK Maestro Maestro 5641820000000005 rejected
International Maestro Maestro 300000000000000004 rejected
American Express American Express 374200000000004 accepted
Japan Credit Bureau (JCB) JCB 3569990000000009 accepted
Diners Club Diners Club 36000000000008 rejected
Laser Cards Laser 6304990000000000044 accepted
ikos’s picture

Assigned: Unassigned » ikos

Hi

We can either not use the credit card validation in Commerce at all or we can submit a patch to Commerce.

I think I'll add it as a config option in the gateway and then submit a patch to Ryan - best of both worlds.

kind regards

Richard

kingandy’s picture

Title: UK Maestro » Test card data

I don't know that it's a problem with the card validation per se, just that these test numbers don't conform to their expectations...

Rather than adding a new setting to disable card validation, it would probably be easier to work with the existing txn_mode setting and only invoke Commerce's validation when in live mode?

I was going to suggest the Sagepay module could maybe use its own validation while in test mode, to ensure that the card number is one of the ten on that list. Then I realised that this would prevent us from testing failure behaviour. (Then I realised that it's currently impossible to test failure behaviour when in test mode, as it substitutes in valid test behaviour before it submits to SagePay. But that's another issue, really.)

ikos’s picture

Status: Active » Needs review

Committed changes today for this issue.

Now both these behaviours are controlled by settings in the payment method.

ikos’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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