Skip to content

fix(JCB): limit the JCB 35 series range to 3528 through 3589 - #1882

Open
zigzagdev wants to merge 2 commits into
Respect:mainfrom
zigzagdev:fix/limit-jcb-number
Open

zigzagdev wants to merge 2 commits into
Respect:mainfrom
zigzagdev:fix/limit-jcb-number

Conversation

@zigzagdev

Copy link
Copy Markdown

Summary

The JCB pattern now accepts only the 35 series prefixes that JCB actually issues.

Motivation

The current pattern accepts every 35 series prefix from 3500 to 3599.
JCB only issues cards in the IIN range 3528 to 3589, so numbers starting with 3500 to 3527 or 3590 to 3599 are wrongly accepted as JCB.

References

What I have done

  • I changed the JCB regex so that the 35 series part matches only prefixes from 3528 to 3589.
  • The 15 digit 2131 and 1800 prefixes and the 16 digit length of the 35 series stay the same, so every number that is really a JCB still passes.

Test Plans

Added the following cases for CreditCard::JCB.

  • Valid: the lower bound 3528000000000007 and the upper bound 3589000000000003
  • Invalid: 3500000000000009 and 3590000000000000

Test Results

docker run --rm validation-test vendor/bin/phpunit --testsuite=unit
PHPUnit 12.5.33 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.12
Configuration: /app/phpunit.xml.dist

.............................................................   61 / 3899 (  1%)
.............................................................  122 / 3899 (  3%)
.............................................................  183 / 3899 (  4%)
.............................................................  244 / 3899 (  6%)
.............................................................  305 / 3899 (  7%)
.............................................................  366 / 3899 (  9%)
.............................................................  427 / 3899 ( 10%)
.............................................................  488 / 3899 ( 12%)
.............................................................  549 / 3899 ( 14%)
.............................................................  610 / 3899 ( 15%)
.............................................................  671 / 3899 ( 17%)
.............................................................  732 / 3899 ( 18%)
.............................................................  793 / 3899 ( 20%)
.............................................................  854 / 3899 ( 21%)
.............................................................  915 / 3899 ( 23%)
.............................................................  976 / 3899 ( 25%)
............................................................. 1037 / 3899 ( 26%)
............................................................. 1098 / 3899 ( 28%)
............................................................. 1159 / 3899 ( 29%)
............................................................. 1220 / 3899 ( 31%)
............................................................. 1281 / 3899 ( 32%)
............................................................. 1342 / 3899 ( 34%)
............................................................. 1403 / 3899 ( 35%)
............................................................. 1464 / 3899 ( 37%)
............................................................. 1525 / 3899 ( 39%)
............................................................. 1586 / 3899 ( 40%)
............................................................. 1647 / 3899 ( 42%)
............................................................. 1708 / 3899 ( 43%)
............................................................. 1769 / 3899 ( 45%)
............................................................. 1830 / 3899 ( 46%)
............................................................. 1891 / 3899 ( 48%)
............................................................. 1952 / 3899 ( 50%)
............................................................. 2013 / 3899 ( 51%)
............................................................. 2074 / 3899 ( 53%)
............................................................. 2135 / 3899 ( 54%)
............................................................. 2196 / 3899 ( 56%)
............................................................. 2257 / 3899 ( 57%)
............................................................. 2318 / 3899 ( 59%)
............................................................. 2379 / 3899 ( 61%)
............................................................. 2440 / 3899 ( 62%)
............................................................. 2501 / 3899 ( 64%)
............................................................. 2562 / 3899 ( 65%)
............................................................. 2623 / 3899 ( 67%)
............................................................. 2684 / 3899 ( 68%)
............................................................. 2745 / 3899 ( 70%)
............................................................. 2806 / 3899 ( 71%)
............................................................. 2867 / 3899 ( 73%)
............................................................. 2928 / 3899 ( 75%)
............................................................. 2989 / 3899 ( 76%)
............................................................. 3050 / 3899 ( 78%)
............................................................. 3111 / 3899 ( 79%)
............................................................. 3172 / 3899 ( 81%)
............................................................. 3233 / 3899 ( 82%)
............................................................. 3294 / 3899 ( 84%)
............................................................. 3355 / 3899 ( 86%)
............................................................. 3416 / 3899 ( 87%)
............................................................. 3477 / 3899 ( 89%)
............................................................. 3538 / 3899 ( 90%)
............................................................. 3599 / 3899 ( 92%)
............................................................. 3660 / 3899 ( 93%)
............................................................. 3721 / 3899 ( 95%)
............................................................. 3782 / 3899 ( 96%)
............................................................. 3843 / 3899 ( 98%)
........................................................      3899 / 3899 (100%)

Time: 00:05.559, Memory: 50.00 MB

OK (3899 tests, 4104 assertions)

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.18%. Comparing base (ecccef1) to head (fd4e096).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1882   +/-   ##
=========================================
  Coverage     97.18%   97.18%           
  Complexity     1096     1096           
=========================================
  Files           198      198           
  Lines          2555     2555           
=========================================
  Hits           2483     2483           
  Misses           72       72           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zigzagdev zigzagdev changed the title Fix/limit jcb number fix(JCB): limit the JCB 35 series range to 3528 through 3589 Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant