Skip to content

Commit

Permalink
Merge pull request #735 from recurly/enable-cup-for-stripe
Browse files Browse the repository at this point in the history
[OFL-597] Add more BIN ranges for UnionPay
  • Loading branch information
tilley-kyle authored Jul 5, 2022
2 parents f6725ca + b98b31f commit e3ae63c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
- secure: fGRo+RTDcnWNnYjSgDtHIRFrkXDxYzFrF0JaGs73ZunLXoYbJ5FclaM9+wjw8BbGEEsVbyBYMSHyy8E2Y0VRggal/XlFkKaqQQHSDVuslcM5YdAkcLC8jFSuSzP32X6cY+L9fKszFVaO+vn84lXwiQnqgpOHAtN32/eB//5Ky1s=
- secure: MmcELlODnZq5EdfKqp8YQBaWHTL76oK8GAbvMaY+MBEj+ddiWRj9xnkU9mKB488Zh/G3sqiqv80QeIPhWzL+cjSXj2v6oCy+PML+aWiWq7KlhSogxjVQrMN0VXew8DKC4/9FwdNf/irNcCm6UaiI0Fw6UcCZ+kVGw4301fciAkw=
- secure: Vyedcxqn04Or/NZLOeK+pii6YulrSNQrDHCPmoXQh9IVeefOF4NujL/d7+PQuKiRUED3AOw6Ziib6oDzpFamTXXl5SJ4xeKS6V9NpHXunLUlLCuv37siQ+96WvN8r5IHs0BJV/hVKCFbk7IosEdnK1OAx6KyVpYctNdf4qWa4O4=
script: make test-unit-ci
script: travis_retry make test-unit-ci
jobs:
include:
- stage: Check
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
stage: End-to-End Test
name: Chrome
env: BROWSER=BrowserStackChrome
script: make test-e2e-ci
script: travis_retry make test-e2e-ci
- <<: *e2e
name: Firefox
env: BROWSER=BrowserStackFirefox
Expand Down
21 changes: 12 additions & 9 deletions lib/recurly/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ const TYPES = [
test: (n) => {
const firstEight = parseInt(n.substr(0, 8), 10);
const acceptedRanges = [
[62109400, 62109499],
[62212600, 62292599],
[62400000, 62699999],
[62820000, 62889999],
[81000000, 81099999],
[81100000, 81319999],
[81320000, 81519999],
[81520000, 81639999],
[81640000, 81719999]
[62000000, 62099999],
[62100000, 62182999],
[62184000, 62197999],
[62200000, 62699999],
[62700000, 62709999],
[62720000, 62729999],
[62760000, 62769999],
[62770000, 62777999],
[62778100, 62779999],
[62820000, 62899999],
[62910000, 62929999],
[81000000, 81719999]
];

if (!(/^6[2]/.test(firstEight)) && !(/^8[1]/.test(firstEight))) return false;
Expand Down
6 changes: 4 additions & 2 deletions test/unit/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ describe('Recurly.validate', function () {
});

it('should parse union_pay', function () {
assert.strictEqual(recurly.validate.cardType('6219803011113245'), 'unknown');
assert.strictEqual(recurly.validate.cardType('621093991111324'), 'unknown');
assert.strictEqual(recurly.validate.cardType('6210939911113245'), 'unknown');
assert.strictEqual(recurly.validate.cardType('6210950011113245'), 'unknown');
assert.strictEqual(recurly.validate.cardType('6210939911113245'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('6210950011113245'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('6210940011113245'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('6210949911113245'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('8171999927660000'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('6200000000000005'), 'union_pay');
assert.strictEqual(recurly.validate.cardType('8171999900000000021'), 'union_pay');
});

Expand Down

0 comments on commit e3ae63c

Please sign in to comment.