Why is this shameful practice so common?
11–20 of 40 posts
Re: Why is this shameful practice so common?
#12Earlier quoted context omitted.
But your application server can strip out spaces and dashes before you send the number to the gateway. Right?
Of course - We do it. Wondering if anyone uses a payment gateway which prohibits this..
Re: Why is this shameful practice so common?
#13The payment gateways I've used have explicitly stated in their documentation, that there must be no validation of credit card numbers. I guess it's to avoid programmers messing up the card numbers or something.
Do they literally mean no validation? Can't even check to see and strip any non-numeric characters? No luhn algorithm?
Also, how would they know? :p
Re: Why is this shameful practice so common?
#14Re: Why is this shameful practice so common?
#15Re: Why is this shameful practice so common?
#16Here's a single line of python that removes any character that isn't a digit from the string "s":
re.sub(r'[^\d]', '', s)
Wow, that was almost too easy. Now the user can put spaces, dashes, periods, underscores... who cares! Oh, and if they put in the CSV code or something at the end... re.sub(r'[^\d]', '', s)[0:16]
A single line should cover 99% of the problems the user can create. Compliment it by giving an example of how the number should be input and... done.Re: Why is this shameful practice so common?
#17Even worse is the good ol "4 text boxes" solution.
Re: Why is this shameful practice so common?
#18Even worse is the good ol "4 text boxes" solution.
I personally don't find that particulary annoying, I just hit the tab key. You can always take the user to the next textbox automatically with JavaScript.
Re: Why is this shameful practice so common?
#19It's common for one very simple reason: Programatically, it is much easier to demand user input in a single form than to code for different cases. In this specific case I don't understand it so much because it's exceedingly simple to write a regex replace that replaces every instance of "not a number" with nothing. The linked page describes a less-general use of this in Perl, but it's just as easy in any other modern…