swift_mt_message/fields/field55.rs
1use serde::{Deserialize, Serialize};
2use swift_mt_message_macros::SwiftField;
3
4/// **Field 55: Third Reimbursement Institution**
5///
6/// ## Purpose
7/// Specifies the Receiver's branch when funds are made available through a different
8/// institution than specified in Field 53A (Sender's Correspondent). This field enables
9/// complex reimbursement chains involving multiple institutions, typically used when
10/// the fund availability institution differs from the primary correspondent relationship.
11/// Essential for sophisticated correspondent banking arrangements.
12///
13/// ## Format Options Overview
14/// - **Option A**: BIC with optional party identifier - structured third institution identification
15/// - **Option B**: Party identifier with location - domestic third institution routing
16/// - **Option D**: Party identifier with name/address - detailed third institution information
17///
18/// ## Business Context Applications
19/// - **Complex Reimbursement**: Multi-institution settlement chains requiring third party
20/// - **Branch Specification**: Receiver's branch when funds available through intermediary
21/// - **Settlement Optimization**: Efficient routing through specialized institutions
22/// - **Regional Networks**: Local institution integration in cross-border payments
23///
24/// ## Usage Rules and Conditions
25/// - **Conditional Presence**: Optional field referenced in Rule C4 correspondent logic
26/// - **Field 54A Dependency**: Typically used when Field 54A contains non-Receiver institution
27/// - **Receiver Branch**: Usually contains Receiver's branch in complex chains
28/// - **Settlement Finalization**: Represents final settlement point for funds availability
29///
30/// ## Network Validation Requirements
31/// - **BIC Registration**: All BIC codes must be registered financial institutions
32/// - **Institution Capability**: Must provide reimbursement and settlement services
33/// - **Operational Status**: Institutions must be operational and reachable
34/// - **Currency Support**: Must support transaction currency and settlement requirements
35///
36/// ## Complex Settlement Scenarios
37/// ### Multi-Institution Chains
38/// - **Field 53A**: Primary correspondent relationship (Sender side)
39/// - **Field 54A**: Intermediary institution for fund availability
40/// - **Field 55A**: Final settlement institution (typically Receiver's branch)
41/// - **Settlement Flow**: Funds flow through multiple institutions to reach final destination
42///
43/// ### Regional Integration
44/// - **Local Presence**: Integration with local banking networks
45/// - **Regulatory Compliance**: Meeting local settlement requirements
46/// - **Currency Optimization**: Efficient local currency settlement
47/// - **Service Specialization**: Leveraging specialized institution capabilities
48///
49/// ## Risk Management Applications
50/// - **Settlement Risk**: Distribution of settlement risk across multiple institutions
51/// - **Operational Risk**: Redundancy and backup settlement paths
52/// - **Counterparty Risk**: Diversification of counterparty exposure
53/// - **Liquidity Management**: Optimization of liquidity across correspondent network
54///
55/// ## Regional Considerations
56/// - **European Networks**: TARGET2 integration and Euro settlement optimization
57/// - **US Systems**: Federal Reserve and commercial bank integration
58/// - **Asian Markets**: Regional banking network integration and local settlement
59/// - **Emerging Markets**: Local institution integration for regulatory compliance
60///
61/// ## STP Processing Benefits
62/// - **Chain Automation**: Automated processing of complex settlement chains
63/// - **Exception Handling**: Structured handling of multi-institution scenarios
64/// - **Settlement Optimization**: Efficient routing through multiple institutions
65/// - **Risk Distribution**: Automated risk assessment across institution chain
66///
67/// ## Error Prevention Guidelines
68/// - **Chain Validation**: Verify complete settlement chain is operational
69/// - **Institution Verification**: Confirm all institutions can provide required services
70/// - **Relationship Checking**: Validate relationships between all chain participants
71/// - **Currency Support**: Ensure all institutions support transaction currency
72///
73/// ## Related Fields Integration
74/// - **Field 53A**: Sender's Correspondent (settlement chain initiation)
75/// - **Field 54A**: Receiver's Correspondent (intermediate settlement)
76/// - **Field 57A**: Account With Institution (final beneficiary bank)
77/// - **Field 32A**: Value Date, Currency, Amount (settlement details)
78///
79/// ## Compliance Framework
80/// - **Multi-Institution Due Diligence**: Enhanced due diligence across institution chain
81/// - **Regulatory Coordination**: Compliance across multiple regulatory jurisdictions
82/// - **Audit Trail**: Complete documentation of multi-institution settlement path
83/// - **Risk Assessment**: Comprehensive risk evaluation across institution chain
84///
85/// ## Settlement Coordination
86/// - **Value Date Alignment**: Coordination of value dates across multiple institutions
87/// - **Cut-off Management**: Alignment with multiple institution processing cut-offs
88/// - **Holiday Coordination**: Management of multiple market holiday calendars
89/// - **Liquidity Planning**: Coordination of liquidity across correspondent network
90///
91/// ## See Also
92/// - Swift FIN User Handbook: Third Reimbursement Institution Specifications
93/// - Correspondent Banking Guidelines: Complex Settlement Chain Management
94/// - Multi-Institution Settlement: Risk and Operational Considerations
95/// - Cross-Border Payments: Advanced Correspondent Banking Arrangements
96///
97/// **Field 55A: Third Reimbursement Institution (BIC with Party Identifier)**
98///
99/// Structured third institution identification using BIC code with optional party identifier.
100/// Used for complex correspondent banking chains requiring additional institutional routing.
101#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
102pub struct Field55A {
103 /// Optional party identifier for third institution account reference
104 ///
105 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
106 /// Used for specialized account identification in complex settlement chains
107 #[component("[/1!a][/34x]")]
108 pub party_identifier: Option<String>,
109
110 /// Bank Identifier Code of the third reimbursement institution
111 ///
112 /// Format: 4!a2!a2!c\[3!c\] - 8 or 11 character BIC code
113 /// Must be registered financial institution BIC
114 #[component("4!a2!a2!c[3!c]")]
115 pub bic: String,
116}
117
118/// **Field 55B: Third Reimbursement Institution (Party Identifier with Location)**
119///
120/// Domestic third institution routing using party identifier and location details.
121/// Used for location-based routing in complex domestic settlement arrangements.
122#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
123pub struct Field55B {
124 /// Optional party identifier for third institution account reference
125 ///
126 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
127 /// Used for specialized routing in complex settlement chains
128 #[component("[/1!a][/34x]")]
129 pub party_identifier: Option<String>,
130
131 /// Location information for third institution routing
132 ///
133 /// Format: \[35x\] - Up to 35 character location identifier
134 /// Used for location-based routing in complex correspondent networks
135 #[component("[35x]")]
136 pub location: Option<String>,
137}
138
139/// **Field 55D: Third Reimbursement Institution (Party Identifier with Name and Address)**
140///
141/// Detailed third institution identification with full name and address information.
142/// Used when structured BIC identification is not available for third institution.
143#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
144pub struct Field55D {
145 /// Optional party identifier for third institution account reference
146 ///
147 /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
148 /// Used for specialized routing in complex settlement chains
149 #[component("[/1!a][/34x]")]
150 pub party_identifier: Option<String>,
151
152 /// Name and address of the third reimbursement institution
153 ///
154 /// Format: 4*35x - Up to 4 lines of 35 characters each
155 /// Contains institution name, address, city, country details
156 #[component("4*35x")]
157 pub name_and_address: Vec<String>,
158}
159
160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
161pub enum Field55ThirdReimbursementInstitution {
162 A(Field55A),
163 B(Field55B),
164 D(Field55D),
165}