From 69ea7e0b4422ec1bca7260ec7bc8756c5d972fb7 Mon Sep 17 00:00:00 2001 From: Jesse Pollak Date: Sun, 18 Sep 2016 17:02:18 -0700 Subject: [PATCH] fix(ello): do not incorrectly identify cards as ELO Fixes: jessepollak/card#268 --- spec/index.spec.coffee | 4 ++++ src/index.coffee | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/index.spec.coffee b/spec/index.spec.coffee index fe0919b..d46e7a6 100644 --- a/spec/index.spec.coffee +++ b/spec/index.spec.coffee @@ -223,6 +223,10 @@ describe 'payment', -> topic = Payment.fns.cardType '4573931212121212' assert.equal topic, 'elo' + it 'should not miscategorize cards with 5067 in them as elo', -> + topic = Payment.fns.cardType '4012506712121212' + assert.equal topic, 'visa' + it 'that is not numbers should return null', -> topic = Payment.fns.cardType 'aoeu' assert.equal topic, null diff --git a/src/index.coffee b/src/index.coffee index 828d68e..c0df84b 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -86,7 +86,7 @@ cards = [ } { type: 'elo' - pattern: /^4011|438935|45(1416|76|7393)|50(4175|6699|67|90[4-7])|63(6297|6368)/, + pattern: /^(4011|438935|45(1416|76|7393)|50(4175|6699|67|90[4-7])|63(6297|6368))/, format: defaultFormat length: [16] cvcLength: [3]