chore(POCP-1226): support 8-digit IINs in card event - #279
Draft
lukasz-k-bieszczad-cko wants to merge 10 commits into
Draft
chore(POCP-1226): support 8-digit IINs in card event#279lukasz-k-bieszczad-cko wants to merge 10 commits into
lukasz-k-bieszczad-cko wants to merge 10 commits into
Conversation
Card.getIIN emitted a flat 8-digit IIN for every scheme, over-exposing the BIN for schemes the backend caps at 6 (notably Amex). Mirror the allow-list in api (controllers/card_inn.go): only visa, mastercard, discover, jcb, union-pay and carte bancaire surface 8 digits; every other scheme - plus unknown or co-badged/ambiguous prefixes - falls back to 6. Applies to both consumers of getIIN: the emitted card_iin field event and the Dynamic Checkout restrict_to_iins prefix match. Note: the backend api-deactivate-eight-digit-bin LaunchDarkly flag is per-project and server-side, so the client cap is scheme-based only.
3 tasks
Copilot stopped reviewing on behalf of
roshan-gorasia-cko due to an error
August 21, 2026 08:56
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Add optional support for 8-digit IIN/BIN handling to improve issuer/scheme accuracy while keeping compatibility with 6-digit IIN flows.
Changes:
- Extend IIN extraction / matching logic to handle 8-digit values (and prefix matching for restrictions).
- Introduce
exposeIIN8option and add card helpers (getIIN8,canExpose8DigitIIN) to enforce when 8 digits may be surfaced. - Update example usage and bump package version.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/processout/processout.ts | Changes IIN extraction used for iins/${iin} API calls to 8 digits. |
| src/processout/cardfield.ts | Adds exposeIIN8 option and propagates it through options parsing; formatting cleanups. |
| src/processout/card.ts | Adds helpers and allow-list logic to decide when 8-digit IIN can be exposed. |
| src/dynamic-checkout/payment-methods/card.ts | Updates restriction matching to support mixed 6/8-digit configured IINs via prefix logic. |
| package.json | Bumps version to 1.9.11. |
| examples/card-form/index.html | Demonstrates enabling exposeIIN8 and adjusts event trigger threshold. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1679
to
+1682
| // Support up to 8-digit IINs (some networks issue 8-digit IINs, which | ||
| // yield more accurate issuer information); fall back to whatever is | ||
| // available when fewer digits were provided. | ||
| const iin = cardNumber.substring(0, 8) |
Comment on lines
+464
to
+471
| /** | ||
| * GetIIN8 returns the IIN of the card number, exposing up to 8 digits | ||
| * when PCI rules allow it (scheme in the allow-list and a 16-digit | ||
| * PAN) and 6 digits otherwise. | ||
| * @param {string} number | ||
| * @return {string} | ||
| */ | ||
| public static getIIN8(number: string): string { |
| * scheme key "union-pay" maps to the backend's "china union pay". | ||
| */ | ||
| private static iin8DigitSchemes: Array<string> = [ | ||
| "visa", "mastercard", "discover", "jcb", "union-pay", "carte bancaire" |
|
|
||
| /** | ||
| * Schemes permitted to surface an 8-digit IIN, mirroring the backend | ||
| * allow-list in api (controllers/card_inn.go). Every other scheme - |
| color: "#ababab", | ||
| }, | ||
| }, | ||
| exposeIIN8: true, |
Comment on lines
+59
to
61
| if (e.card_number_length == 8) { | ||
| client.getCardInformation( | ||
| e.card_iin, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #270