Skip to content

Commit

Permalink
Merge pull request #2 from NextThought/master
Browse files Browse the repository at this point in the history
Fix credit card industry number validation to check the first number
  • Loading branch information
jamadden committed Sep 10, 2016
2 parents 6a253cf + ab55f09 commit f84fcef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ CHANGES
1.0.1 (unreleased)
------------------

- Nothing changed yet.
- Fix credit card industry validation to check the first number, not
the second.


1.0.0 (2013-03-01)
Expand Down
3 changes: 1 addition & 2 deletions src/z3c/schema/payments/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ valid card must start with one of these numbers:
NotValidISO7812CreditCard: 2222222222222224

>>> cc.validate(u'3333333333333331')
>>> cc.validate(u'4444444444444448')
>>> cc.validate(u'4111111111111111')
>>> cc.validate(u'5555555555555557')
>>> cc.validate(u'3333333333333331')
>>> cc.validate(u'6666666666666664')
Expand Down Expand Up @@ -129,4 +129,3 @@ number registered with a financial institution:
Traceback (most recent call last):
...
NotValidISO7812CreditCard: 4444444444444449

2 changes: 1 addition & 1 deletion src/z3c/schema/payments/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def isValidCreditCard(cardNum):
is low and pre-validating is fast"""

financialIndustries = ['3','4','5','6']
if cardNum[1] not in financialIndustries:
if cardNum[0] not in financialIndustries:
return False

total = pos = 0
Expand Down

0 comments on commit f84fcef

Please sign in to comment.