Skip to content

feat(iso): add PosCapability for DE-027 encoding#688

Merged
ar merged 1 commit intomainfrom
feat/pos-capability
Mar 29, 2026
Merged

feat(iso): add PosCapability for DE-027 encoding#688
ar merged 1 commit intomainfrom
feat/pos-capability

Conversation

@ar-agt
Copy link
Copy Markdown
Collaborator

@ar-agt ar-agt commented Mar 29, 2026

Introduces PosCapability in org.jpos.iso for structured encode/decode of DE-027 (POS Capability).

Relationship to DE-022

DE-022 (PosDataCode) records what actually happened. DE-027 (PosCapability) records what the terminal is capable of. Sub-fields 27-1 and 27-2 share the same bit tables — so PosDataCode.ReadingMethod and PosDataCode.VerificationMethod are reused directly.

Wire layout (27 bytes fixed)

Sub-field Name Format
27-1 Card reading capability B4 (bit-flags, same as DE-022 sf-1)
27-2 Cardholder verification capability B4 (bit-flags, same as DE-022 sf-2)
27-3 Approval code length N1 ASCII
27-4 Cardholder receipt data length N3 ASCII
27-5 Card acceptor receipt data length N3 ASCII
27-6 Cardholder display data length N3 ASCII
27-7 Card acceptor display data length N3 ASCII
27-8 ICC scripts data length N3 ASCII
27-9 Track 3 rewrite capability A1 Y/N
27-10 Card capture capability A1 Y/N
27-11 PIN input length capability B1 binary

Usage

PosCapability cap = PosCapability.builder()
    .readingCapability(PosDataCode.ReadingMethod.ICC)
    .readingCapability(PosDataCode.ReadingMethod.MAGNETIC_STRIPE)
    .verificationCapability(PosDataCode.VerificationMethod.ONLINE_PIN)
    .approvalCodeLength(6)
    .cardholderReceiptLength(40)
    .pinInputLength(12)
    .build();

msg.set(new ISOBinaryField(27, cap.pack()));

PosCapability received = PosCapability.unpack(msg.getBytes(27));
received.canReadICC();          // true
received.canVerifyOnlinePin();  // true
received.getPinInputLength();   // 12

Tests

35 tests — all passing.

PosCapability in org.jpos.iso provides structured pack/unpack for the
ISO 8583 DE-027 (POS Capability) field.

Key features:
- Sub-fields 27-1 and 27-2 reuse PosDataCode.ReadingMethod and
  PosDataCode.VerificationMethod enums (same bit tables as DE-022)
- Sub-fields 27-3 through 27-8: N1/N3 ASCII capacity values
  (approval code length, receipt/display/ICC script lengths)
- Sub-fields 27-9 and 27-10: Y/N card capture and track 3 rewrite
- Sub-field 27-11: binary PIN input length (0-255)
- Fluent builder with toBuilder() for selective modification
- pack() / unpack() contract identical to LifeCycleId
- 35 unit tests covering all sub-fields, round-trip, toBuilder
  independence, boundary validation, and ISOMsg integration
@ar ar merged commit 87a64ec into main Mar 29, 2026
2 checks passed
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.

2 participants