swift_mt_message/fields/
field50.rs

1//! # Field 50: Ordering Customer
2//!
3//! ## Purpose
4//! Identifies the ordering customer (originator) of the payment instruction. The ordering customer
5//! is the party that instructs the sender of the MT103 to execute the payment. Different options
6//! provide various levels of detail and identification methods for optimal processing efficiency.
7//!
8//! ## Options Overview
9//! - **Option A**: Account + BIC identification (optimal for STP)
10//! - **Option F**: Party identifier + BIC (structured identification)
11//! - **Option K**: Account + Name/Address details (flexible format)
12//! - **Option C**: BIC identification only (institution-based)
13//! - **Option G**: Account + BIC (alternative format)
14//! - **Option H**: Account + Name/Address (alternative format)
15//! - **Option L**: Party identifier only (simplified identification)
16//! - **No Option**: Name/Address only (basic identification)
17//!
18//! ## Usage by Message Type
19//! - **MT103**: Options A, F, K supported (Field50OrderingCustomerAFK)
20//! - **MT101**: Options A, F, K supported for batch payments
21//! - **MT102**: Options available depending on batch type
22//! - **Creditor Payments**: Options A, K supported (Field50Creditor)
23//! - **Instructing Party**: Options C, L supported (Field50InstructingParty)
24//!
25//! ## STP Compliance Guidelines
26//! ### STP Preferred (Optimal Automation)
27//! - **Option A**: Account + BIC - maximum STP efficiency
28//! - **Option F**: Party identifier + BIC - structured processing
29//! - **Option C**: BIC only - institution-based routing
30//!
31//! ### STP Compatible (Good Automation)
32//! - **Option K**: Account + Name/Address with complete information
33//! - **Option G**: Account + BIC alternative format
34//! - **Option H**: Account + Name/Address alternative format
35//!
36//! ### Manual Processing Risk
37//! - **No Option**: Name/Address only - may require manual intervention
38//! - **Option L**: Party identifier only - limited automation
39//!
40//! ## Format Selection Guidelines
41//! ### When to Use Each Option
42//! - **Option A**: Standard customer payments with account and BIC
43//! - **Option F**: Enhanced identification requirements
44//! - **Option K**: Flexible customer identification scenarios
45//! - **Option C**: Institution-to-institution transactions
46//! - **Option G/H**: Alternative formats for specific message types
47//! - **Option L**: Simplified party identification
48//! - **No Option**: Basic customer identification
49//!
50//! ## Business Context Applications
51//! - **Payment Origination**: Customer-initiated payment instructions
52//! - **Corporate Payments**: Business-to-business transaction origination
53//! - **Retail Payments**: Individual customer payment instructions
54//! - **Batch Processing**: Multiple payment origination identification
55//!
56//! ## Network Validation Requirements
57//! - **BIC Validation**: Must be active and reachable in SWIFT network
58//! - **Account Validation**: Must conform to local account standards
59//! - **Character Set**: Standard SWIFT character set compliance
60//! - **Address Standards**: Adequate detail for customer identification
61//!
62//! ## Compliance Framework
63//! - **KYC Standards**: Customer identification and verification
64//! - **AML Requirements**: Anti-money laundering originator screening
65//! - **Regulatory Documentation**: Complete originator record keeping
66//! - **Audit Trail**: Comprehensive origination audit information
67//!
68//! ## Related Fields Integration
69//! - **Field 52A**: Ordering Institution (originator's bank)
70//! - **Field 53A**: Sender's Correspondent (routing)
71//! - **Field 59**: Beneficiary Customer (payment destination)
72//! - **Field 70**: Remittance Information (payment purpose)
73//!
74//! ## Error Prevention Guidelines
75//! - **Complete Information**: Provide full originator identification details
76//! - **Accurate Codes**: Verify BIC codes and account numbers
77//! - **Format Consistency**: Follow established format conventions
78//! - **Compliance Verification**: Screen against sanctions and watch lists
79//!
80//! ## See Also
81//! - Swift FIN User Handbook: Ordering Customer Specifications
82//! - KYC Guidelines: Customer Identification Requirements
83//! - AML/CFT Compliance: Originator Screening Best Practices
84//! - STP Implementation Guide: Ordering Customer Optimization
85
86use serde::{Deserialize, Serialize};
87use swift_mt_message_macros::SwiftField;
88
89/// **Field 50 (No Option): Ordering Customer**
90///
91/// Basic variant of [Field 50 module](index.html). Provides ordering customer identification
92/// using name and address information only.
93///
94/// **Components:**
95/// - Name and address lines (4*35x)
96///
97/// For complete documentation, see the [Field 50 module](index.html).
98#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
99pub struct Field50NoOption {
100    #[component("4*35x")]
101    pub name_and_address: Vec<String>,
102}
103
104/// **Field 50A: Ordering Customer (Option A)**
105///
106/// Account + BIC variant of [Field 50 module](index.html). Provides structured identification
107/// using optional account identifier and numbered name/address lines.
108///
109/// **Components:**
110/// - Party identifier (optional, \[/34x\])
111/// - Name and address lines (4*(1!n/33x))
112///
113/// For complete documentation, see the [Field 50 module](index.html).
114#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
115pub struct Field50A {
116    /// Optional account identifier (IBAN, account number, etc.)
117    /// Format: [/34x] - Up to 34 characters with leading slash
118    #[component("[/34x]")]
119    pub party_identifier: Option<String>,
120
121    /// Name and address lines with mandatory line numbering
122    /// Format: 4*(1!n/33x) - Line number + slash + 33 character text
123    #[component("4*(1!n/33x)")]
124    pub name_and_address: Vec<String>,
125}
126
127/// **Field 50F: Ordering Customer (Option F)**
128///
129/// Party identifier + BIC variant of [Field 50 module](index.html).
130///
131/// **Components:**
132/// - Account (35x)
133/// - BIC (4!a2!a2!c\[3!c\])
134///
135/// For complete documentation, see the [Field 50 module](index.html).
136#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
137pub struct Field50F {
138    #[component("35x")]
139    pub account: String,
140    /// Name and address lines
141    #[component("4!a2!a2!c[3!c]")]
142    pub bic: String,
143}
144
145/// **Field 50K: Ordering Customer (Option K)**
146///
147/// Flexible variant of [Field 50 module](index.html). Provides ordering customer identification
148/// using optional account information and free-format name/address details.
149///
150/// **Components:**
151/// - Account (optional, \[/34x\])
152/// - Name and address lines (4*35x)
153///
154/// For complete documentation, see the [Field 50 module](index.html).
155#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
156pub struct Field50K {
157    /// Optional account identifier (free format)
158    /// Format: \[/34x\] - Up to 34 characters with leading slash
159    #[component("[/34x]")]
160    pub account: Option<String>,
161
162    /// Name and address information in free format
163    /// Format: 4*35x - Up to 4 lines of 35 characters each
164    #[component("4*35x")]
165    pub name_and_address: Vec<String>,
166}
167
168/// **Field 50C: Ordering Customer (Option C)**
169///
170/// BIC-only variant of [Field 50 module](index.html).
171///
172/// **Components:**
173/// - BIC (4!a2!a2!c\[3!c\])
174///
175/// For complete documentation, see the [Field 50 module](index.html).
176#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
177pub struct Field50C {
178    /// BIC code
179    #[component("4!a2!a2!c[3!c]")]
180    pub bic: String,
181}
182
183/// **Field 50L: Ordering Customer (Option L)**
184///
185/// Party identifier variant of [Field 50 module](index.html).
186///
187/// **Components:**
188/// - Party identifier (35x)
189///
190/// For complete documentation, see the [Field 50 module](index.html).
191#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
192pub struct Field50L {
193    #[component("35x")]
194    pub party_identifier: String,
195}
196
197/// **Field 50G: Ordering Customer (Option G)**
198///
199/// Account + BIC variant of [Field 50 module](index.html).
200///
201/// **Components:**
202/// - Account (/34x)
203/// - BIC (4!a2!a2!c\[3!c\])
204///
205/// For complete documentation, see the [Field 50 module](index.html).
206#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
207pub struct Field50G {
208    #[component("/34x")]
209    pub account: String,
210    /// Name and address lines
211    #[component("4!a2!a2!c[3!c]")]
212    pub bic: String,
213}
214
215/// **Field 50H: Ordering Customer (Option H)**
216///
217/// Account + Name/Address variant of [Field 50 module](index.html).
218///
219/// **Components:**
220/// - Account (/34x)
221/// - Name and address lines (4*35x)
222///
223/// For complete documentation, see the [Field 50 module](index.html).
224#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftField)]
225pub struct Field50H {
226    #[component("/34x")]
227    pub account: String,
228    /// Name and address lines
229    #[component("4*35x")]
230    pub name_and_address: Vec<String>,
231}
232
233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
234pub enum Field50InstructingParty {
235    C(Field50C),
236    L(Field50L),
237}
238
239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
240pub enum Field50OrderingCustomerFGH {
241    F(Field50F),
242    G(Field50G),
243    H(Field50H),
244}
245
246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
247pub enum Field50OrderingCustomerAFK {
248    A(Field50A),
249    F(Field50F),
250    K(Field50K),
251}
252
253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
254pub enum Field50OrderingCustomerNCF {
255    NoOption(Field50NoOption),
256    C(Field50C),
257    F(Field50F),
258}
259
260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, SwiftField)]
261pub enum Field50Creditor {
262    A(Field50A),
263    K(Field50K),
264}