swift_mt_message/fields/
field90.rs

1//! # Field 90: Number & Sum
2//!
3//! ## Purpose
4//! Specifies the number of transactions and total sum for summary and control purposes
5//! in financial messages. This field provides aggregated transaction information that
6//! enables verification, reconciliation, and control totals for transaction batches
7//! and statement processing.
8//!
9//! ## Format Options Overview
10//! - **Option C**: Credit entries - number and sum of credit transactions
11//! - **Option D**: Debit entries - number and sum of debit transactions
12//!
13//! ## Business Context Applications
14//! - **Statement Control**: Summary totals for customer statements
15//! - **Batch Processing**: Control totals for transaction batches
16//! - **Reconciliation**: Verification totals for account reconciliation
17//! - **Audit Control**: Control information for audit purposes
18//!
19//! ## Network Validation Requirements
20//! - **Number Validation**: Transaction count must be valid positive integer
21//! - **Currency Validation**: Must be valid ISO 4217 currency code
22//! - **Amount Format**: Decimal amount with proper precision
23//! - **Logical Consistency**: Numbers and amounts must be logically consistent
24//!
25//! ## Control Total Applications
26//! ### Transaction Counting
27//! - **Credit Count**: Total number of credit transactions
28//! - **Debit Count**: Total number of debit transactions
29//! - **Verification**: Cross-verification with individual transaction entries
30//! - **Completeness**: Ensuring all transactions are included
31//!
32//! ### Amount Summation
33//! - **Credit Sum**: Total amount of all credit transactions
34//! - **Debit Sum**: Total amount of all debit transactions
35//! - **Balance Verification**: Verification against balance changes
36//! - **Precision**: Maintaining precision in summary calculations
37//!
38//! ## Regional Considerations
39//! - **European Banking**: SEPA statement control requirements
40//! - **US Banking**: Federal and commercial bank control standards
41//! - **Asian Markets**: Local banking control and summary requirements
42//! - **Cross-Border**: International summary and control standards
43//!
44//! ## Error Prevention Guidelines
45//! - **Count Verification**: Verify transaction counts match actual entries
46//! - **Amount Verification**: Confirm summary amounts equal individual totals
47//! - **Currency Consistency**: Ensure currency matches transaction currency
48//! - **Precision Checking**: Verify amount precision meets standards
49//!
50//! ## Related Fields Integration
51//! - **Field 61**: Statement Line (individual transactions being summarized)
52//! - **Field 60/62**: Opening/Closing Balance (balance change verification)
53//! - **Field 28C**: Statement Number/Sequence Number (statement context)
54//! - **Field 25**: Account Identification (account context)
55//!
56//! ## Compliance Framework
57//! - **Control Standards**: Meeting banking control and summary standards
58//! - **Audit Requirements**: Providing adequate control information for audits
59//! - **Reconciliation Support**: Supporting account reconciliation processes
60//! - **Quality Control**: Ensuring transaction processing quality
61//!
62//! ## See Also
63//! - Swift FIN User Handbook: Number & Sum Field Specifications
64//! - Banking Control Standards: Transaction Summary Requirements
65//! - Account Statement Standards: Control Total Requirements
66//! - Audit Guidelines: Financial Transaction Control
67
68use serde::{Deserialize, Serialize};
69use swift_mt_message_macros::SwiftField;
70
71/// **Field 90D: Number & Sum of Debit Entries**
72///
73/// Debit variant of [Field 90 module](index.html). Specifies the number and total sum of debit transactions.
74///
75/// **Components:**
76/// - Number of debit transactions (5n)
77/// - Currency code (3!a)
78/// - Total sum of debit amounts (15d)
79///
80/// For complete documentation, see the [Field 90 module](index.html).
81#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
82pub struct Field90D {
83    /// Number of debit transactions
84    ///
85    /// Format: 5n - Up to 5 digit number
86    /// Count of all debit transactions in the summary
87    #[component("5n")]
88    pub number: u32,
89
90    /// Currency of debit amounts
91    ///
92    /// Format: 3!a - ISO 4217 currency code (USD, EUR, GBP, etc.)
93    /// Must match currency of summarized transactions
94    #[component("3!a")]
95    pub currency: String,
96
97    /// Total sum of debit amounts
98    ///
99    /// Format: 15d - Decimal amount with comma separator
100    /// Sum of all debit transaction amounts
101    #[component("15d")]
102    pub amount: f64,
103}
104
105/// **Field 90C: Number & Sum of Credit Entries**
106///
107/// Credit variant of [Field 90 module](index.html). Specifies the number and total sum of credit transactions.
108///
109/// **Components:**
110/// - Number of credit transactions (5n)
111/// - Currency code (3!a)
112/// - Total sum of credit amounts (15d)
113///
114/// For complete documentation, see the [Field 90 module](index.html).
115#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
116pub struct Field90C {
117    /// Number of credit transactions
118    ///
119    /// Format: 5n - Up to 5 digit number
120    /// Count of all credit transactions in the summary
121    #[component("5n")]
122    pub number: u32,
123
124    /// Currency of credit amounts
125    ///
126    /// Format: 3!a - ISO 4217 currency code (USD, EUR, GBP, etc.)
127    /// Must match currency of summarized transactions
128    #[component("3!a")]
129    pub currency: String,
130
131    /// Total sum of credit amounts
132    ///
133    /// Format: 15d - Decimal amount with comma separator
134    /// Sum of all credit transaction amounts
135    #[component("15d")]
136    pub amount: f64,
137}