Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not valid card shows how valid #125

Closed
oscarhandsome opened this issue Oct 23, 2018 · 5 comments
Closed

Not valid card shows how valid #125

oscarhandsome opened this issue Oct 23, 2018 · 5 comments

Comments

@oscarhandsome
Copy link

oscarhandsome commented Oct 23, 2018

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

@PawelDecowski
Copy link
Owner

PawelDecowski commented Oct 23, 2018

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 booleans 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) {

@oscarhandsome
Copy link
Author

oscarhandsome commented Oct 23, 2018

Thank you @PawelDecowski for so fast answer, will try to test with it

@oscarhandsome
Copy link
Author

oscarhandsome commented Oct 23, 2018

@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.

@PawelDecowski
Copy link
Owner

PawelDecowski commented Oct 23, 2018 via email

@oscarhandsome
Copy link
Author

oscarhandsome commented Oct 23, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants