Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(isCreditCard): add Maestro and InstaPayment card support#2671

Open
abhu85 wants to merge 1 commit intovalidatorjs:masterfrom
abhu85:rescue/maestro-cards-1701
Open

feat(isCreditCard): add Maestro and InstaPayment card support#2671
abhu85 wants to merge 1 commit intovalidatorjs:masterfrom
abhu85:rescue/maestro-cards-1701

Conversation

@abhu85
Copy link

@abhu85 abhu85 commented Mar 2, 2026

Summary

Add credit card validation support for Maestro and InstaPayment card types.

Changes

  • Add maestro card pattern to isCreditCard.js supporting prefixes: 5018, 5020, 5038, 6304, 6759, 6761, 6763 (12-19 digits total)
  • Add instapayment card pattern supporting prefixes: 637, 638, 639 (16 digits total)
  • Add provider-specific tests for both card types with valid Luhn numbers
  • Add test cases to general isCreditCard validation

Background

This PR rescues the stale PR #1701 by @avaly (4.5 years old) which had merge conflicts.

The original PR used a single combined regex approach, but since then the codebase has evolved to use individual provider regexes in a cards object. This implementation follows the current code pattern while preserving the original validation logic.

Test Plan

  • All 319 existing tests pass
  • 100% code coverage maintained
  • Linting passes
  • Test numbers validated with Luhn algorithm

Card Specifications

Maestro:

InstaPayment:

References


Co-Authored-By: avaly [email protected]

Add validation support for:
- Maestro cards (prefixes 5018, 5020, 5038, 6304, 6759, 6761, 6763)
- InstaPayment cards (prefixes 637, 638, 639)

Both card types are added as individual providers with proper tests.

Rescues stale PR validatorjs#1701 (4.5 years old) by rebasing changes onto current
code structure. The original PR used a single regex approach, but the
codebase has since evolved to use individual provider regexes, so this
implementation follows the current pattern.

Original author: @avaly

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: avaly <[email protected]>
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f39bb3b) to head (605b606).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2671   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2592      2592           
  Branches       660       660           
=========================================
  Hits          2592      2592           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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