Skip to content

feat(iso): add LifeCycleId for DE-021 encoding and TxnId integration#685

Merged
ar merged 2 commits intomainfrom
feat/lifecycle-id
Mar 28, 2026
Merged

feat(iso): add LifeCycleId for DE-021 encoding and TxnId integration#685
ar merged 2 commits intomainfrom
feat/lifecycle-id

Conversation

@ar-agt
Copy link
Copy Markdown
Collaborator

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

Introduces two new wire-format helper classes in org.jpos.iso:

LifeCycleId — DE-021 Transaction Life Cycle Identification Data

19-byte constructed field correlating messages across a transaction life cycle (authorization through presentment, reversal, chargeback).

Key features:

  • traceId(TxnId) — uses TxnId.toRrn(), right-padded to 15 chars
  • txnId() — returns Optional.empty() for external-network trace IDs
  • toBuilder() — copies all sub-fields for the financial presentment echo pattern
  • Wire: 1-byte indicator + 15-byte ASCII trace + 1-byte N2 BCD seq + 2-byte N4 BCD auth token

MessageErrorIndicator — DE-018 Message Error Indicator

Structured encode/decode for DE-018. Up to 10 error sets, each exactly 14 bytes.

Inner types: ErrorCode (ISO 8583:2023 Table D.15 codes 0001–0013), Severity, FieldError factory methods (primitiveError(), constructedError(), compositeError(), withRawCode()).

Tests

34 tests total — all passing.

agt added 2 commits March 28, 2026 17:30
Introduces MessageErrorIndicator in org.jpos.iso for structured
encoding/decoding of the DE-018 Message Error Indicator field.

- Inner enum ErrorCode: ISO 8583:2023 Table D.15 error codes 0001-0013
- Inner enum Severity: REJECTED (00) / WARNING (01)
- Inner class FieldError: one 14-byte error set with factory methods:
  - primitiveError()    -- primitive DE errors
  - constructedError()  -- sub-element errors in constructed DEs
  - compositeError()    -- dataset/tag errors in composite DEs
  - withRawCode()       -- private/national-use error codes
- pack()/unpack() round-trip: byte-accurate to ISO 8583:2023 §DE-018
- Integrates with ISOMsg via ISOBinaryField(18, mei.pack())
- Full unit test suite: 15 tests covering all error types, severity,
  round-trips, edge cases and ISOMsg integration
LifeCycleId in org.jpos.iso provides structured pack/unpack for the
ISO 8583 Transaction Life Cycle Identification Data field (DE-021).

Key features:
- Fluent builder: supportIndicator(), traceId(TxnId), traceId(String),
  sequenceNumber(), authToken()
- supportIndicator(String mti) derives indicator from ISO 8583 MTI
- traceId(TxnId) uses TxnId.toRrn(), right-padded to 15 chars
- txnId() attempts TxnId.fromRrn() on the trace ID; returns empty
  Optional for external-network trace IDs (never throws)
- toBuilder() copies all sub-fields — supports financial presentment
  echo pattern where seq/token are updated from the authorization
- Wire layout: 1-byte indicator + 15-byte ASCII trace + 1-byte N2 BCD
  sequence number + 2-byte N4 BCD authentication token (19 bytes total)
- 19 unit tests covering all sub-fields, TxnId round-trip, external
  trace IDs, toBuilder independence, and ISOMsg integration
@ar ar merged commit abd8db1 into main Mar 28, 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