Open cirocosta opened 10 years ago
Nice one!
I'm going create a test from each pattern and also to implement a default list following the shopify method, however I've an issue with maestro and discover. Seems the pattern is conflicting one each other.
I put an example here: http://jsfiddle.net/leocaseiro/zupmd37a/3/
maestro fake number: 6759649826438453 discover fake number: 6011111111111117
About the Luhn Formula, it's a great idea and we can work on it.
@leocaseiro , great catch! Seems like they're letting maestro be a wild card (see https://github.com/Shopify/active_merchant/blob/4f43b39f920ae151c44e2165b6e8342c29a81b7d/lib/active_merchant/billing/credit_card_methods.rb#L98-L104).
Are you using http://support.worldpay.com/support/kb/bg/testandgolive/tgl5103.html as a test case? I think that If it fits well to the reality this could be used in the specs (supposing a default list gets added to the codebase)
@cirocosta I think we can add these regex, the real reason why they is not on the repo is because is very easy to find and each person has a different requirement but we can add all on an folder to people catch, about validation we think that it can be for another module/plugin because this plugin just wants to identify patterns and some people will need just this, so we will create a new repository for validate :)
thanks for the help :+1:
Or better, we can just add all patterns at the data file, what do you guys think?
Hi there!
I don't know what are the regexes leroy uses (i think that the reason to not expose default regexes was to hide them, correct if i am wrong), but i think that leading devs to a valuable list of up to date regexes would be cool. My contribution is a point to shopify's list:
https://github.com/Shopify/active_merchant/blob/4f43b39f920ae151c44e2165b6e8342c29a81b7d/lib/active_merchant/billing/credit_card_methods.rb#L5-L18
It might be also very useful to expose a method to perform validation on the classical Luhn Formula, which is very inexpensive (a closure-optimized JS version here: https://gist.github.com/ShirtlessKirk/2134376).
Great job :+1: :smile_cat: