mx_message/document/
camt_106_001_02_mc.rs

1// Plasmatic MX Message Parsing Library
2// https://github.com/GoPlasmatic/MXMessage
3//
4// Copyright (c) 2025 Plasmatic
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9//     http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// You may obtain a copy of this library at
18// https://github.com/GoPlasmatic/MXMessage
19use crate::parse_result::{ErrorCollector, ParserConfig};
20use crate::validation::{Validate, helpers};
21use serde::{Deserialize, Serialize};
22
23// AccountIdentification4Choice1: Unique identification of an account, as assigned by the account servicer, using an identification scheme.
24#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
25pub struct AccountIdentification4Choice1 {
26    #[serde(rename = "IBAN", skip_serializing_if = "Option::is_none")]
27    pub iban: Option<String>,
28    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
29    pub othr: Option<GenericAccountIdentification11>,
30}
31
32impl Validate for AccountIdentification4Choice1 {
33    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
34        if let Some(ref val) = self.iban {
35            helpers::validate_pattern(
36                val,
37                "IBAN",
38                "[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}",
39                &helpers::child_path(path, "IBAN"),
40                config,
41                collector,
42            );
43        }
44        if let Some(ref val) = self.othr
45            && config.validate_optional_fields
46        {
47            val.validate(&helpers::child_path(path, "Othr"), config, collector);
48        }
49    }
50}
51
52// AccountSchemeName1Choice1: Name of the identification scheme, in a free text form.
53#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
54pub struct AccountSchemeName1Choice1 {
55    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
56    pub cd: Option<String>,
57    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
58    pub prtry: Option<String>,
59}
60
61impl Validate for AccountSchemeName1Choice1 {
62    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
63        if let Some(ref val) = self.cd {
64            helpers::validate_length(
65                val,
66                "Cd",
67                Some(1),
68                Some(4),
69                &helpers::child_path(path, "Cd"),
70                config,
71                collector,
72            );
73        }
74        if let Some(ref val) = self.prtry {
75            helpers::validate_length(
76                val,
77                "Prtry",
78                Some(1),
79                Some(35),
80                &helpers::child_path(path, "Prtry"),
81                config,
82                collector,
83            );
84        }
85        if let Some(ref val) = self.prtry {
86            helpers::validate_pattern(
87                val,
88                "Prtry",
89                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
90                &helpers::child_path(path, "Prtry"),
91                config,
92                collector,
93            );
94        }
95    }
96}
97
98// BranchAndFinancialInstitutionIdentification81: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
99#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
100pub struct BranchAndFinancialInstitutionIdentification81 {
101    #[serde(rename = "FinInstnId")]
102    pub fin_instn_id: FinancialInstitutionIdentification231,
103}
104
105impl Validate for BranchAndFinancialInstitutionIdentification81 {
106    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
107        self.fin_instn_id
108            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
109    }
110}
111
112// CBPRAmount: CBPR_Amount
113#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
114pub struct CBPRAmount {
115    #[serde(rename = "@Ccy")]
116    pub ccy: String,
117    #[serde(rename = "$value")]
118    pub value: f64,
119}
120
121impl Validate for CBPRAmount {
122    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
123}
124
125// CashAccount401: Specifies an alternate assumed name for the identification of the account.
126#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
127pub struct CashAccount401 {
128    #[serde(rename = "Id")]
129    pub id: AccountIdentification4Choice1,
130    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
131    pub tp: Option<CashAccountType2Choice1>,
132    #[serde(rename = "Ccy", skip_serializing_if = "Option::is_none")]
133    pub ccy: Option<String>,
134    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
135    pub nm: Option<String>,
136    #[serde(rename = "Prxy", skip_serializing_if = "Option::is_none")]
137    pub prxy: Option<ProxyAccountIdentification11>,
138}
139
140impl Validate for CashAccount401 {
141    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
142        self.id
143            .validate(&helpers::child_path(path, "Id"), config, collector);
144        if let Some(ref val) = self.tp
145            && config.validate_optional_fields
146        {
147            val.validate(&helpers::child_path(path, "Tp"), config, collector);
148        }
149        if let Some(ref val) = self.ccy {
150            helpers::validate_pattern(
151                val,
152                "Ccy",
153                "[A-Z]{3,3}",
154                &helpers::child_path(path, "Ccy"),
155                config,
156                collector,
157            );
158        }
159        if let Some(ref val) = self.nm {
160            helpers::validate_length(
161                val,
162                "Nm",
163                Some(1),
164                Some(70),
165                &helpers::child_path(path, "Nm"),
166                config,
167                collector,
168            );
169        }
170        if let Some(ref val) = self.nm {
171            helpers::validate_pattern(
172                val,
173                "Nm",
174                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
175                &helpers::child_path(path, "Nm"),
176                config,
177                collector,
178            );
179        }
180        if let Some(ref val) = self.prxy
181            && config.validate_optional_fields
182        {
183            val.validate(&helpers::child_path(path, "Prxy"), config, collector);
184        }
185    }
186}
187
188// CashAccountType2Choice1: Nature or use of the account in a proprietary form.
189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
190pub struct CashAccountType2Choice1 {
191    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
192    pub cd: Option<String>,
193    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
194    pub prtry: Option<String>,
195}
196
197impl Validate for CashAccountType2Choice1 {
198    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
199        if let Some(ref val) = self.cd {
200            helpers::validate_length(
201                val,
202                "Cd",
203                Some(1),
204                Some(4),
205                &helpers::child_path(path, "Cd"),
206                config,
207                collector,
208            );
209        }
210        if let Some(ref val) = self.prtry {
211            helpers::validate_length(
212                val,
213                "Prtry",
214                Some(1),
215                Some(35),
216                &helpers::child_path(path, "Prtry"),
217                config,
218                collector,
219            );
220        }
221        if let Some(ref val) = self.prtry {
222            helpers::validate_pattern(
223                val,
224                "Prtry",
225                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
226                &helpers::child_path(path, "Prtry"),
227                config,
228                collector,
229            );
230        }
231    }
232}
233
234// ChargeType3Choice1: Charge type, in a coded form.
235#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
236pub struct ChargeType3Choice1 {
237    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
238    pub cd: Option<String>,
239}
240
241impl Validate for ChargeType3Choice1 {
242    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
243        if let Some(ref val) = self.cd {
244            helpers::validate_length(
245                val,
246                "Cd",
247                Some(1),
248                Some(4),
249                &helpers::child_path(path, "Cd"),
250                config,
251                collector,
252            );
253        }
254    }
255}
256
257// Charges3Choice1: Charges broken down per payment transaction.
258#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
259pub struct Charges3Choice1 {
260    #[serde(rename = "PerTx", skip_serializing_if = "Option::is_none")]
261    pub per_tx: Option<ChargesPerTransaction31>,
262}
263
264impl Validate for Charges3Choice1 {
265    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
266        if let Some(ref val) = self.per_tx
267            && config.validate_optional_fields
268        {
269            val.validate(&helpers::child_path(path, "PerTx"), config, collector);
270        }
271    }
272}
273
274// ChargesBreakdown11: Specifies the type of charge.
275#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
276pub struct ChargesBreakdown11 {
277    #[serde(rename = "Amt")]
278    pub amt: CBPRAmount,
279    #[serde(rename = "CdtDbtInd")]
280    pub cdt_dbt_ind: CreditDebitCode1,
281    #[serde(rename = "Tp")]
282    pub tp: ChargeType3Choice1,
283}
284
285impl Validate for ChargesBreakdown11 {
286    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
287        self.amt
288            .validate(&helpers::child_path(path, "Amt"), config, collector);
289        self.cdt_dbt_ind
290            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
291        self.tp
292            .validate(&helpers::child_path(path, "Tp"), config, collector);
293    }
294}
295
296// ChargesPaymentRequestV02: Provides information on the charges to be paid by the charge bearer(s) related to the processing of the underlying transaction.
297#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
298pub struct ChargesPaymentRequestV02 {
299    #[serde(rename = "GrpHdr")]
300    pub grp_hdr: GroupHeader1151,
301    #[serde(rename = "Chrgs")]
302    pub chrgs: Charges3Choice1,
303}
304
305impl Validate for ChargesPaymentRequestV02 {
306    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
307        self.grp_hdr
308            .validate(&helpers::child_path(path, "GrpHdr"), config, collector);
309        self.chrgs
310            .validate(&helpers::child_path(path, "Chrgs"), config, collector);
311    }
312}
313
314// ChargesPerTransaction31: Itemised charges record per transaction.
315#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
316pub struct ChargesPerTransaction31 {
317    #[serde(rename = "ChrgsId")]
318    pub chrgs_id: String,
319    #[serde(rename = "Rcrd")]
320    pub rcrd: Vec<ChargesPerTransactionRecord31>,
321}
322
323impl Validate for ChargesPerTransaction31 {
324    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
325        helpers::validate_length(
326            &self.chrgs_id,
327            "ChrgsId",
328            Some(1),
329            Some(16),
330            &helpers::child_path(path, "ChrgsId"),
331            config,
332            collector,
333        );
334        helpers::validate_pattern(
335            &self.chrgs_id,
336            "ChrgsId",
337            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
338            &helpers::child_path(path, "ChrgsId"),
339            config,
340            collector,
341        );
342        for item in &self.rcrd {
343            item.validate(&helpers::child_path(path, "Rcrd"), config, collector);
344        }
345    }
346}
347
348// ChargesPerTransactionRecord31: Further information related to the processing of the payment adjustment instruction that may need to be acted upon by the next agent.
349#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
350pub struct ChargesPerTransactionRecord31 {
351    #[serde(rename = "RcrdId", skip_serializing_if = "Option::is_none")]
352    pub rcrd_id: Option<String>,
353    #[serde(rename = "ChrgsRqstr")]
354    pub chrgs_rqstr: BranchAndFinancialInstitutionIdentification81,
355    #[serde(rename = "UndrlygTx")]
356    pub undrlyg_tx: TransactionReferences71,
357    #[serde(rename = "TtlChrgsPerRcrd")]
358    pub ttl_chrgs_per_rcrd: TotalCharges81,
359    #[serde(rename = "ChrgsBrkdwn")]
360    pub chrgs_brkdwn: Vec<ChargesBreakdown11>,
361    #[serde(rename = "DbtrAgt", skip_serializing_if = "Option::is_none")]
362    pub dbtr_agt: Option<BranchAndFinancialInstitutionIdentification81>,
363    #[serde(rename = "DbtrAgtAcct", skip_serializing_if = "Option::is_none")]
364    pub dbtr_agt_acct: Option<CashAccount401>,
365    #[serde(rename = "InstrForInstdAgt", skip_serializing_if = "Option::is_none")]
366    pub instr_for_instd_agt: Option<InstructionForInstructedAgent11>,
367}
368
369impl Validate for ChargesPerTransactionRecord31 {
370    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
371        if let Some(ref val) = self.rcrd_id {
372            helpers::validate_length(
373                val,
374                "RcrdId",
375                Some(1),
376                Some(35),
377                &helpers::child_path(path, "RcrdId"),
378                config,
379                collector,
380            );
381        }
382        if let Some(ref val) = self.rcrd_id {
383            helpers::validate_pattern(
384                val,
385                "RcrdId",
386                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
387                &helpers::child_path(path, "RcrdId"),
388                config,
389                collector,
390            );
391        }
392        self.chrgs_rqstr
393            .validate(&helpers::child_path(path, "ChrgsRqstr"), config, collector);
394        self.undrlyg_tx
395            .validate(&helpers::child_path(path, "UndrlygTx"), config, collector);
396        self.ttl_chrgs_per_rcrd.validate(
397            &helpers::child_path(path, "TtlChrgsPerRcrd"),
398            config,
399            collector,
400        );
401        for item in &self.chrgs_brkdwn {
402            item.validate(&helpers::child_path(path, "ChrgsBrkdwn"), config, collector);
403        }
404        if let Some(ref val) = self.dbtr_agt
405            && config.validate_optional_fields
406        {
407            val.validate(&helpers::child_path(path, "DbtrAgt"), config, collector);
408        }
409        if let Some(ref val) = self.dbtr_agt_acct
410            && config.validate_optional_fields
411        {
412            val.validate(&helpers::child_path(path, "DbtrAgtAcct"), config, collector);
413        }
414        if let Some(ref val) = self.instr_for_instd_agt
415            && config.validate_optional_fields
416        {
417            val.validate(
418                &helpers::child_path(path, "InstrForInstdAgt"),
419                config,
420                collector,
421            );
422        }
423    }
424}
425
426// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
427#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
428pub struct ClearingSystemIdentification2Choice1 {
429    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
430    pub cd: Option<String>,
431}
432
433impl Validate for ClearingSystemIdentification2Choice1 {
434    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
435        if let Some(ref val) = self.cd {
436            helpers::validate_length(
437                val,
438                "Cd",
439                Some(1),
440                Some(5),
441                &helpers::child_path(path, "Cd"),
442                config,
443                collector,
444            );
445        }
446    }
447}
448
449// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
450#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
451pub struct ClearingSystemMemberIdentification21 {
452    #[serde(rename = "ClrSysId")]
453    pub clr_sys_id: ClearingSystemIdentification2Choice1,
454    #[serde(rename = "MmbId")]
455    pub mmb_id: String,
456}
457
458impl Validate for ClearingSystemMemberIdentification21 {
459    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
460        self.clr_sys_id
461            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
462        helpers::validate_length(
463            &self.mmb_id,
464            "MmbId",
465            Some(1),
466            Some(28),
467            &helpers::child_path(path, "MmbId"),
468            config,
469            collector,
470        );
471        helpers::validate_pattern(
472            &self.mmb_id,
473            "MmbId",
474            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
475            &helpers::child_path(path, "MmbId"),
476            config,
477            collector,
478        );
479    }
480}
481
482// CreditDebitCode__1: Operation is a decrease.
483#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
484pub enum CreditDebitCode1 {
485    #[default]
486    #[serde(rename = "DBIT")]
487    CodeDBIT,
488}
489
490impl Validate for CreditDebitCode1 {
491    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
492        // Enum validation is typically empty
493    }
494}
495
496// FinancialInstitutionIdentification231: Information that locates and identifies a specific address, as defined by postal services.
497#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
498pub struct FinancialInstitutionIdentification231 {
499    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
500    pub bicfi: Option<String>,
501    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
502    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
503    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
504    pub lei: Option<String>,
505    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
506    pub nm: Option<String>,
507    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
508    pub pstl_adr: Option<PostalAddress271>,
509}
510
511impl Validate for FinancialInstitutionIdentification231 {
512    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
513        if let Some(ref val) = self.bicfi {
514            helpers::validate_pattern(
515                val,
516                "BICFI",
517                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
518                &helpers::child_path(path, "BICFI"),
519                config,
520                collector,
521            );
522        }
523        if let Some(ref val) = self.clr_sys_mmb_id
524            && config.validate_optional_fields
525        {
526            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
527        }
528        if let Some(ref val) = self.lei {
529            helpers::validate_pattern(
530                val,
531                "LEI",
532                "[A-Z0-9]{18,18}[0-9]{2,2}",
533                &helpers::child_path(path, "LEI"),
534                config,
535                collector,
536            );
537        }
538        if let Some(ref val) = self.nm {
539            helpers::validate_length(
540                val,
541                "Nm",
542                Some(1),
543                Some(140),
544                &helpers::child_path(path, "Nm"),
545                config,
546                collector,
547            );
548        }
549        if let Some(ref val) = self.nm {
550            helpers::validate_pattern(
551                val,
552                "Nm",
553                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
554                &helpers::child_path(path, "Nm"),
555                config,
556                collector,
557            );
558        }
559        if let Some(ref val) = self.pstl_adr
560            && config.validate_optional_fields
561        {
562            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
563        }
564    }
565}
566
567// GenericAccountIdentification11: Entity that assigns the identification.
568#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
569pub struct GenericAccountIdentification11 {
570    #[serde(rename = "Id")]
571    pub id: String,
572    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
573    pub schme_nm: Option<AccountSchemeName1Choice1>,
574    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
575    pub issr: Option<String>,
576}
577
578impl Validate for GenericAccountIdentification11 {
579    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
580        helpers::validate_length(
581            &self.id,
582            "Id",
583            Some(1),
584            Some(34),
585            &helpers::child_path(path, "Id"),
586            config,
587            collector,
588        );
589        helpers::validate_pattern(
590            &self.id,
591            "Id",
592            "([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]([0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ]*(/[0-9a-zA-Z\\-\\?:\\(\\)\\.,'\\+ ])?)*)",
593            &helpers::child_path(path, "Id"),
594            config,
595            collector,
596        );
597        if let Some(ref val) = self.schme_nm
598            && config.validate_optional_fields
599        {
600            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
601        }
602        if let Some(ref val) = self.issr {
603            helpers::validate_length(
604                val,
605                "Issr",
606                Some(1),
607                Some(35),
608                &helpers::child_path(path, "Issr"),
609                config,
610                collector,
611            );
612        }
613        if let Some(ref val) = self.issr {
614            helpers::validate_pattern(
615                val,
616                "Issr",
617                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
618                &helpers::child_path(path, "Issr"),
619                config,
620                collector,
621            );
622        }
623    }
624}
625
626// GroupHeader1151: Account of the agent that services the charges account.
627#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
628pub struct GroupHeader1151 {
629    #[serde(rename = "MsgId")]
630    pub msg_id: String,
631    #[serde(rename = "CreDtTm")]
632    pub cre_dt_tm: String,
633    #[serde(rename = "TtlChrgs")]
634    pub ttl_chrgs: TotalCharges71,
635    #[serde(rename = "ChrgsAcctAgt", skip_serializing_if = "Option::is_none")]
636    pub chrgs_acct_agt: Option<BranchAndFinancialInstitutionIdentification81>,
637    #[serde(rename = "ChrgsAcctAgtAcct", skip_serializing_if = "Option::is_none")]
638    pub chrgs_acct_agt_acct: Option<CashAccount401>,
639}
640
641impl Validate for GroupHeader1151 {
642    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
643        helpers::validate_length(
644            &self.msg_id,
645            "MsgId",
646            Some(1),
647            Some(35),
648            &helpers::child_path(path, "MsgId"),
649            config,
650            collector,
651        );
652        helpers::validate_pattern(
653            &self.msg_id,
654            "MsgId",
655            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
656            &helpers::child_path(path, "MsgId"),
657            config,
658            collector,
659        );
660        helpers::validate_pattern(
661            &self.cre_dt_tm,
662            "CreDtTm",
663            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
664            &helpers::child_path(path, "CreDtTm"),
665            config,
666            collector,
667        );
668        self.ttl_chrgs
669            .validate(&helpers::child_path(path, "TtlChrgs"), config, collector);
670        if let Some(ref val) = self.chrgs_acct_agt
671            && config.validate_optional_fields
672        {
673            val.validate(
674                &helpers::child_path(path, "ChrgsAcctAgt"),
675                config,
676                collector,
677            );
678        }
679        if let Some(ref val) = self.chrgs_acct_agt_acct
680            && config.validate_optional_fields
681        {
682            val.validate(
683                &helpers::child_path(path, "ChrgsAcctAgtAcct"),
684                config,
685                collector,
686            );
687        }
688    }
689}
690
691// InstructionForInstructedAgent11: Further information complementing the coded instruction or instruction to the instructed agent that is bilaterally agreed or specific to a user community.
692#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
693pub struct InstructionForInstructedAgent11 {
694    #[serde(rename = "Cd")]
695    pub cd: String,
696    #[serde(rename = "InstrInf", skip_serializing_if = "Option::is_none")]
697    pub instr_inf: Option<String>,
698}
699
700impl Validate for InstructionForInstructedAgent11 {
701    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
702        helpers::validate_length(
703            &self.cd,
704            "Cd",
705            Some(1),
706            Some(4),
707            &helpers::child_path(path, "Cd"),
708            config,
709            collector,
710        );
711        if let Some(ref val) = self.instr_inf {
712            helpers::validate_length(
713                val,
714                "InstrInf",
715                Some(1),
716                Some(140),
717                &helpers::child_path(path, "InstrInf"),
718                config,
719                collector,
720            );
721        }
722        if let Some(ref val) = self.instr_inf {
723            helpers::validate_pattern(
724                val,
725                "InstrInf",
726                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
727                &helpers::child_path(path, "InstrInf"),
728                config,
729                collector,
730            );
731        }
732    }
733}
734
735// PostalAddress271: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
736#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
737pub struct PostalAddress271 {
738    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
739    pub dept: Option<String>,
740    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
741    pub sub_dept: Option<String>,
742    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
743    pub strt_nm: Option<String>,
744    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
745    pub bldg_nb: Option<String>,
746    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
747    pub bldg_nm: Option<String>,
748    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
749    pub flr: Option<String>,
750    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
751    pub pst_bx: Option<String>,
752    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
753    pub room: Option<String>,
754    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
755    pub pst_cd: Option<String>,
756    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
757    pub twn_nm: Option<String>,
758    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
759    pub twn_lctn_nm: Option<String>,
760    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
761    pub dstrct_nm: Option<String>,
762    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
763    pub ctry_sub_dvsn: Option<String>,
764    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
765    pub ctry: Option<String>,
766    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
767    pub adr_line: Option<Vec<String>>,
768}
769
770impl Validate for PostalAddress271 {
771    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
772        if let Some(ref val) = self.dept {
773            helpers::validate_length(
774                val,
775                "Dept",
776                Some(1),
777                Some(70),
778                &helpers::child_path(path, "Dept"),
779                config,
780                collector,
781            );
782        }
783        if let Some(ref val) = self.dept {
784            helpers::validate_pattern(
785                val,
786                "Dept",
787                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
788                &helpers::child_path(path, "Dept"),
789                config,
790                collector,
791            );
792        }
793        if let Some(ref val) = self.sub_dept {
794            helpers::validate_length(
795                val,
796                "SubDept",
797                Some(1),
798                Some(70),
799                &helpers::child_path(path, "SubDept"),
800                config,
801                collector,
802            );
803        }
804        if let Some(ref val) = self.sub_dept {
805            helpers::validate_pattern(
806                val,
807                "SubDept",
808                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
809                &helpers::child_path(path, "SubDept"),
810                config,
811                collector,
812            );
813        }
814        if let Some(ref val) = self.strt_nm {
815            helpers::validate_length(
816                val,
817                "StrtNm",
818                Some(1),
819                Some(70),
820                &helpers::child_path(path, "StrtNm"),
821                config,
822                collector,
823            );
824        }
825        if let Some(ref val) = self.strt_nm {
826            helpers::validate_pattern(
827                val,
828                "StrtNm",
829                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
830                &helpers::child_path(path, "StrtNm"),
831                config,
832                collector,
833            );
834        }
835        if let Some(ref val) = self.bldg_nb {
836            helpers::validate_length(
837                val,
838                "BldgNb",
839                Some(1),
840                Some(16),
841                &helpers::child_path(path, "BldgNb"),
842                config,
843                collector,
844            );
845        }
846        if let Some(ref val) = self.bldg_nb {
847            helpers::validate_pattern(
848                val,
849                "BldgNb",
850                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
851                &helpers::child_path(path, "BldgNb"),
852                config,
853                collector,
854            );
855        }
856        if let Some(ref val) = self.bldg_nm {
857            helpers::validate_length(
858                val,
859                "BldgNm",
860                Some(1),
861                Some(35),
862                &helpers::child_path(path, "BldgNm"),
863                config,
864                collector,
865            );
866        }
867        if let Some(ref val) = self.bldg_nm {
868            helpers::validate_pattern(
869                val,
870                "BldgNm",
871                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
872                &helpers::child_path(path, "BldgNm"),
873                config,
874                collector,
875            );
876        }
877        if let Some(ref val) = self.flr {
878            helpers::validate_length(
879                val,
880                "Flr",
881                Some(1),
882                Some(70),
883                &helpers::child_path(path, "Flr"),
884                config,
885                collector,
886            );
887        }
888        if let Some(ref val) = self.flr {
889            helpers::validate_pattern(
890                val,
891                "Flr",
892                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
893                &helpers::child_path(path, "Flr"),
894                config,
895                collector,
896            );
897        }
898        if let Some(ref val) = self.pst_bx {
899            helpers::validate_length(
900                val,
901                "PstBx",
902                Some(1),
903                Some(16),
904                &helpers::child_path(path, "PstBx"),
905                config,
906                collector,
907            );
908        }
909        if let Some(ref val) = self.pst_bx {
910            helpers::validate_pattern(
911                val,
912                "PstBx",
913                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
914                &helpers::child_path(path, "PstBx"),
915                config,
916                collector,
917            );
918        }
919        if let Some(ref val) = self.room {
920            helpers::validate_length(
921                val,
922                "Room",
923                Some(1),
924                Some(70),
925                &helpers::child_path(path, "Room"),
926                config,
927                collector,
928            );
929        }
930        if let Some(ref val) = self.room {
931            helpers::validate_pattern(
932                val,
933                "Room",
934                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
935                &helpers::child_path(path, "Room"),
936                config,
937                collector,
938            );
939        }
940        if let Some(ref val) = self.pst_cd {
941            helpers::validate_length(
942                val,
943                "PstCd",
944                Some(1),
945                Some(16),
946                &helpers::child_path(path, "PstCd"),
947                config,
948                collector,
949            );
950        }
951        if let Some(ref val) = self.pst_cd {
952            helpers::validate_pattern(
953                val,
954                "PstCd",
955                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
956                &helpers::child_path(path, "PstCd"),
957                config,
958                collector,
959            );
960        }
961        if let Some(ref val) = self.twn_nm {
962            helpers::validate_length(
963                val,
964                "TwnNm",
965                Some(1),
966                Some(35),
967                &helpers::child_path(path, "TwnNm"),
968                config,
969                collector,
970            );
971        }
972        if let Some(ref val) = self.twn_nm {
973            helpers::validate_pattern(
974                val,
975                "TwnNm",
976                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
977                &helpers::child_path(path, "TwnNm"),
978                config,
979                collector,
980            );
981        }
982        if let Some(ref val) = self.twn_lctn_nm {
983            helpers::validate_length(
984                val,
985                "TwnLctnNm",
986                Some(1),
987                Some(35),
988                &helpers::child_path(path, "TwnLctnNm"),
989                config,
990                collector,
991            );
992        }
993        if let Some(ref val) = self.twn_lctn_nm {
994            helpers::validate_pattern(
995                val,
996                "TwnLctnNm",
997                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
998                &helpers::child_path(path, "TwnLctnNm"),
999                config,
1000                collector,
1001            );
1002        }
1003        if let Some(ref val) = self.dstrct_nm {
1004            helpers::validate_length(
1005                val,
1006                "DstrctNm",
1007                Some(1),
1008                Some(35),
1009                &helpers::child_path(path, "DstrctNm"),
1010                config,
1011                collector,
1012            );
1013        }
1014        if let Some(ref val) = self.dstrct_nm {
1015            helpers::validate_pattern(
1016                val,
1017                "DstrctNm",
1018                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1019                &helpers::child_path(path, "DstrctNm"),
1020                config,
1021                collector,
1022            );
1023        }
1024        if let Some(ref val) = self.ctry_sub_dvsn {
1025            helpers::validate_length(
1026                val,
1027                "CtrySubDvsn",
1028                Some(1),
1029                Some(35),
1030                &helpers::child_path(path, "CtrySubDvsn"),
1031                config,
1032                collector,
1033            );
1034        }
1035        if let Some(ref val) = self.ctry_sub_dvsn {
1036            helpers::validate_pattern(
1037                val,
1038                "CtrySubDvsn",
1039                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1040                &helpers::child_path(path, "CtrySubDvsn"),
1041                config,
1042                collector,
1043            );
1044        }
1045        if let Some(ref val) = self.ctry {
1046            helpers::validate_pattern(
1047                val,
1048                "Ctry",
1049                "[A-Z]{2,2}",
1050                &helpers::child_path(path, "Ctry"),
1051                config,
1052                collector,
1053            );
1054        }
1055        if let Some(ref vec) = self.adr_line {
1056            for item in vec {
1057                helpers::validate_length(
1058                    item,
1059                    "AdrLine",
1060                    Some(1),
1061                    Some(70),
1062                    &helpers::child_path(path, "AdrLine"),
1063                    config,
1064                    collector,
1065                );
1066            }
1067        }
1068        if let Some(ref vec) = self.adr_line {
1069            for item in vec {
1070                helpers::validate_pattern(
1071                    item,
1072                    "AdrLine",
1073                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1074                    &helpers::child_path(path, "AdrLine"),
1075                    config,
1076                    collector,
1077                );
1078            }
1079        }
1080    }
1081}
1082
1083// ProxyAccountIdentification11: Identification used to indicate the account identification under another specified name.
1084#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1085pub struct ProxyAccountIdentification11 {
1086    #[serde(rename = "Tp", skip_serializing_if = "Option::is_none")]
1087    pub tp: Option<ProxyAccountType1Choice1>,
1088    #[serde(rename = "Id")]
1089    pub id: String,
1090}
1091
1092impl Validate for ProxyAccountIdentification11 {
1093    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1094        if let Some(ref val) = self.tp
1095            && config.validate_optional_fields
1096        {
1097            val.validate(&helpers::child_path(path, "Tp"), config, collector);
1098        }
1099        helpers::validate_length(
1100            &self.id,
1101            "Id",
1102            Some(1),
1103            Some(320),
1104            &helpers::child_path(path, "Id"),
1105            config,
1106            collector,
1107        );
1108        helpers::validate_pattern(
1109            &self.id,
1110            "Id",
1111            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1112            &helpers::child_path(path, "Id"),
1113            config,
1114            collector,
1115        );
1116    }
1117}
1118
1119// ProxyAccountType1Choice1: Name of the identification scheme, in a free text form.
1120#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1121pub struct ProxyAccountType1Choice1 {
1122    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1123    pub cd: Option<String>,
1124    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1125    pub prtry: Option<String>,
1126}
1127
1128impl Validate for ProxyAccountType1Choice1 {
1129    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1130        if let Some(ref val) = self.cd {
1131            helpers::validate_length(
1132                val,
1133                "Cd",
1134                Some(1),
1135                Some(4),
1136                &helpers::child_path(path, "Cd"),
1137                config,
1138                collector,
1139            );
1140        }
1141        if let Some(ref val) = self.prtry {
1142            helpers::validate_length(
1143                val,
1144                "Prtry",
1145                Some(1),
1146                Some(35),
1147                &helpers::child_path(path, "Prtry"),
1148                config,
1149                collector,
1150            );
1151        }
1152        if let Some(ref val) = self.prtry {
1153            helpers::validate_pattern(
1154                val,
1155                "Prtry",
1156                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1157                &helpers::child_path(path, "Prtry"),
1158                config,
1159                collector,
1160            );
1161        }
1162    }
1163}
1164
1165// TotalCharges71: Indicates whether the total charges amount is a credit or a debit amount.
1166// Usage: A zero amount is considered to be a credit.
1167#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1168pub struct TotalCharges71 {
1169    #[serde(rename = "NbOfChrgsRcrds")]
1170    pub nb_of_chrgs_rcrds: String,
1171    #[serde(rename = "TtlChrgsAmt")]
1172    pub ttl_chrgs_amt: CBPRAmount,
1173    #[serde(rename = "CdtDbtInd")]
1174    pub cdt_dbt_ind: CreditDebitCode1,
1175}
1176
1177impl Validate for TotalCharges71 {
1178    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1179        helpers::validate_pattern(
1180            &self.nb_of_chrgs_rcrds,
1181            "NbOfChrgsRcrds",
1182            "[0-9]{1,15}",
1183            &helpers::child_path(path, "NbOfChrgsRcrds"),
1184            config,
1185            collector,
1186        );
1187        self.ttl_chrgs_amt
1188            .validate(&helpers::child_path(path, "TtlChrgsAmt"), config, collector);
1189        self.cdt_dbt_ind
1190            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1191    }
1192}
1193
1194// TotalCharges81: Indicates whether the total charges amount is a credit or a debit amount.
1195// Usage: A zero amount is considered to be a credit.
1196#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1197pub struct TotalCharges81 {
1198    #[serde(rename = "NbOfChrgsBrkdwnItms")]
1199    pub nb_of_chrgs_brkdwn_itms: String,
1200    #[serde(rename = "TtlChrgsAmt")]
1201    pub ttl_chrgs_amt: CBPRAmount,
1202    #[serde(rename = "CdtDbtInd")]
1203    pub cdt_dbt_ind: CreditDebitCode1,
1204}
1205
1206impl Validate for TotalCharges81 {
1207    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1208        helpers::validate_pattern(
1209            &self.nb_of_chrgs_brkdwn_itms,
1210            "NbOfChrgsBrkdwnItms",
1211            "[0-9]{1,15}",
1212            &helpers::child_path(path, "NbOfChrgsBrkdwnItms"),
1213            config,
1214            collector,
1215        );
1216        self.ttl_chrgs_amt
1217            .validate(&helpers::child_path(path, "TtlChrgsAmt"), config, collector);
1218        self.cdt_dbt_ind
1219            .validate(&helpers::child_path(path, "CdtDbtInd"), config, collector);
1220    }
1221}
1222
1223// TransactionReferences71: Identification of the securities transaction assigned by the processor of the instruction other than the securities account owner, the securities account servicer and the market infrastructure.
1224#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1225pub struct TransactionReferences71 {
1226    #[serde(rename = "MsgId", skip_serializing_if = "Option::is_none")]
1227    pub msg_id: Option<String>,
1228    #[serde(rename = "MsgNmId")]
1229    pub msg_nm_id: String,
1230    #[serde(rename = "AcctSvcrRef", skip_serializing_if = "Option::is_none")]
1231    pub acct_svcr_ref: Option<String>,
1232    #[serde(rename = "PmtInfId", skip_serializing_if = "Option::is_none")]
1233    pub pmt_inf_id: Option<String>,
1234    #[serde(rename = "InstrId", skip_serializing_if = "Option::is_none")]
1235    pub instr_id: Option<String>,
1236    #[serde(rename = "EndToEndId", skip_serializing_if = "Option::is_none")]
1237    pub end_to_end_id: Option<String>,
1238    #[serde(rename = "UETR", skip_serializing_if = "Option::is_none")]
1239    pub uetr: Option<String>,
1240    #[serde(rename = "TxId", skip_serializing_if = "Option::is_none")]
1241    pub tx_id: Option<String>,
1242    #[serde(rename = "MndtId", skip_serializing_if = "Option::is_none")]
1243    pub mndt_id: Option<String>,
1244    #[serde(rename = "ChqNb", skip_serializing_if = "Option::is_none")]
1245    pub chq_nb: Option<String>,
1246    #[serde(rename = "AcctOwnrTxId", skip_serializing_if = "Option::is_none")]
1247    pub acct_ownr_tx_id: Option<String>,
1248    #[serde(rename = "AcctSvcrTxId", skip_serializing_if = "Option::is_none")]
1249    pub acct_svcr_tx_id: Option<String>,
1250    #[serde(rename = "PrcgId", skip_serializing_if = "Option::is_none")]
1251    pub prcg_id: Option<String>,
1252}
1253
1254impl Validate for TransactionReferences71 {
1255    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1256        if let Some(ref val) = self.msg_id {
1257            helpers::validate_length(
1258                val,
1259                "MsgId",
1260                Some(1),
1261                Some(35),
1262                &helpers::child_path(path, "MsgId"),
1263                config,
1264                collector,
1265            );
1266        }
1267        if let Some(ref val) = self.msg_id {
1268            helpers::validate_pattern(
1269                val,
1270                "MsgId",
1271                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1272                &helpers::child_path(path, "MsgId"),
1273                config,
1274                collector,
1275            );
1276        }
1277        helpers::validate_length(
1278            &self.msg_nm_id,
1279            "MsgNmId",
1280            Some(1),
1281            Some(35),
1282            &helpers::child_path(path, "MsgNmId"),
1283            config,
1284            collector,
1285        );
1286        helpers::validate_pattern(
1287            &self.msg_nm_id,
1288            "MsgNmId",
1289            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1290            &helpers::child_path(path, "MsgNmId"),
1291            config,
1292            collector,
1293        );
1294        if let Some(ref val) = self.acct_svcr_ref {
1295            helpers::validate_length(
1296                val,
1297                "AcctSvcrRef",
1298                Some(1),
1299                Some(35),
1300                &helpers::child_path(path, "AcctSvcrRef"),
1301                config,
1302                collector,
1303            );
1304        }
1305        if let Some(ref val) = self.acct_svcr_ref {
1306            helpers::validate_pattern(
1307                val,
1308                "AcctSvcrRef",
1309                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1310                &helpers::child_path(path, "AcctSvcrRef"),
1311                config,
1312                collector,
1313            );
1314        }
1315        if let Some(ref val) = self.pmt_inf_id {
1316            helpers::validate_length(
1317                val,
1318                "PmtInfId",
1319                Some(1),
1320                Some(35),
1321                &helpers::child_path(path, "PmtInfId"),
1322                config,
1323                collector,
1324            );
1325        }
1326        if let Some(ref val) = self.pmt_inf_id {
1327            helpers::validate_pattern(
1328                val,
1329                "PmtInfId",
1330                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1331                &helpers::child_path(path, "PmtInfId"),
1332                config,
1333                collector,
1334            );
1335        }
1336        if let Some(ref val) = self.instr_id {
1337            helpers::validate_length(
1338                val,
1339                "InstrId",
1340                Some(1),
1341                Some(16),
1342                &helpers::child_path(path, "InstrId"),
1343                config,
1344                collector,
1345            );
1346        }
1347        if let Some(ref val) = self.instr_id {
1348            helpers::validate_pattern(
1349                val,
1350                "InstrId",
1351                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1352                &helpers::child_path(path, "InstrId"),
1353                config,
1354                collector,
1355            );
1356        }
1357        if let Some(ref val) = self.end_to_end_id {
1358            helpers::validate_length(
1359                val,
1360                "EndToEndId",
1361                Some(1),
1362                Some(35),
1363                &helpers::child_path(path, "EndToEndId"),
1364                config,
1365                collector,
1366            );
1367        }
1368        if let Some(ref val) = self.end_to_end_id {
1369            helpers::validate_pattern(
1370                val,
1371                "EndToEndId",
1372                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1373                &helpers::child_path(path, "EndToEndId"),
1374                config,
1375                collector,
1376            );
1377        }
1378        if let Some(ref val) = self.uetr {
1379            helpers::validate_pattern(
1380                val,
1381                "UETR",
1382                "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
1383                &helpers::child_path(path, "UETR"),
1384                config,
1385                collector,
1386            );
1387        }
1388        if let Some(ref val) = self.tx_id {
1389            helpers::validate_length(
1390                val,
1391                "TxId",
1392                Some(1),
1393                Some(35),
1394                &helpers::child_path(path, "TxId"),
1395                config,
1396                collector,
1397            );
1398        }
1399        if let Some(ref val) = self.tx_id {
1400            helpers::validate_pattern(
1401                val,
1402                "TxId",
1403                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1404                &helpers::child_path(path, "TxId"),
1405                config,
1406                collector,
1407            );
1408        }
1409        if let Some(ref val) = self.mndt_id {
1410            helpers::validate_length(
1411                val,
1412                "MndtId",
1413                Some(1),
1414                Some(35),
1415                &helpers::child_path(path, "MndtId"),
1416                config,
1417                collector,
1418            );
1419        }
1420        if let Some(ref val) = self.mndt_id {
1421            helpers::validate_pattern(
1422                val,
1423                "MndtId",
1424                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1425                &helpers::child_path(path, "MndtId"),
1426                config,
1427                collector,
1428            );
1429        }
1430        if let Some(ref val) = self.chq_nb {
1431            helpers::validate_length(
1432                val,
1433                "ChqNb",
1434                Some(1),
1435                Some(35),
1436                &helpers::child_path(path, "ChqNb"),
1437                config,
1438                collector,
1439            );
1440        }
1441        if let Some(ref val) = self.chq_nb {
1442            helpers::validate_pattern(
1443                val,
1444                "ChqNb",
1445                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1446                &helpers::child_path(path, "ChqNb"),
1447                config,
1448                collector,
1449            );
1450        }
1451        if let Some(ref val) = self.acct_ownr_tx_id {
1452            helpers::validate_length(
1453                val,
1454                "AcctOwnrTxId",
1455                Some(1),
1456                Some(35),
1457                &helpers::child_path(path, "AcctOwnrTxId"),
1458                config,
1459                collector,
1460            );
1461        }
1462        if let Some(ref val) = self.acct_ownr_tx_id {
1463            helpers::validate_pattern(
1464                val,
1465                "AcctOwnrTxId",
1466                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1467                &helpers::child_path(path, "AcctOwnrTxId"),
1468                config,
1469                collector,
1470            );
1471        }
1472        if let Some(ref val) = self.acct_svcr_tx_id {
1473            helpers::validate_length(
1474                val,
1475                "AcctSvcrTxId",
1476                Some(1),
1477                Some(35),
1478                &helpers::child_path(path, "AcctSvcrTxId"),
1479                config,
1480                collector,
1481            );
1482        }
1483        if let Some(ref val) = self.acct_svcr_tx_id {
1484            helpers::validate_pattern(
1485                val,
1486                "AcctSvcrTxId",
1487                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1488                &helpers::child_path(path, "AcctSvcrTxId"),
1489                config,
1490                collector,
1491            );
1492        }
1493        if let Some(ref val) = self.prcg_id {
1494            helpers::validate_length(
1495                val,
1496                "PrcgId",
1497                Some(1),
1498                Some(35),
1499                &helpers::child_path(path, "PrcgId"),
1500                config,
1501                collector,
1502            );
1503        }
1504        if let Some(ref val) = self.prcg_id {
1505            helpers::validate_pattern(
1506                val,
1507                "PrcgId",
1508                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1509                &helpers::child_path(path, "PrcgId"),
1510                config,
1511                collector,
1512            );
1513        }
1514    }
1515}