Skip to content

Commit

Permalink
jondavidjohn#56 - DinersClub validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Colonna committed Dec 9, 2018
1 parent 936d261 commit db79ffc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CARDRULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following list contains Issuer Identification Number (IIN) patterns and leng

### Diners Club <img src="https://user-images.githubusercontent.com/6437556/45498174-8400b500-b747-11e8-9afd-85ea2441a9be.png" width="30" height="20">

**IIN Pattern:** 36, 38, 30[0-5] <sup>[3]</sup>
**IIN Pattern:** 36, 38, 30[0-5]<sup>[3]</sup>, 309<sup>[13]</sup>

**Length:** 14 <sup>[3]</sup>

Expand Down Expand Up @@ -99,6 +99,7 @@ The following list contains Issuer Identification Number (IIN) patterns and leng
[10]: https://github.com/Adyen/adyen-magento/issues/236
[11]: https://tech.dibspayment.com/D2/Toolbox/Test_information/Cards
[12]: http://blog.unibulmerchantservices.com/12-signs-of-a-valid-mastercard-card/
[13]: https://en.wikipedia.org/wiki/Payment_card_number#Issuer_identification_number_(IIN)



2 changes: 1 addition & 1 deletion src/payform.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
}
{
type: 'dinersclub'
pattern: /^(36|38|30[0-5])/
pattern: /^(36|38|30[0-59])/
format: /(\d{1,4})(\d{1,6})?(\d{1,4})?/
length: [14]
cvcLength: [3]
Expand Down
1 change: 1 addition & 0 deletions test/validateCardNumber_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe 'payform', ->
assert(payform.validateCardNumber('38520000023237'), 'dinersclub')
assert(payform.validateCardNumber('36700102000000'), 'dinersclub')
assert(payform.validateCardNumber('36148900647913'), 'dinersclub')
assert(payform.validateCardNumber('30932281347102'), 'dinersclub')

assert(payform.validateCardNumber('6011111111111117'), 'discover')
assert(payform.validateCardNumber('6011000990139424'), 'discover')
Expand Down

0 comments on commit db79ffc

Please sign in to comment.