Closed oscarhandsome closed 5 years ago
My quick guess is it’s because you’re only checking luhn_valid
:
if (result.luhn_valid == true) {
$('#payfort_fort_card_number').addClass('valid');
You’re not checking if the length is valid:
(you don’t need to compare boolean
s to true
so I removed the == true
)
if (result.luhn_valid && result.length_valid) {
There’s a shortcut to check both at once:
if (result.valid) {
Thank you @PawelDecowski for so fast answer, will try to test with it
@PawelDecowski I tried your recommendations, both but if delete last 4 digits this all okay image but if I deleted 2 last digits this is valid :) image
i have no idea why it happens...
if i add 2 wrong last digit image
on the main page jquerycreditcardvalidator.com my card is validating right, and if remove last digit or change on wrong.
Visa numbers can be between 13 and 19 digits long. You just happened to end up with a 14 digit long number that has a valid Luhn checksum after removing the last 2 digits. It’s pure chance. Try another number and it’ll most likely fail.
will check....
@PawelDecowski This validator can work with payfort_fort ? I just now, understand that your developed script also there.... awesome!
anyway i have weird bug https://prnt.sc/l9smn2
Hello @PawelDecowski and developer. If somebody knows how to resolve this issue please explain to me?
I have a simple input field. Link on the html image how it works on my dev
My problem is: I input number, then with regExp is converting to string with after each 4 digits spaces. and for example, I added this number 4000 0000 0000 0002 from the main page then tried ty change last digit and this is not valid, - ok but i tried to delete last 2-3 digit scipt show that number is valid. i don't understand why on the main page the script works, on my example not.
My script I think very simply. Code here