open-standards/openpay/crates/op-batch/tests/integration.rs
Transaction Science 6575ff1eb7 Ingest batch 3: 9 more crates across openpay / smart-byte / eoc
openpay/ (+3 crates)
  op-bnpl/        Affirm + Klarna + Afterpay/Clearpay rails. Full lifecycle
                  typestate (Initiated→Approved→Captured→Settled→Refunded).
                  Per-provider sandbox+production base URLs, regions (NA/EU/OC
                  for Klarna; US/AuNz/Gb/Ca/Eu for Afterpay). HMAC-SHA256
                  webhook verification with constant-time compare. 61 tests.
  op-batch/       NACHA ACH (94-char records, PPD/CCD/WEB/TEL/CTX, R01-R99
                  return codes, Same-Day ACH cutoffs); SEPA pain.001.001.09
                  (CT) + pain.008.001.08 (DD) with SCT-Inst flagging; Fedwire
                  MT103/MT202/CHIPS + pacs.008.001.12 / pacs.009.001.10 +
                  UETR; Bacs Standard 18. Per-rail cutoff scheduler. Exception
                  taxonomy unified across rails. 51 tests.
  op-screening/   OFAC SDN + EU consolidated + UN consolidated + HMT UK
                  consolidated + Australia DFAT + Canada SEMA + Japan MOF.
                  Levenshtein + Jaro-Winkler + Soundex + Metaphone + token
                  Jaccard scoring. Unicode NFKD normalisation + Cyrillic /
                  Arabic transliteration. Ed25519-signed BLAKE3-chained
                  audit log. BSA helpers: CTR + SAR pattern detection
                  (structuring, round-dollar, rapid-in-out). 43 tests.

smart-byte/smart-byte-rs/ (+3 crates)
  smart-byte-bbs/      BBS+ signatures (IETF draft-irtf-cfrg-bbs-signatures-08).
                       BLS12-381 keys, signatures, disclosure proofs with
                       cryptographic unlinkability. bbs-2023 Data Integrity
                       cryptosuite. AnonCreds-shaped link secrets +
                       predicate proofs. SecretKey zeroize-on-drop. 49 tests.
  smart-byte-didcomm/  DIDComm v2 messaging per DIF spec. Pack-encrypted
                       (ECDH-1PU + ECDH-ES via X25519), pack-signed (JWS),
                       pack-plaintext. Aries protocols: issue-credential v3,
                       present-proof v3, basic-message, trust-ping, discover-
                       features, out-of-band, coordinate-mediation, message-
                       pickup. Mediator role with pluggable storage. 23 tests.
  smart-byte-mdl/      ISO/IEC 18013-5 mobile driver's licence + 18013-7
                       online presentment. mDoc + MSO with salted-hash
                       selective disclosure (per item; SHA-256 digest tree).
                       org.iso.18013.5.1 namespace + AAMVA add-on. ES256
                       device-auth + issuer-auth. QR-code device-engagement
                       scaffolding. 28 tests.

eoc/eoc-rs/ (+3 crates)
  eoc-local/      Local-inference backends behind one NeuralBackend:
                  llama.cpp (GGUF, Q4/Q5/Q6/Q8/F16/F32 quantisation),
                  MLX (Apple Silicon, feature-gated), MLC-LLM (TVM, feature-
                  gated marker), ONNX Runtime. GGUF file-format reader.
                  HuggingFace tokenizers. Greedy / top-k / top-p / temperature /
                  Mirostat samplers. Model registry scanning ~/.eoc/models/.
                  Joule attribution via eoc-meter. 39 tests.
  eoc-rerank/     BM25 sparse + HNSW dense + RRF + min-max hybrid fusion.
                  Cohere v3.5 + Voyage v2 + bge-reranker v2-m3 + ms-marco
                  MiniLM + ColBERT v2 rerankers. Two-stage pipeline:
                  retrieve top-K hybrid → cross-encoder rerank → top-N.
                  KV-stage recovery shim into the cascade. 31 tests.
  eoc-eval/       15 canonical eval harnesses: MMLU, MMLU-Pro, GPQA,
                  HumanEval (pass@1 with python3 sandbox), BBH, IFEval (25
                  verifiable constraints), AlpacaEval, AGIEval, HellaSwag,
                  ARC (Easy + Challenge), TruthfulQA (MC1+MC2), BoolQ,
                  GSM8K, MATH (boxed-answer equivalence), Winogrande. Real
                  questions in BuiltinSamples. EvalRunner emits joules-per-
                  correct alongside accuracy. 49 tests.

Quality:
- cargo check across all three workspaces: clean
- cargo clippy --all-targets -- -D warnings on every new crate: clean
- 374 new tests, all passing
- #![forbid(unsafe_code)] across every new crate
- No unwrap/expect outside #[cfg(test)]

Rust 1.95.0 edition 2024 (inherited via root rust-toolchain.toml).
2026-05-24 01:09:35 -04:00

68 lines
2.4 KiB
Rust

//! Cross-module integration: build → name → submit → reconcile.
use chrono::TimeZone;
use op_batch::{
BatchRail, FileNaming, Submission, SubmissionSink,
file_io::MemorySink,
nacha::{self, SecCode},
reconciliation::{self, Expected, ReconcileSource, StatementLine},
};
#[test]
fn nacha_build_then_submit_then_reconcile() {
let now = chrono::Utc.with_ymd_and_hms(2026, 6, 1, 12, 0, 0).unwrap();
let profile = nacha::NachaProfile {
odfi_routing: "121000248".into(),
immediate_origin: "1234567890".into(),
immediate_destination: "0210000211".into(),
company_name: "OPENPAY".into(),
company_id: "9876543210".into(),
company_entry_description: "SETTLEMNT".into(),
};
let entries = vec![nacha::EntryDetail {
transaction_code: 22,
rdfi_routing: "021000021".into(),
account_number: "1111".into(),
amount_cents: 100_000,
individual_id: "IND-1".into(),
receiver_name: "ALICE".into(),
discretionary: String::new(),
addenda_indicator: '0',
trace_number: "121000240000001".into(),
}];
let file = nacha::build_file(&profile, SecCode::Ppd, entries, "260602", now).unwrap();
let bytes = file.encode().unwrap();
let filename = FileNaming::nacha(&profile.odfi_routing, now, 1);
assert_eq!(filename, "121000248.20260601.001");
let sink = MemorySink::new();
sink.submit(Submission {
rail: BatchRail::Nacha,
contents: bytes,
filename: filename.clone(),
})
.unwrap();
let stored = sink.get(&filename).unwrap().unwrap();
let parsed = nacha::NachaFile::decode(&stored.contents).unwrap();
assert_eq!(parsed.batches[0].entries.len(), 1);
assert_eq!(parsed.batches[0].entries[0].amount_cents, 100_000);
// Reconcile a synthetic bank statement line back against the entry.
let report = reconciliation::reconcile(
BatchRail::Nacha,
ReconcileSource::NachaPrenote,
&[Expected {
payment_id: "pay-1".into(),
amount_minor: 100_000,
reference: "121000240000001".into(),
}],
&[StatementLine {
statement_ref: "BANKREF-7".into(),
echoed_reference: "121000240000001".into(),
amount_minor: 100_000,
value_date: now,
}],
)
.unwrap();
assert!(report.is_clean());
}