Function: get834Header()
get834Header(
delimiters,tx):X12EnrollmentHeader|undefined
Extract the 834 header - BGN + sponsor (N1*P5) + payer (N1*IN).
Pure function. Returns undefined only if the input transaction's ST-01
is not "834" (mis-routed call). Stops collecting header parties at the
first INS (member-level detail) - those belong to the member stream.
Parameters
delimiters
tx
Returns
X12EnrollmentHeader | undefined
Example
import { parseX12, get834Header } from "@cosyte/x12";
const ix = parseX12(raw);
const tx = ix.groups[0]?.transactions.find((t) => t.st.elements[1] === "834");
const header = tx === undefined ? undefined : get834Header(ix.delimiters, tx);
header?.sponsor?.name;