vcatalano / py-authorize

A full-featured Python API for the Authorize.net payment gateway.
MIT License
42 stars 35 forks source link

Range of card code #12

Closed delibaltas closed 10 years ago

delibaltas commented 10 years ago

In / authorize / schemas.py, line 142, the range of the card code is 100 to 9999:

card_code = colander.SchemaNode(colander.Integer(),
                                validator=colander.Range(100, 9999),
                                missing=colander.drop)

Are you sure that values like 009 etc, are not acceptable? I haven't found this restriction anywhere else, but may be I am mistaken.

vcatalano commented 10 years ago

Apparently, the PayPal API used a similar validation and it caused certain CVV numbers to be invalid. Good find!

fredstluka commented 10 years ago

Vincent,

When do you plan to release the fix for this bug?

I just tripped across it myself. I'm testing with a credit card that has a CVV that is less than 100.

Will you have a newer version soon, or should I just patch my local copy? I asume the fix is just to change 100 to 0 on line 142, right?

Thanks! --Fred

fredstluka commented 10 years ago

BTW, don't forget to change 100 to 0 in 3 places in that file. Lines 77, 142, and 273.

--Fred

fredstluka commented 10 years ago

OK, so I changed 100 to 0 in 3 places. Now I'm getting an error that says my 2-digit CVV is less than the MinLength of 3. Where do I find the MinLength tp change it to 1?

Thanks! --Fred

fredstluka commented 10 years ago

OK. I see what you did. Instead of changing 100 to 0, you changed it from Integer to String, and used a regex to enforce 3-4 digits.

You only did it at line 77 though. Isn't it also needed at 142, and 273?

--Fred

vcatalano commented 10 years ago

Yes, you are correct. I have pushed the appropriate fix.

fredstluka commented 10 years ago

Looks good! Thanks!

--Fred