sepa
π¦ SEPA payment utilities for Rust. β‘ Zero I/O. No async. π’ No
f64in monetary arithmetic.
β¨ Features
| Module | What it provides |
|---|---|
iban |
π IBAN validation β ISO 13616 mod-97 + 56-country length registry |
bic |
π BIC/SWIFT validation β ISO 9362 |
creditor_id |
π SEPA Creditor Identifier β EPC AT-02 |
pain001 |
π€ pain.001 XML builder β SCT (003.03) + SCT Instant (001.09) |
pain008 |
π€ pain.008 XML builder β SDD CORE + B2B |
pain002 |
π₯ pain.002 XML parser β Payment Status Report (bank β customer) |
camt053 |
π₯ camt.053 XML parser β Bank-to-Customer Statement (end-of-day) |
camt054 |
π₯ camt.054 typed entry β Bank-to-Customer Notification |
ct_to_eur_str / ct_from_eur_str |
πΆ Integer-safe i64 ct β "1234.56" round-trip |
All commonly used types are re-exported at the crate root (sepa::SequenceType, sepa::DirectDebitScheme, β¦).
π Quick start
[]
= "0.3"
π€ Building payment files
use ;
let creditor = validate_iban.unwrap;
assert_eq!; // BBAN accessor
assert_eq!; // grouped Display
// pain.008 β SEPA Core Direct Debit (Lastschrift)
let dd_xml = new
.msg_id
.sequence_type
.add_entry
.build_xml;
// pain.008 β SEPA B2B Direct Debit
let _b2b = new
.scheme
.add_entry
.build_xml;
// pain.001 β SEPA Credit Transfer (Γberweisung)
let ct_xml = new
.msg_id
.add_entry
.build_xml;
// β‘ pain.001 β SCT Instant (10-second settlement, pain.001.001.09 namespace)
let _inst = new
.local_instrument
.add_entry
.build_xml;
πΎ Streaming large batches (no intermediate String)
use ;
use BufWriter;
use File;
let iban = validate_iban.unwrap;
let builder = new
.msg_id;
// β¦ .add_entry(β¦) Γ 10 000 β¦
// Streams directly to file β zero intermediate String allocation
let file = create.unwrap;
builder.write_xml_to_io.unwrap;
π₯ Parsing bank responses
pain.002 β Payment Status Report
use ;
// xml: &str received from bank via EBICS/FinTS
let doc = parse_pain002.unwrap;
if doc.is_fully_accepted else
camt.053 β End-of-Day Statement
use parse_camt053;
// xml: &str received from bank (camt.053.001.02 / .06 / .08 all accepted)
let doc = parse_camt053.unwrap;
let stmt = &doc.statements;
println!;
println!;
for entry in &stmt.entries
camt.054 β Intraday Notifications (json feature)
= { = "0.3", = ["json"] }
use parse_simple_json;
let entry = parse_simple_json.unwrap;
assert_eq!;
assert_eq!; // credit β negative in open-items
π Standards
| Standard | Module | Notes |
|---|---|---|
| ISO 13616-1 + SWIFT IBAN Registry | iban |
56-country length table |
| ISO 9362 | bic |
8- and 11-char BIC |
| EPC AT-02 | creditor_id |
SEPA Creditor Identifier |
| ISO 20022 pain.001.003.03 | pain001 |
SCT β DK V2.7, German banking default |
| ISO 20022 pain.001.001.09 | pain001 |
SCT Instant β EPC Rulebook 2021+ |
| ISO 20022 pain.008.003.02 | pain008 |
SDD CORE + B2B |
| ISO 20022 pain.002 (all variants) | pain002 |
namespace-agnostic parser |
| ISO 20022 camt.053 (all variants) | camt053 |
namespace-agnostic parser |
| ISO 20022 camt.054 | camt054 |
notification types |
| EPC SEPA Rulebooks | all | SCT, SDD Core, SDD B2B, SCT Inst |
π¦ Dependencies
| Crate | Role |
|---|---|
thiserror |
Ergonomic error derives (required) |
serde |
Serialize/Deserialize on all types (serde feature) |
serde_json |
camt054::parse_simple_json (json feature) |
π License
Licensed under either of MIT or Apache-2.0, at your option.