Skip to main content
Version: v0.0.3

Function: parseTelecom()

parseTelecom(raw, opts?): TelecomTransaction

Parse a raw NCPDP Telecommunication-standard transmission into a frozen TelecomTransaction. Lenient by contract: anything recoverable becomes a warning and the underlying bytes are preserved. Only structurally unrecoverable input throws NcpdpTelecomParseError with a Telecom fatal code.

Parameters

raw

string | Buffer<ArrayBufferLike>

The raw message as a string or Buffer.

opts?

TelecomParseOptions

Optional TelecomParseOptions.

Returns

TelecomTransaction

The decoded transaction.

Throws

NcpdpTelecomParseError on empty input, a missing fixed header, unframeable body bytes, or an untrusted version layout.

Example

const t = parseTelecom(rawClaim);
t.header.transactionCode; // "B1"
t.segments.length; // number of decoded segments