mx_message/document/
camt_056_001_08.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// BranchAndFinancialInstitutionIdentification61: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
24#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
25pub struct BranchAndFinancialInstitutionIdentification61 {
26    #[serde(rename = "FinInstnId")]
27    pub fin_instn_id: FinancialInstitutionIdentification181,
28}
29
30impl Validate for BranchAndFinancialInstitutionIdentification61 {
31    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
32        self.fin_instn_id
33            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
34    }
35}
36
37// BranchAndFinancialInstitutionIdentification62: Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme.
38#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
39pub struct BranchAndFinancialInstitutionIdentification62 {
40    #[serde(rename = "FinInstnId")]
41    pub fin_instn_id: FinancialInstitutionIdentification182,
42}
43
44impl Validate for BranchAndFinancialInstitutionIdentification62 {
45    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
46        self.fin_instn_id
47            .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
48    }
49}
50
51// CBPRAmount: CBPR_Amount
52#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
53pub struct CBPRAmount {
54    #[serde(rename = "@Ccy")]
55    pub ccy: String,
56    #[serde(rename = "$value")]
57    pub value: f64,
58}
59
60impl Validate for CBPRAmount {
61    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
62}
63
64// CBPR_CancellationReasonCode: Reason is provided as narrative information in the additional reason information.
65#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
66pub enum CBPRCancellationReasonCode {
67    #[default]
68    #[serde(rename = "DUPL")]
69    CodeDUPL,
70    #[serde(rename = "CUTA")]
71    CodeCUTA,
72    #[serde(rename = "UPAY")]
73    CodeUPAY,
74    #[serde(rename = "CUST")]
75    CodeCUST,
76    #[serde(rename = "CURR")]
77    CodeCURR,
78    #[serde(rename = "AGNT")]
79    CodeAGNT,
80    #[serde(rename = "TECH")]
81    CodeTECH,
82    #[serde(rename = "FRAD")]
83    CodeFRAD,
84    #[serde(rename = "COVR")]
85    CodeCOVR,
86    #[serde(rename = "AM09")]
87    CodeAM09,
88    #[serde(rename = "NARR")]
89    CodeNARR,
90}
91
92impl Validate for CBPRCancellationReasonCode {
93    fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
94        // Enum validation is typically empty
95    }
96}
97
98// CancellationReason33Choice1: Reason for the cancellation request, in a coded form.
99#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
100pub struct CancellationReason33Choice1 {
101    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
102    pub cd: Option<CBPRCancellationReasonCode>,
103}
104
105impl Validate for CancellationReason33Choice1 {
106    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
107        if let Some(ref val) = self.cd
108            && config.validate_optional_fields
109        {
110            val.validate(&helpers::child_path(path, "Cd"), config, collector);
111        }
112    }
113}
114
115// Case51: Party that created the investigation case.
116#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
117pub struct Case51 {
118    #[serde(rename = "Id")]
119    pub id: String,
120    #[serde(rename = "Cretr")]
121    pub cretr: Party40Choice2,
122}
123
124impl Validate for Case51 {
125    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
126        helpers::validate_length(
127            &self.id,
128            "Id",
129            Some(1),
130            Some(16),
131            &helpers::child_path(path, "Id"),
132            config,
133            collector,
134        );
135        helpers::validate_pattern(
136            &self.id,
137            "Id",
138            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
139            &helpers::child_path(path, "Id"),
140            config,
141            collector,
142        );
143        self.cretr
144            .validate(&helpers::child_path(path, "Cretr"), config, collector);
145    }
146}
147
148// CaseAssignment51: Date and time at which the assignment was created.
149#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
150pub struct CaseAssignment51 {
151    #[serde(rename = "Id")]
152    pub id: String,
153    #[serde(rename = "Assgnr")]
154    pub assgnr: Party40Choice1,
155    #[serde(rename = "Assgne")]
156    pub assgne: Party40Choice1,
157    #[serde(rename = "CreDtTm")]
158    pub cre_dt_tm: String,
159}
160
161impl Validate for CaseAssignment51 {
162    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
163        helpers::validate_length(
164            &self.id,
165            "Id",
166            Some(1),
167            Some(35),
168            &helpers::child_path(path, "Id"),
169            config,
170            collector,
171        );
172        helpers::validate_pattern(
173            &self.id,
174            "Id",
175            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
176            &helpers::child_path(path, "Id"),
177            config,
178            collector,
179        );
180        self.assgnr
181            .validate(&helpers::child_path(path, "Assgnr"), config, collector);
182        self.assgne
183            .validate(&helpers::child_path(path, "Assgne"), config, collector);
184        helpers::validate_pattern(
185            &self.cre_dt_tm,
186            "CreDtTm",
187            ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
188            &helpers::child_path(path, "CreDtTm"),
189            config,
190            collector,
191        );
192    }
193}
194
195// ClearingSystemIdentification2Choice1: Identification of a clearing system, in a coded form as published in an external list.
196#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
197pub struct ClearingSystemIdentification2Choice1 {
198    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
199    pub cd: Option<String>,
200}
201
202impl Validate for ClearingSystemIdentification2Choice1 {
203    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
204        if let Some(ref val) = self.cd {
205            helpers::validate_length(
206                val,
207                "Cd",
208                Some(1),
209                Some(5),
210                &helpers::child_path(path, "Cd"),
211                config,
212                collector,
213            );
214        }
215    }
216}
217
218// ClearingSystemMemberIdentification21: Identification of a member of a clearing system.
219#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
220pub struct ClearingSystemMemberIdentification21 {
221    #[serde(rename = "ClrSysId")]
222    pub clr_sys_id: ClearingSystemIdentification2Choice1,
223    #[serde(rename = "MmbId")]
224    pub mmb_id: String,
225}
226
227impl Validate for ClearingSystemMemberIdentification21 {
228    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
229        self.clr_sys_id
230            .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
231        helpers::validate_length(
232            &self.mmb_id,
233            "MmbId",
234            Some(1),
235            Some(28),
236            &helpers::child_path(path, "MmbId"),
237            config,
238            collector,
239        );
240        helpers::validate_pattern(
241            &self.mmb_id,
242            "MmbId",
243            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
244            &helpers::child_path(path, "MmbId"),
245            config,
246            collector,
247        );
248    }
249}
250
251// DateAndPlaceOfBirth11: Country where a person was born.
252#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
253pub struct DateAndPlaceOfBirth11 {
254    #[serde(rename = "BirthDt")]
255    pub birth_dt: String,
256    #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
257    pub prvc_of_birth: Option<String>,
258    #[serde(rename = "CityOfBirth")]
259    pub city_of_birth: String,
260    #[serde(rename = "CtryOfBirth")]
261    pub ctry_of_birth: String,
262}
263
264impl Validate for DateAndPlaceOfBirth11 {
265    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
266        if let Some(ref val) = self.prvc_of_birth {
267            helpers::validate_length(
268                val,
269                "PrvcOfBirth",
270                Some(1),
271                Some(35),
272                &helpers::child_path(path, "PrvcOfBirth"),
273                config,
274                collector,
275            );
276        }
277        if let Some(ref val) = self.prvc_of_birth {
278            helpers::validate_pattern(
279                val,
280                "PrvcOfBirth",
281                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
282                &helpers::child_path(path, "PrvcOfBirth"),
283                config,
284                collector,
285            );
286        }
287        helpers::validate_length(
288            &self.city_of_birth,
289            "CityOfBirth",
290            Some(1),
291            Some(35),
292            &helpers::child_path(path, "CityOfBirth"),
293            config,
294            collector,
295        );
296        helpers::validate_pattern(
297            &self.city_of_birth,
298            "CityOfBirth",
299            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
300            &helpers::child_path(path, "CityOfBirth"),
301            config,
302            collector,
303        );
304        helpers::validate_pattern(
305            &self.ctry_of_birth,
306            "CtryOfBirth",
307            "[A-Z]{2,2}",
308            &helpers::child_path(path, "CtryOfBirth"),
309            config,
310            collector,
311        );
312    }
313}
314
315// FIToFIPaymentCancellationRequestV08: Identifies the payment instruction to be cancelled.
316#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
317pub struct FIToFIPaymentCancellationRequestV08 {
318    #[serde(rename = "Assgnmt")]
319    pub assgnmt: CaseAssignment51,
320    #[serde(rename = "Undrlyg")]
321    pub undrlyg: UnderlyingTransaction231,
322}
323
324impl Validate for FIToFIPaymentCancellationRequestV08 {
325    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
326        self.assgnmt
327            .validate(&helpers::child_path(path, "Assgnmt"), config, collector);
328        self.undrlyg
329            .validate(&helpers::child_path(path, "Undrlyg"), config, collector);
330    }
331}
332
333// FinancialInstitutionIdentification181: Legal entity identifier of the financial institution.
334#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
335pub struct FinancialInstitutionIdentification181 {
336    #[serde(rename = "BICFI")]
337    pub bicfi: String,
338    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
339    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
340    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
341    pub lei: Option<String>,
342}
343
344impl Validate for FinancialInstitutionIdentification181 {
345    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
346        helpers::validate_pattern(
347            &self.bicfi,
348            "BICFI",
349            "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
350            &helpers::child_path(path, "BICFI"),
351            config,
352            collector,
353        );
354        if let Some(ref val) = self.clr_sys_mmb_id
355            && config.validate_optional_fields
356        {
357            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
358        }
359        if let Some(ref val) = self.lei {
360            helpers::validate_pattern(
361                val,
362                "LEI",
363                "[A-Z0-9]{18,18}[0-9]{2,2}",
364                &helpers::child_path(path, "LEI"),
365                config,
366                collector,
367            );
368        }
369    }
370}
371
372// FinancialInstitutionIdentification182: Information that locates and identifies a specific address, as defined by postal services.
373#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
374pub struct FinancialInstitutionIdentification182 {
375    #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
376    pub bicfi: Option<String>,
377    #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
378    pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
379    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
380    pub lei: Option<String>,
381    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
382    pub nm: Option<String>,
383    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
384    pub pstl_adr: Option<PostalAddress241>,
385}
386
387impl Validate for FinancialInstitutionIdentification182 {
388    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
389        if let Some(ref val) = self.bicfi {
390            helpers::validate_pattern(
391                val,
392                "BICFI",
393                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
394                &helpers::child_path(path, "BICFI"),
395                config,
396                collector,
397            );
398        }
399        if let Some(ref val) = self.clr_sys_mmb_id
400            && config.validate_optional_fields
401        {
402            val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
403        }
404        if let Some(ref val) = self.lei {
405            helpers::validate_pattern(
406                val,
407                "LEI",
408                "[A-Z0-9]{18,18}[0-9]{2,2}",
409                &helpers::child_path(path, "LEI"),
410                config,
411                collector,
412            );
413        }
414        if let Some(ref val) = self.nm {
415            helpers::validate_length(
416                val,
417                "Nm",
418                Some(1),
419                Some(140),
420                &helpers::child_path(path, "Nm"),
421                config,
422                collector,
423            );
424        }
425        if let Some(ref val) = self.nm {
426            helpers::validate_pattern(
427                val,
428                "Nm",
429                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
430                &helpers::child_path(path, "Nm"),
431                config,
432                collector,
433            );
434        }
435        if let Some(ref val) = self.pstl_adr
436            && config.validate_optional_fields
437        {
438            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
439        }
440    }
441}
442
443// GenericOrganisationIdentification11: Entity that assigns the identification.
444#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
445pub struct GenericOrganisationIdentification11 {
446    #[serde(rename = "Id")]
447    pub id: String,
448    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
449    pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
450    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
451    pub issr: Option<String>,
452}
453
454impl Validate for GenericOrganisationIdentification11 {
455    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
456        helpers::validate_length(
457            &self.id,
458            "Id",
459            Some(1),
460            Some(35),
461            &helpers::child_path(path, "Id"),
462            config,
463            collector,
464        );
465        helpers::validate_pattern(
466            &self.id,
467            "Id",
468            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
469            &helpers::child_path(path, "Id"),
470            config,
471            collector,
472        );
473        if let Some(ref val) = self.schme_nm
474            && config.validate_optional_fields
475        {
476            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
477        }
478        if let Some(ref val) = self.issr {
479            helpers::validate_length(
480                val,
481                "Issr",
482                Some(1),
483                Some(35),
484                &helpers::child_path(path, "Issr"),
485                config,
486                collector,
487            );
488        }
489        if let Some(ref val) = self.issr {
490            helpers::validate_pattern(
491                val,
492                "Issr",
493                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
494                &helpers::child_path(path, "Issr"),
495                config,
496                collector,
497            );
498        }
499    }
500}
501
502// GenericPersonIdentification11: Entity that assigns the identification.
503#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
504pub struct GenericPersonIdentification11 {
505    #[serde(rename = "Id")]
506    pub id: String,
507    #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
508    pub schme_nm: Option<PersonIdentificationSchemeName1Choice1>,
509    #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
510    pub issr: Option<String>,
511}
512
513impl Validate for GenericPersonIdentification11 {
514    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
515        helpers::validate_length(
516            &self.id,
517            "Id",
518            Some(1),
519            Some(35),
520            &helpers::child_path(path, "Id"),
521            config,
522            collector,
523        );
524        helpers::validate_pattern(
525            &self.id,
526            "Id",
527            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
528            &helpers::child_path(path, "Id"),
529            config,
530            collector,
531        );
532        if let Some(ref val) = self.schme_nm
533            && config.validate_optional_fields
534        {
535            val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
536        }
537        if let Some(ref val) = self.issr {
538            helpers::validate_length(
539                val,
540                "Issr",
541                Some(1),
542                Some(35),
543                &helpers::child_path(path, "Issr"),
544                config,
545                collector,
546            );
547        }
548        if let Some(ref val) = self.issr {
549            helpers::validate_pattern(
550                val,
551                "Issr",
552                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
553                &helpers::child_path(path, "Issr"),
554                config,
555                collector,
556            );
557        }
558    }
559}
560
561// OrganisationIdentification291: Unique identification of an organisation, as assigned by an institution, using an identification scheme.
562#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
563pub struct OrganisationIdentification291 {
564    #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
565    pub any_bic: Option<String>,
566    #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
567    pub lei: Option<String>,
568    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
569    pub othr: Option<Vec<GenericOrganisationIdentification11>>,
570}
571
572impl Validate for OrganisationIdentification291 {
573    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
574        if let Some(ref val) = self.any_bic {
575            helpers::validate_pattern(
576                val,
577                "AnyBIC",
578                "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
579                &helpers::child_path(path, "AnyBIC"),
580                config,
581                collector,
582            );
583        }
584        if let Some(ref val) = self.lei {
585            helpers::validate_pattern(
586                val,
587                "LEI",
588                "[A-Z0-9]{18,18}[0-9]{2,2}",
589                &helpers::child_path(path, "LEI"),
590                config,
591                collector,
592            );
593        }
594        if let Some(ref vec) = self.othr
595            && config.validate_optional_fields
596        {
597            for item in vec {
598                item.validate(&helpers::child_path(path, "Othr"), config, collector);
599            }
600        }
601    }
602}
603
604// OrganisationIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
605#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
606pub struct OrganisationIdentificationSchemeName1Choice1 {
607    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
608    pub cd: Option<String>,
609    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
610    pub prtry: Option<String>,
611}
612
613impl Validate for OrganisationIdentificationSchemeName1Choice1 {
614    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
615        if let Some(ref val) = self.cd {
616            helpers::validate_length(
617                val,
618                "Cd",
619                Some(1),
620                Some(4),
621                &helpers::child_path(path, "Cd"),
622                config,
623                collector,
624            );
625        }
626        if let Some(ref val) = self.prtry {
627            helpers::validate_length(
628                val,
629                "Prtry",
630                Some(1),
631                Some(35),
632                &helpers::child_path(path, "Prtry"),
633                config,
634                collector,
635            );
636        }
637        if let Some(ref val) = self.prtry {
638            helpers::validate_pattern(
639                val,
640                "Prtry",
641                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
642                &helpers::child_path(path, "Prtry"),
643                config,
644                collector,
645            );
646        }
647    }
648}
649
650// OriginalGroupInformation291: Original date and time at which the message was created.
651#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
652pub struct OriginalGroupInformation291 {
653    #[serde(rename = "OrgnlMsgId")]
654    pub orgnl_msg_id: String,
655    #[serde(rename = "OrgnlMsgNmId")]
656    pub orgnl_msg_nm_id: String,
657    #[serde(rename = "OrgnlCreDtTm", skip_serializing_if = "Option::is_none")]
658    pub orgnl_cre_dt_tm: Option<String>,
659}
660
661impl Validate for OriginalGroupInformation291 {
662    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
663        helpers::validate_length(
664            &self.orgnl_msg_id,
665            "OrgnlMsgId",
666            Some(1),
667            Some(35),
668            &helpers::child_path(path, "OrgnlMsgId"),
669            config,
670            collector,
671        );
672        helpers::validate_pattern(
673            &self.orgnl_msg_id,
674            "OrgnlMsgId",
675            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
676            &helpers::child_path(path, "OrgnlMsgId"),
677            config,
678            collector,
679        );
680        helpers::validate_length(
681            &self.orgnl_msg_nm_id,
682            "OrgnlMsgNmId",
683            Some(1),
684            Some(35),
685            &helpers::child_path(path, "OrgnlMsgNmId"),
686            config,
687            collector,
688        );
689        helpers::validate_pattern(
690            &self.orgnl_msg_nm_id,
691            "OrgnlMsgNmId",
692            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
693            &helpers::child_path(path, "OrgnlMsgNmId"),
694            config,
695            collector,
696        );
697        if let Some(ref val) = self.orgnl_cre_dt_tm {
698            helpers::validate_pattern(
699                val,
700                "OrgnlCreDtTm",
701                ".*(\\+|-)((0[0-9])|(1[0-4])):[0-5][0-9]",
702                &helpers::child_path(path, "OrgnlCreDtTm"),
703                config,
704                collector,
705            );
706        }
707    }
708}
709
710// Party38Choice1: Unique and unambiguous identification of a person, for example a passport.
711#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
712pub struct Party38Choice1 {
713    #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
714    pub org_id: Option<OrganisationIdentification291>,
715    #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
716    pub prvt_id: Option<PersonIdentification131>,
717}
718
719impl Validate for Party38Choice1 {
720    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
721        if let Some(ref val) = self.org_id
722            && config.validate_optional_fields
723        {
724            val.validate(&helpers::child_path(path, "OrgId"), config, collector);
725        }
726        if let Some(ref val) = self.prvt_id
727            && config.validate_optional_fields
728        {
729            val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
730        }
731    }
732}
733
734// Party40Choice1: Identification of a financial institution.
735#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
736pub struct Party40Choice1 {
737    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
738    pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
739}
740
741impl Validate for Party40Choice1 {
742    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
743        if let Some(ref val) = self.agt
744            && config.validate_optional_fields
745        {
746            val.validate(&helpers::child_path(path, "Agt"), config, collector);
747        }
748    }
749}
750
751// Party40Choice2: Identification of a financial institution.
752#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
753pub struct Party40Choice2 {
754    #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
755    pub pty: Option<PartyIdentification1351>,
756    #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
757    pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
758}
759
760impl Validate for Party40Choice2 {
761    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
762        if let Some(ref val) = self.pty
763            && config.validate_optional_fields
764        {
765            val.validate(&helpers::child_path(path, "Pty"), config, collector);
766        }
767        if let Some(ref val) = self.agt
768            && config.validate_optional_fields
769        {
770            val.validate(&helpers::child_path(path, "Agt"), config, collector);
771        }
772    }
773}
774
775// PartyIdentification1351: Country in which a person resides (the place of a person's home). In the case of a company, it is the country from which the affairs of that company are directed.
776#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
777pub struct PartyIdentification1351 {
778    #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
779    pub nm: Option<String>,
780    #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
781    pub pstl_adr: Option<PostalAddress241>,
782    #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
783    pub id: Option<Party38Choice1>,
784    #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
785    pub ctry_of_res: Option<String>,
786}
787
788impl Validate for PartyIdentification1351 {
789    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
790        if let Some(ref val) = self.nm {
791            helpers::validate_length(
792                val,
793                "Nm",
794                Some(1),
795                Some(140),
796                &helpers::child_path(path, "Nm"),
797                config,
798                collector,
799            );
800        }
801        if let Some(ref val) = self.nm {
802            helpers::validate_pattern(
803                val,
804                "Nm",
805                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
806                &helpers::child_path(path, "Nm"),
807                config,
808                collector,
809            );
810        }
811        if let Some(ref val) = self.pstl_adr
812            && config.validate_optional_fields
813        {
814            val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
815        }
816        if let Some(ref val) = self.id
817            && config.validate_optional_fields
818        {
819            val.validate(&helpers::child_path(path, "Id"), config, collector);
820        }
821        if let Some(ref val) = self.ctry_of_res {
822            helpers::validate_pattern(
823                val,
824                "CtryOfRes",
825                "[A-Z]{2,2}",
826                &helpers::child_path(path, "CtryOfRes"),
827                config,
828                collector,
829            );
830        }
831    }
832}
833
834// PaymentCancellationReason51: Further details on the cancellation request reason.
835#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
836pub struct PaymentCancellationReason51 {
837    #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
838    pub orgtr: Option<PartyIdentification1351>,
839    #[serde(rename = "Rsn")]
840    pub rsn: CancellationReason33Choice1,
841    #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
842    pub addtl_inf: Option<Vec<String>>,
843}
844
845impl Validate for PaymentCancellationReason51 {
846    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
847        if let Some(ref val) = self.orgtr
848            && config.validate_optional_fields
849        {
850            val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
851        }
852        self.rsn
853            .validate(&helpers::child_path(path, "Rsn"), config, collector);
854        if let Some(ref vec) = self.addtl_inf {
855            for item in vec {
856                helpers::validate_length(
857                    item,
858                    "AddtlInf",
859                    Some(1),
860                    Some(105),
861                    &helpers::child_path(path, "AddtlInf"),
862                    config,
863                    collector,
864                );
865            }
866        }
867        if let Some(ref vec) = self.addtl_inf {
868            for item in vec {
869                helpers::validate_pattern(
870                    item,
871                    "AddtlInf",
872                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
873                    &helpers::child_path(path, "AddtlInf"),
874                    config,
875                    collector,
876                );
877            }
878        }
879    }
880}
881
882// PaymentTransaction1061: Provides detailed information on the cancellation reason.
883#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
884pub struct PaymentTransaction1061 {
885    #[serde(rename = "CxlId", skip_serializing_if = "Option::is_none")]
886    pub cxl_id: Option<String>,
887    #[serde(rename = "Case")]
888    pub case: Case51,
889    #[serde(rename = "OrgnlGrpInf")]
890    pub orgnl_grp_inf: OriginalGroupInformation291,
891    #[serde(rename = "OrgnlInstrId", skip_serializing_if = "Option::is_none")]
892    pub orgnl_instr_id: Option<String>,
893    #[serde(rename = "OrgnlEndToEndId")]
894    pub orgnl_end_to_end_id: String,
895    #[serde(rename = "OrgnlTxId", skip_serializing_if = "Option::is_none")]
896    pub orgnl_tx_id: Option<String>,
897    #[serde(rename = "OrgnlUETR")]
898    pub orgnl_uetr: String,
899    #[serde(rename = "OrgnlClrSysRef", skip_serializing_if = "Option::is_none")]
900    pub orgnl_clr_sys_ref: Option<String>,
901    #[serde(rename = "OrgnlIntrBkSttlmAmt")]
902    pub orgnl_intr_bk_sttlm_amt: CBPRAmount,
903    #[serde(rename = "OrgnlIntrBkSttlmDt")]
904    pub orgnl_intr_bk_sttlm_dt: String,
905    #[serde(rename = "CxlRsnInf")]
906    pub cxl_rsn_inf: PaymentCancellationReason51,
907}
908
909impl Validate for PaymentTransaction1061 {
910    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
911        if let Some(ref val) = self.cxl_id {
912            helpers::validate_length(
913                val,
914                "CxlId",
915                Some(1),
916                Some(16),
917                &helpers::child_path(path, "CxlId"),
918                config,
919                collector,
920            );
921        }
922        if let Some(ref val) = self.cxl_id {
923            helpers::validate_pattern(
924                val,
925                "CxlId",
926                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
927                &helpers::child_path(path, "CxlId"),
928                config,
929                collector,
930            );
931        }
932        self.case
933            .validate(&helpers::child_path(path, "Case"), config, collector);
934        self.orgnl_grp_inf
935            .validate(&helpers::child_path(path, "OrgnlGrpInf"), config, collector);
936        if let Some(ref val) = self.orgnl_instr_id {
937            helpers::validate_length(
938                val,
939                "OrgnlInstrId",
940                Some(1),
941                Some(16),
942                &helpers::child_path(path, "OrgnlInstrId"),
943                config,
944                collector,
945            );
946        }
947        if let Some(ref val) = self.orgnl_instr_id {
948            helpers::validate_pattern(
949                val,
950                "OrgnlInstrId",
951                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
952                &helpers::child_path(path, "OrgnlInstrId"),
953                config,
954                collector,
955            );
956        }
957        helpers::validate_length(
958            &self.orgnl_end_to_end_id,
959            "OrgnlEndToEndId",
960            Some(1),
961            Some(35),
962            &helpers::child_path(path, "OrgnlEndToEndId"),
963            config,
964            collector,
965        );
966        helpers::validate_pattern(
967            &self.orgnl_end_to_end_id,
968            "OrgnlEndToEndId",
969            "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
970            &helpers::child_path(path, "OrgnlEndToEndId"),
971            config,
972            collector,
973        );
974        if let Some(ref val) = self.orgnl_tx_id {
975            helpers::validate_length(
976                val,
977                "OrgnlTxId",
978                Some(1),
979                Some(35),
980                &helpers::child_path(path, "OrgnlTxId"),
981                config,
982                collector,
983            );
984        }
985        if let Some(ref val) = self.orgnl_tx_id {
986            helpers::validate_pattern(
987                val,
988                "OrgnlTxId",
989                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
990                &helpers::child_path(path, "OrgnlTxId"),
991                config,
992                collector,
993            );
994        }
995        helpers::validate_pattern(
996            &self.orgnl_uetr,
997            "OrgnlUETR",
998            "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
999            &helpers::child_path(path, "OrgnlUETR"),
1000            config,
1001            collector,
1002        );
1003        if let Some(ref val) = self.orgnl_clr_sys_ref {
1004            helpers::validate_length(
1005                val,
1006                "OrgnlClrSysRef",
1007                Some(1),
1008                Some(35),
1009                &helpers::child_path(path, "OrgnlClrSysRef"),
1010                config,
1011                collector,
1012            );
1013        }
1014        if let Some(ref val) = self.orgnl_clr_sys_ref {
1015            helpers::validate_pattern(
1016                val,
1017                "OrgnlClrSysRef",
1018                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1019                &helpers::child_path(path, "OrgnlClrSysRef"),
1020                config,
1021                collector,
1022            );
1023        }
1024        self.orgnl_intr_bk_sttlm_amt.validate(
1025            &helpers::child_path(path, "OrgnlIntrBkSttlmAmt"),
1026            config,
1027            collector,
1028        );
1029        self.cxl_rsn_inf
1030            .validate(&helpers::child_path(path, "CxlRsnInf"), config, collector);
1031    }
1032}
1033
1034// PersonIdentification131: Unique identification of a person, as assigned by an institution, using an identification scheme.
1035#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1036pub struct PersonIdentification131 {
1037    #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1038    pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth11>,
1039    #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1040    pub othr: Option<Vec<GenericPersonIdentification11>>,
1041}
1042
1043impl Validate for PersonIdentification131 {
1044    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1045        if let Some(ref val) = self.dt_and_plc_of_birth
1046            && config.validate_optional_fields
1047        {
1048            val.validate(
1049                &helpers::child_path(path, "DtAndPlcOfBirth"),
1050                config,
1051                collector,
1052            );
1053        }
1054        if let Some(ref vec) = self.othr
1055            && config.validate_optional_fields
1056        {
1057            for item in vec {
1058                item.validate(&helpers::child_path(path, "Othr"), config, collector);
1059            }
1060        }
1061    }
1062}
1063
1064// PersonIdentificationSchemeName1Choice1: Name of the identification scheme, in a free text form.
1065#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1066pub struct PersonIdentificationSchemeName1Choice1 {
1067    #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1068    pub cd: Option<String>,
1069    #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1070    pub prtry: Option<String>,
1071}
1072
1073impl Validate for PersonIdentificationSchemeName1Choice1 {
1074    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1075        if let Some(ref val) = self.cd {
1076            helpers::validate_length(
1077                val,
1078                "Cd",
1079                Some(1),
1080                Some(4),
1081                &helpers::child_path(path, "Cd"),
1082                config,
1083                collector,
1084            );
1085        }
1086        if let Some(ref val) = self.prtry {
1087            helpers::validate_length(
1088                val,
1089                "Prtry",
1090                Some(1),
1091                Some(35),
1092                &helpers::child_path(path, "Prtry"),
1093                config,
1094                collector,
1095            );
1096        }
1097        if let Some(ref val) = self.prtry {
1098            helpers::validate_pattern(
1099                val,
1100                "Prtry",
1101                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1102                &helpers::child_path(path, "Prtry"),
1103                config,
1104                collector,
1105            );
1106        }
1107    }
1108}
1109
1110// PostalAddress241: Information that locates and identifies a specific address, as defined by postal services, presented in free format text.
1111#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1112pub struct PostalAddress241 {
1113    #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1114    pub dept: Option<String>,
1115    #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1116    pub sub_dept: Option<String>,
1117    #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1118    pub strt_nm: Option<String>,
1119    #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1120    pub bldg_nb: Option<String>,
1121    #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1122    pub bldg_nm: Option<String>,
1123    #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1124    pub flr: Option<String>,
1125    #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1126    pub pst_bx: Option<String>,
1127    #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1128    pub room: Option<String>,
1129    #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1130    pub pst_cd: Option<String>,
1131    #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1132    pub twn_nm: Option<String>,
1133    #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1134    pub twn_lctn_nm: Option<String>,
1135    #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1136    pub dstrct_nm: Option<String>,
1137    #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1138    pub ctry_sub_dvsn: Option<String>,
1139    #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1140    pub ctry: Option<String>,
1141    #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1142    pub adr_line: Option<Vec<String>>,
1143}
1144
1145impl Validate for PostalAddress241 {
1146    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1147        if let Some(ref val) = self.dept {
1148            helpers::validate_length(
1149                val,
1150                "Dept",
1151                Some(1),
1152                Some(70),
1153                &helpers::child_path(path, "Dept"),
1154                config,
1155                collector,
1156            );
1157        }
1158        if let Some(ref val) = self.dept {
1159            helpers::validate_pattern(
1160                val,
1161                "Dept",
1162                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1163                &helpers::child_path(path, "Dept"),
1164                config,
1165                collector,
1166            );
1167        }
1168        if let Some(ref val) = self.sub_dept {
1169            helpers::validate_length(
1170                val,
1171                "SubDept",
1172                Some(1),
1173                Some(70),
1174                &helpers::child_path(path, "SubDept"),
1175                config,
1176                collector,
1177            );
1178        }
1179        if let Some(ref val) = self.sub_dept {
1180            helpers::validate_pattern(
1181                val,
1182                "SubDept",
1183                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1184                &helpers::child_path(path, "SubDept"),
1185                config,
1186                collector,
1187            );
1188        }
1189        if let Some(ref val) = self.strt_nm {
1190            helpers::validate_length(
1191                val,
1192                "StrtNm",
1193                Some(1),
1194                Some(70),
1195                &helpers::child_path(path, "StrtNm"),
1196                config,
1197                collector,
1198            );
1199        }
1200        if let Some(ref val) = self.strt_nm {
1201            helpers::validate_pattern(
1202                val,
1203                "StrtNm",
1204                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1205                &helpers::child_path(path, "StrtNm"),
1206                config,
1207                collector,
1208            );
1209        }
1210        if let Some(ref val) = self.bldg_nb {
1211            helpers::validate_length(
1212                val,
1213                "BldgNb",
1214                Some(1),
1215                Some(16),
1216                &helpers::child_path(path, "BldgNb"),
1217                config,
1218                collector,
1219            );
1220        }
1221        if let Some(ref val) = self.bldg_nb {
1222            helpers::validate_pattern(
1223                val,
1224                "BldgNb",
1225                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1226                &helpers::child_path(path, "BldgNb"),
1227                config,
1228                collector,
1229            );
1230        }
1231        if let Some(ref val) = self.bldg_nm {
1232            helpers::validate_length(
1233                val,
1234                "BldgNm",
1235                Some(1),
1236                Some(35),
1237                &helpers::child_path(path, "BldgNm"),
1238                config,
1239                collector,
1240            );
1241        }
1242        if let Some(ref val) = self.bldg_nm {
1243            helpers::validate_pattern(
1244                val,
1245                "BldgNm",
1246                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1247                &helpers::child_path(path, "BldgNm"),
1248                config,
1249                collector,
1250            );
1251        }
1252        if let Some(ref val) = self.flr {
1253            helpers::validate_length(
1254                val,
1255                "Flr",
1256                Some(1),
1257                Some(70),
1258                &helpers::child_path(path, "Flr"),
1259                config,
1260                collector,
1261            );
1262        }
1263        if let Some(ref val) = self.flr {
1264            helpers::validate_pattern(
1265                val,
1266                "Flr",
1267                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1268                &helpers::child_path(path, "Flr"),
1269                config,
1270                collector,
1271            );
1272        }
1273        if let Some(ref val) = self.pst_bx {
1274            helpers::validate_length(
1275                val,
1276                "PstBx",
1277                Some(1),
1278                Some(16),
1279                &helpers::child_path(path, "PstBx"),
1280                config,
1281                collector,
1282            );
1283        }
1284        if let Some(ref val) = self.pst_bx {
1285            helpers::validate_pattern(
1286                val,
1287                "PstBx",
1288                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1289                &helpers::child_path(path, "PstBx"),
1290                config,
1291                collector,
1292            );
1293        }
1294        if let Some(ref val) = self.room {
1295            helpers::validate_length(
1296                val,
1297                "Room",
1298                Some(1),
1299                Some(70),
1300                &helpers::child_path(path, "Room"),
1301                config,
1302                collector,
1303            );
1304        }
1305        if let Some(ref val) = self.room {
1306            helpers::validate_pattern(
1307                val,
1308                "Room",
1309                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1310                &helpers::child_path(path, "Room"),
1311                config,
1312                collector,
1313            );
1314        }
1315        if let Some(ref val) = self.pst_cd {
1316            helpers::validate_length(
1317                val,
1318                "PstCd",
1319                Some(1),
1320                Some(16),
1321                &helpers::child_path(path, "PstCd"),
1322                config,
1323                collector,
1324            );
1325        }
1326        if let Some(ref val) = self.pst_cd {
1327            helpers::validate_pattern(
1328                val,
1329                "PstCd",
1330                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1331                &helpers::child_path(path, "PstCd"),
1332                config,
1333                collector,
1334            );
1335        }
1336        if let Some(ref val) = self.twn_nm {
1337            helpers::validate_length(
1338                val,
1339                "TwnNm",
1340                Some(1),
1341                Some(35),
1342                &helpers::child_path(path, "TwnNm"),
1343                config,
1344                collector,
1345            );
1346        }
1347        if let Some(ref val) = self.twn_nm {
1348            helpers::validate_pattern(
1349                val,
1350                "TwnNm",
1351                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1352                &helpers::child_path(path, "TwnNm"),
1353                config,
1354                collector,
1355            );
1356        }
1357        if let Some(ref val) = self.twn_lctn_nm {
1358            helpers::validate_length(
1359                val,
1360                "TwnLctnNm",
1361                Some(1),
1362                Some(35),
1363                &helpers::child_path(path, "TwnLctnNm"),
1364                config,
1365                collector,
1366            );
1367        }
1368        if let Some(ref val) = self.twn_lctn_nm {
1369            helpers::validate_pattern(
1370                val,
1371                "TwnLctnNm",
1372                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1373                &helpers::child_path(path, "TwnLctnNm"),
1374                config,
1375                collector,
1376            );
1377        }
1378        if let Some(ref val) = self.dstrct_nm {
1379            helpers::validate_length(
1380                val,
1381                "DstrctNm",
1382                Some(1),
1383                Some(35),
1384                &helpers::child_path(path, "DstrctNm"),
1385                config,
1386                collector,
1387            );
1388        }
1389        if let Some(ref val) = self.dstrct_nm {
1390            helpers::validate_pattern(
1391                val,
1392                "DstrctNm",
1393                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1394                &helpers::child_path(path, "DstrctNm"),
1395                config,
1396                collector,
1397            );
1398        }
1399        if let Some(ref val) = self.ctry_sub_dvsn {
1400            helpers::validate_length(
1401                val,
1402                "CtrySubDvsn",
1403                Some(1),
1404                Some(35),
1405                &helpers::child_path(path, "CtrySubDvsn"),
1406                config,
1407                collector,
1408            );
1409        }
1410        if let Some(ref val) = self.ctry_sub_dvsn {
1411            helpers::validate_pattern(
1412                val,
1413                "CtrySubDvsn",
1414                "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1415                &helpers::child_path(path, "CtrySubDvsn"),
1416                config,
1417                collector,
1418            );
1419        }
1420        if let Some(ref val) = self.ctry {
1421            helpers::validate_pattern(
1422                val,
1423                "Ctry",
1424                "[A-Z]{2,2}",
1425                &helpers::child_path(path, "Ctry"),
1426                config,
1427                collector,
1428            );
1429        }
1430        if let Some(ref vec) = self.adr_line {
1431            for item in vec {
1432                helpers::validate_length(
1433                    item,
1434                    "AdrLine",
1435                    Some(1),
1436                    Some(70),
1437                    &helpers::child_path(path, "AdrLine"),
1438                    config,
1439                    collector,
1440                );
1441            }
1442        }
1443        if let Some(ref vec) = self.adr_line {
1444            for item in vec {
1445                helpers::validate_pattern(
1446                    item,
1447                    "AdrLine",
1448                    "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1449                    &helpers::child_path(path, "AdrLine"),
1450                    config,
1451                    collector,
1452                );
1453            }
1454        }
1455    }
1456}
1457
1458// UnderlyingTransaction231: Provides information on the original transactions to which the cancellation request message refers.
1459#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1460pub struct UnderlyingTransaction231 {
1461    #[serde(rename = "TxInf")]
1462    pub tx_inf: PaymentTransaction1061,
1463}
1464
1465impl Validate for UnderlyingTransaction231 {
1466    fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1467        self.tx_inf
1468            .validate(&helpers::child_path(path, "TxInf"), config, collector);
1469    }
1470}