swift_mt_message/fields/
field54.rs

1use serde::{Deserialize, Serialize};
2use swift_mt_message_macros::SwiftField;
3
4///   **Field 54: Receiver's Correspondent**
5///
6/// ## Purpose
7/// Specifies the branch of the Receiver or financial institution where funds will be made
8/// available in correspondent banking arrangements. This field defines the receiving end
9/// of the correspondent relationship, indicating where funds become available to the Receiver
10/// or through which institution final settlement occurs. Essential for completion of
11/// correspondent banking settlement chains.
12///
13/// ## Format Options Overview
14/// - **Option A**: BIC with optional party identifier - structured receiver correspondent identification
15/// - **Option B**: Party identifier with location - domestic receiver correspondent routing
16/// - **Option D**: Party identifier with name/address - detailed receiver correspondent information
17///
18/// ## Business Context Applications
19/// - **Fund Availability**: Defines where funds become available to the Receiver
20/// - **Settlement Completion**: Final link in correspondent banking settlement chain
21/// - **Branch Specification**: Identifies specific Receiver branch for fund availability
22/// - **Intermediary Institution**: Non-Receiver institution providing fund availability
23///
24/// ## Usage Rules and Conditions
25/// - **Conditional Presence**: Required based on Rule C4 correspondent banking logic
26/// - **Receiver Branch**: Can specify Receiver's branch for fund availability
27/// - **Intermediary Usage**: May reference institution other than Receiver
28/// - **Reimbursement Claims**: Defines reimbursement path when used with Receiver branch
29///
30/// ## Network Validation Requirements
31/// - **BIC Registration**: All BIC codes must be registered financial institutions
32/// - **Institution Validity**: Referenced institutions must be operational and reachable
33/// - **Service Capability**: Institutions must provide correspondent services
34/// - **Currency Support**: Must support transaction currency and settlement
35///
36/// ## Correspondent Banking Integration
37/// - **Field 53A Coordination**: Works with Sender's Correspondent for complete settlement path
38/// - **Field 55A Usage**: Triggers Field 55A when funds available through different institution
39/// - **Direct Relationships**: Enables direct settlement when Receiver branch specified
40/// - **Cover Message Avoidance**: Proper usage can eliminate need for cover messages
41///
42/// ## Regional Considerations
43/// - **European Networks**: TARGET2 correspondent arrangements and Euro settlement
44/// - **US Systems**: Fedwire correspondent relationships and USD clearing
45/// - **Asian Markets**: Regional correspondent networks and local currency settlement
46/// - **Cross-Border**: Multi-currency correspondent arrangements and final settlement
47///
48/// ## Error Prevention Guidelines
49/// - **Relationship Verification**: Confirm correspondent relationships are active
50/// - **Institution Validation**: Verify referenced institutions can provide services
51/// - **Currency Checking**: Ensure institution supports transaction currency
52/// - **Chain Validation**: Verify complete correspondent chain is operational
53///
54/// ## Related Fields Integration
55/// - **Field 53A**: Sender's Correspondent (settlement chain coordination)
56/// - **Field 55A**: Third Reimbursement Institution (complex routing scenarios)
57/// - **Field 57A**: Account With Institution (final beneficiary bank)
58/// - **Field 32A**: Value Date, Currency, Amount (settlement details)
59///
60/// ## STP Processing Benefits
61/// - **Automated Settlement**: System-driven correspondent settlement routing
62/// - **Chain Optimization**: Efficient correspondent banking chain processing
63/// - **Exception Reduction**: Proper correspondent identification reduces delays
64/// - **Straight-Through Processing**: Enhanced STP through structured correspondent data
65///
66/// ## See Also
67/// - Swift FIN User Handbook: Receiver's Correspondent Specifications
68/// - Correspondent Banking Guidelines: Settlement Chain Management
69/// - Cross-Border Payments: Correspondent Banking Settlement
70/// - Risk Management: Correspondent Banking Risk Assessment
71///
72///   **Field 54A: Receiver's Correspondent (BIC with Party Identifier)**
73///
74/// Structured receiver correspondent identification using BIC code with optional party identifier.
75/// Preferred option for automated correspondent banking processing on the receiving end.
76#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
77pub struct Field54A {
78    /// Optional party identifier for correspondent account reference
79    ///
80    /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier  
81    /// Used for vostro account identification and receiver correspondent routing
82    #[component("[/1!a][/34x]")]
83    pub party_identifier: Option<String>,
84
85    /// Bank Identifier Code of the receiver's correspondent
86    ///
87    /// Format: 4!a2!a2!c\[3!c\] - 8 or 11 character BIC code
88    /// Must be registered financial institution BIC
89    #[component("4!a2!a2!c[3!c]")]
90    pub bic: String,
91}
92
93///   **Field 54B: Receiver's Correspondent (Party Identifier with Location)**
94///
95/// Domestic receiver correspondent routing using party identifier and location details.
96/// Used for location-based routing in domestic correspondent arrangements.
97#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
98pub struct Field54B {
99    /// Optional party identifier for correspondent account reference
100    ///
101    /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
102    /// Used for vostro account identification in domestic systems
103    #[component("[/1!a][/34x]")]
104    pub party_identifier: Option<String>,
105
106    /// Location information for receiver correspondent routing
107    ///
108    /// Format: \[35x\] - Up to 35 character location identifier
109    /// Used for location-based routing within domestic correspondent networks
110    #[component("[35x]")]
111    pub location: Option<String>,
112}
113
114///   **Field 54D: Receiver's Correspondent (Party Identifier with Name and Address)**
115///
116/// Detailed receiver correspondent identification with full name and address information.
117/// Used when structured BIC identification is not available for receiver correspondent.
118#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
119pub struct Field54D {
120    /// Optional party identifier for correspondent account reference
121    ///
122    /// Format: \[/1!a\]\[/34x\] - Single character code + up to 34 character identifier
123    /// Used for vostro account identification and receiver correspondent routing
124    #[component("[/1!a][/34x]")]
125    pub party_identifier: Option<String>,
126
127    /// Name and address of the receiver's correspondent
128    ///
129    /// Format: 4*35x - Up to 4 lines of 35 characters each
130    /// Contains correspondent name, address, city, country details
131    #[component("4*35x")]
132    pub name_and_address: Vec<String>,
133}
134
135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
136pub enum Field54ReceiverCorrespondent {
137    A(Field54A),
138    B(Field54B),
139    D(Field54D),
140}