pub struct SimpleStatement {
pub account: String,
pub currency: Option<String>,
pub opening_date: NaiveDate,
pub opening_amount: Decimal,
pub closing_date: NaiveDate,
pub closing_amount: Decimal,
pub transactions: Vec<SimpleTransaction>,
}Expand description
A statement: opening/closing balance plus the transactions in between.
Fields§
§account: StringIBAN (or other identification) of the account this statement belongs to.
currency: Option<String>Currency of the statement
opening_date: NaiveDateDate of the opening balance.
opening_amount: DecimalOpening balance, signed (negative when the account is overdrawn).
closing_date: NaiveDateDate of the closing balance.
closing_amount: DecimalClosing balance, signed (negative when the account is overdrawn).
transactions: Vec<SimpleTransaction>Transactions booked between the opening and closing balance.
Implementations§
Source§impl SimpleStatement
impl SimpleStatement
Sourcepub fn to_camt053(&self) -> Result<String, CamtError>
pub fn to_camt053(&self) -> Result<String, CamtError>
Renders this statement as a camt.053.001.02 XML document (a single
Document/BkToCstmrStmt with one Stmt), including an XML
declaration.
This is a minimal but schema-compliant mapping: every field of
SimpleStatement and SimpleTransaction is represented, placed
at the correct position of the camt.053.001.02 schema (see
doc/camt.053.001.02.xsd), so no data is lost and the result
validates against it. Elements that camt.053 requires but that have
no equivalent in the simple model (such as bank transaction codes)
are emitted as empty/minimal but valid placeholders.
§Errors
Returns CamtError::Xml if the XML serialization fails.
Source§impl SimpleStatement
impl SimpleStatement
Sourcepub fn from_statement(statement: &Statement) -> Result<Self, CamtError>
pub fn from_statement(statement: &Statement) -> Result<Self, CamtError>
Builds a SimpleStatement from a raw schema::Statement,
validating that the opening/closing balances match the transaction
sum.
Sourcepub fn from_document(doc: &Document) -> Result<Vec<SimpleStatement>, CamtError>
pub fn from_document(doc: &Document) -> Result<Vec<SimpleStatement>, CamtError>
Converts a full camt.053 Document into a list of SimpleStatements.
Trait Implementations§
Source§impl Clone for SimpleStatement
impl Clone for SimpleStatement
Source§fn clone(&self) -> SimpleStatement
fn clone(&self) -> SimpleStatement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SimpleStatement
impl Debug for SimpleStatement
Source§impl<'a> IntoIterator for &'a SimpleStatement
Iterator for &SimpleStatement over its contained SimpleTransaction items.
impl<'a> IntoIterator for &'a SimpleStatement
Iterator for &SimpleStatement over its contained SimpleTransaction items.