ParadoxLabs-Inc / tokenbase

TokenBase is the foundational package for most ParadoxLabs extensions for Magento®. It provides a tokenized card storage mechanism that is similar to but more featureful than Magento_Vault, and abstract components of a payment gateway implementation for Magento built around those stored cards.
Apache License 2.0
3 stars 3 forks source link

Mastro CC Validation Regex error #6

Closed jesse-thomas closed 11 months ago

jesse-thomas commented 11 months ago

We just had an issue reported and I think I found it in your code as well. Magento hasn't fixed it yet. A few people are confirming this though.

The regex checks for a string at the begining then anywhere.

'pattern' => '^6759(?!24|38|40|6[3-9]|70|76)|676770|676774\d*$',

should be something like below so its only checking the begining.

'pattern' => '^(6759(?!24|38|40|6[3-9]|70|76)|676770|676774)\d*$',

https://github.com/magento/magento2/issues/36332

https://github.com/ParadoxLabs-Inc/tokenbase/blob/974638ce1f5ffd3408a0abddc61427e2ded8c85d/Gateway/Validator/CreditCard/Types.php#L133

rhoerr commented 11 months ago

Ahh thanks Jesse! I should have checked our own code for that. Will get this fixed in the repository this week.

rhoerr commented 11 months ago

Fixed in https://github.com/ParadoxLabs-Inc/tokenbase/commit/5d3ade06fd92a33de6eac543d75e3d918e104b98

Please patch via https://github.com/ParadoxLabs-Inc/tokenbase/commit/5d3ade06fd92a33de6eac543d75e3d918e104b98.diff or install dev-master if you need it before the next release (no ETA).

Thanks again

jesse-thomas commented 11 months ago

thanks @rhoerr

A few things seem to suggest this change is correct. Basic logic for cc validation (cards should begin with a common pattern vs a pattern anywhere) and

https://github.com/magento/magento2/blob/819bba7e643f6963f537b477ffdddf222158dca9/app/code/Magento/Payment/Model/Method/Cc.php#L153

Our issue started with a couple customers being unable to save a card to their account with the validation message "credit card does not match credit card type"

And this magento issue looked like it was it. But i'm being told that 676770|676774 where not in the pattern.

So I might be having seperate issue. I'll make a propper report if I find something.

Thanks!

rhoerr commented 11 months ago

Please do if you find a repeatable process. Thank you!