Skip to main content

Crate use_bai2

Crate use_bai2 

Source
Expand description

§use-bai2

Initial BAI2 banking file primitives for RustUse finance crates.

use-bai2 provides conservative BAI2 record-code parsing, typed record wrappers, continuation handling, basic validation, and normalized transaction detail output. It intentionally preserves raw codes where the BAI2 standard can expand later.

§Example

use use_bai2::{parse_logical_records, NormalizedTransaction, TransactionDetailRecord};

let records = parse_logical_records("16,475,12345,Z,bank-ref,customer-ref,payment/\n")?;
let detail = TransactionDetailRecord::try_from(&records[0])?;
let normalized = NormalizedTransaction::from_detail(&detail)?;

assert_eq!(normalized.amount().minor_units(), 12_345);

§Scope

Use this crate for first-pass BAI2 parsing and validation. It does not fully enumerate every BAI2 type code, connect to banks, fetch statements, process ACH or wires, or perform reconciliation.

§License

Licensed under either MIT or Apache-2.0.

Modules§

prelude
Common BAI2 primitives.

Structs§

AccountIdentifierRecord
BAI2 account identifier record.
AccountTrailerRecord
BAI2 account trailer record.
ContinuationRecord
BAI2 continuation record.
FileHeaderRecord
BAI2 file header record.
FileTrailerRecord
BAI2 file trailer record.
FundsTypeCode
A raw BAI2 funds type code.
GroupHeaderRecord
BAI2 group header record.
GroupTrailerRecord
BAI2 group trailer record.
NormalizedTransaction
A normalized transaction detail value.
RawRecord
A parsed BAI2 record with raw fields preserved.
TransactionDetailRecord
BAI2 transaction detail record.
TransactionTypeCode
A raw BAI2 transaction type code.

Enums§

Bai2Error
Errors returned by BAI2 parsing and validation.
RecordCode
Supported BAI2 record codes.

Functions§

parse_line
Parses a single slash-terminated BAI2 line.
parse_logical_records
Parses BAI2 lines and folds 88 continuation records into the previous logical record.