Skip to content

chore(POCP-1226): support 8-digit IINs in card event#270

Draft
lukasz-k-bieszczad-cko wants to merge 3 commits into
masterfrom
chore/POCP-1226/allow-8-digin-inns
Draft

chore(POCP-1226): support 8-digit IINs in card event#270
lukasz-k-bieszczad-cko wants to merge 3 commits into
masterfrom
chore/POCP-1226/allow-8-digin-inns

Conversation

@lukasz-k-bieszczad-cko

@lukasz-k-bieszczad-cko lukasz-k-bieszczad-cko commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

The PO.JS card event exposed a card's IIN capped at 6 digits. Civitatis needs 8 digits to call MercadoPago's GET /installments directly. This widens the SDK's IIN handling to 8 digits.

Solution

  • Card.getIIN cap raised 6 → 8. Canonical IIN extractor, so the card field event and everything derived from the IIN now carries up to 8 digits. Scheme/length/format detection is prefix-based, so no behavioural change for existing 6-digit cards.
  • getCardInformation no longer truncates its input to 6 digits before the iins/{iin} lookup - passes through up to 8. Minimum-length guard (6) unchanged.
  • Dynamic Checkout IIN restriction (restrict_to_iins) matching changed from exact equality to prefix match, so an 8-digit card_iin still matches 6-digit allowlist entries (and vice versa). Guards against cards being wrongly blocked once the event emits 8 digits.

Checklist

  • I bumped the version of the project using yarn bump-version
  • I have checked the code for any potential issues
  • I tested my changes in the browser

Jira Issue

POCP-1226

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SDK’s card IIN handling to support up to 8-digit IINs, enabling more accurate issuer lookups (notably for MercadoPago installments) while preserving compatibility with existing 6-digit behavior.

Changes:

  • Increase IIN extraction cap from 6 → 8 digits in Card.getIIN.
  • Update ProcessOut.getCardInformation to use up to 8 digits for the iins/{iin} lookup (minimum length remains 6).
  • Adjust Dynamic Checkout restrict_to_iins matching from exact equality to prefix-based matching.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/processout/processout.ts Expands IIN lookup in getCardInformation from 6 to 8 digits.
src/processout/card.ts Raises Card.getIIN maximum returned length from 6 to 8 digits.
src/dynamic-checkout/payment-methods/card.ts Changes restrict_to_iins allowlist evaluation to use prefix matching.
package.json Bumps package version to 1.9.8.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dynamic-checkout/payment-methods/card.ts
Comment thread src/processout/processout.ts
@lukasz-k-bieszczad-cko
lukasz-k-bieszczad-cko force-pushed the chore/POCP-1226/allow-8-digin-inns branch from 6245d86 to 42ac592 Compare July 20, 2026 06:53
@lukasz-k-bieszczad-cko

Copy link
Copy Markdown
Contributor Author

Tests

ProcessOut.Card.getIIN("4242424242424242")
'42424242'
po.getCardInformation("42424242", console.log, console.error)
{
    "card_information": {
        "bank_name": "STRIPE PAYMENTS UK LIMITED",
        "brand": "visa classic",
        "category": "consumer",
        "co_scheme": null,
        "combo_card_types": null,
        "country": "GB",
        "scheme": "visa",
        "type": "credit"
    },
    "success": true
}

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants