1use crate::parse_result::{ErrorCollector, ParserConfig};
20use crate::validation::{Validate, helpers};
21use serde::{Deserialize, Serialize};
22
23#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
25pub struct ActiveOrHistoricCurrencyAndAmount {
26 #[serde(rename = "@Ccy")]
27 pub ccy: String,
28 #[serde(rename = "$value")]
29 pub value: f64,
30}
31
32impl Validate for ActiveOrHistoricCurrencyAndAmount {
33 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
34}
35
36#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
38pub struct BranchAndFinancialInstitutionIdentification61 {
39 #[serde(rename = "FinInstnId")]
40 pub fin_instn_id: FinancialInstitutionIdentification181,
41}
42
43impl Validate for BranchAndFinancialInstitutionIdentification61 {
44 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
45 self.fin_instn_id
46 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
47 }
48}
49
50#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
52pub struct BranchAndFinancialInstitutionIdentification62 {
53 #[serde(rename = "FinInstnId")]
54 pub fin_instn_id: FinancialInstitutionIdentification182,
55}
56
57impl Validate for BranchAndFinancialInstitutionIdentification62 {
58 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
59 self.fin_instn_id
60 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
61 }
62}
63
64#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
66pub struct BranchAndFinancialInstitutionIdentification63 {
67 #[serde(rename = "FinInstnId")]
68 pub fin_instn_id: FinancialInstitutionIdentification183,
69}
70
71impl Validate for BranchAndFinancialInstitutionIdentification63 {
72 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
73 self.fin_instn_id
74 .validate(&helpers::child_path(path, "FinInstnId"), config, collector);
75 }
76}
77
78#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
80pub enum CBPRCancellationReason1Code {
81 #[default]
82 #[serde(rename = "DUPL")]
83 CodeDUPL,
84 #[serde(rename = "CUTA")]
85 CodeCUTA,
86 #[serde(rename = "UPAY")]
87 CodeUPAY,
88 #[serde(rename = "CUST")]
89 CodeCUST,
90 #[serde(rename = "CURR")]
91 CodeCURR,
92 #[serde(rename = "AGNT")]
93 CodeAGNT,
94 #[serde(rename = "TECH")]
95 CodeTECH,
96 #[serde(rename = "FRAD")]
97 CodeFRAD,
98 #[serde(rename = "AM09")]
99 CodeAM09,
100 #[serde(rename = "NARR")]
101 CodeNARR,
102}
103
104impl Validate for CBPRCancellationReason1Code {
105 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {
106 }
108}
109
110#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
112pub struct CancellationReason33Choice1 {
113 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
114 pub cd: Option<CBPRCancellationReason1Code>,
115}
116
117impl Validate for CancellationReason33Choice1 {
118 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
119 if let Some(ref val) = self.cd
120 && config.validate_optional_fields
121 {
122 val.validate(&helpers::child_path(path, "Cd"), config, collector);
123 }
124 }
125}
126
127#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
129pub struct Case51 {
130 #[serde(rename = "Id")]
131 pub id: String,
132 #[serde(rename = "Cretr")]
133 pub cretr: Party40Choice3,
134}
135
136impl Validate for Case51 {
137 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
138 helpers::validate_length(
139 &self.id,
140 "Id",
141 Some(1),
142 Some(16),
143 &helpers::child_path(path, "Id"),
144 config,
145 collector,
146 );
147 helpers::validate_pattern(
148 &self.id,
149 "Id",
150 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
151 &helpers::child_path(path, "Id"),
152 config,
153 collector,
154 );
155 self.cretr
156 .validate(&helpers::child_path(path, "Cretr"), config, collector);
157 }
158}
159
160#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
162pub struct CaseAssignment51 {
163 #[serde(rename = "Id")]
164 pub id: String,
165 #[serde(rename = "Assgnr")]
166 pub assgnr: Party40Choice1,
167 #[serde(rename = "Assgne")]
168 pub assgne: Party40Choice2,
169 #[serde(rename = "CreDtTm")]
170 pub cre_dt_tm: String,
171}
172
173impl Validate for CaseAssignment51 {
174 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
175 helpers::validate_length(
176 &self.id,
177 "Id",
178 Some(1),
179 Some(35),
180 &helpers::child_path(path, "Id"),
181 config,
182 collector,
183 );
184 helpers::validate_pattern(
185 &self.id,
186 "Id",
187 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
188 &helpers::child_path(path, "Id"),
189 config,
190 collector,
191 );
192 self.assgnr
193 .validate(&helpers::child_path(path, "Assgnr"), config, collector);
194 self.assgne
195 .validate(&helpers::child_path(path, "Assgne"), config, collector);
196 }
197}
198
199#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
201pub struct ClearingSystemIdentification2Choice1 {
202 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
203 pub cd: Option<String>,
204}
205
206impl Validate for ClearingSystemIdentification2Choice1 {
207 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
208 if let Some(ref val) = self.cd {
209 helpers::validate_length(
210 val,
211 "Cd",
212 Some(1),
213 Some(5),
214 &helpers::child_path(path, "Cd"),
215 config,
216 collector,
217 );
218 }
219 }
220}
221
222#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
224pub struct ClearingSystemMemberIdentification21 {
225 #[serde(rename = "ClrSysId")]
226 pub clr_sys_id: ClearingSystemIdentification2Choice1,
227 #[serde(rename = "MmbId")]
228 pub mmb_id: String,
229}
230
231impl Validate for ClearingSystemMemberIdentification21 {
232 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
233 self.clr_sys_id
234 .validate(&helpers::child_path(path, "ClrSysId"), config, collector);
235 helpers::validate_length(
236 &self.mmb_id,
237 "MmbId",
238 Some(1),
239 Some(28),
240 &helpers::child_path(path, "MmbId"),
241 config,
242 collector,
243 );
244 helpers::validate_pattern(
245 &self.mmb_id,
246 "MmbId",
247 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
248 &helpers::child_path(path, "MmbId"),
249 config,
250 collector,
251 );
252 }
253}
254
255#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
257pub struct CustomerPaymentCancellationRequestV08 {
258 #[serde(rename = "Assgnmt")]
259 pub assgnmt: CaseAssignment51,
260 #[serde(rename = "Undrlyg")]
261 pub undrlyg: UnderlyingTransaction241,
262}
263
264impl Validate for CustomerPaymentCancellationRequestV08 {
265 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
266 self.assgnmt
267 .validate(&helpers::child_path(path, "Assgnmt"), config, collector);
268 self.undrlyg
269 .validate(&helpers::child_path(path, "Undrlyg"), config, collector);
270 }
271}
272
273#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
275pub struct DateAndDateTime2Choice {
276 #[serde(rename = "Dt", skip_serializing_if = "Option::is_none")]
277 pub dt: Option<String>,
278 #[serde(rename = "DtTm", skip_serializing_if = "Option::is_none")]
279 pub dt_tm: Option<String>,
280}
281
282impl Validate for DateAndDateTime2Choice {
283 fn validate(&self, _path: &str, _config: &ParserConfig, _collector: &mut ErrorCollector) {}
284}
285
286#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
288pub struct DateAndPlaceOfBirth1 {
289 #[serde(rename = "BirthDt")]
290 pub birth_dt: String,
291 #[serde(rename = "PrvcOfBirth", skip_serializing_if = "Option::is_none")]
292 pub prvc_of_birth: Option<String>,
293 #[serde(rename = "CityOfBirth")]
294 pub city_of_birth: String,
295 #[serde(rename = "CtryOfBirth")]
296 pub ctry_of_birth: String,
297}
298
299impl Validate for DateAndPlaceOfBirth1 {
300 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
301 if let Some(ref val) = self.prvc_of_birth {
302 helpers::validate_length(
303 val,
304 "PrvcOfBirth",
305 Some(1),
306 Some(35),
307 &helpers::child_path(path, "PrvcOfBirth"),
308 config,
309 collector,
310 );
311 }
312 helpers::validate_length(
313 &self.city_of_birth,
314 "CityOfBirth",
315 Some(1),
316 Some(35),
317 &helpers::child_path(path, "CityOfBirth"),
318 config,
319 collector,
320 );
321 helpers::validate_pattern(
322 &self.ctry_of_birth,
323 "CtryOfBirth",
324 "[A-Z]{2,2}",
325 &helpers::child_path(path, "CtryOfBirth"),
326 config,
327 collector,
328 );
329 }
330}
331
332#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
334pub struct FinancialInstitutionIdentification181 {
335 #[serde(rename = "BICFI")]
336 pub bicfi: String,
337 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
338 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
339 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
340 pub lei: Option<String>,
341}
342
343impl Validate for FinancialInstitutionIdentification181 {
344 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
345 helpers::validate_pattern(
346 &self.bicfi,
347 "BICFI",
348 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
349 &helpers::child_path(path, "BICFI"),
350 config,
351 collector,
352 );
353 if let Some(ref val) = self.clr_sys_mmb_id
354 && config.validate_optional_fields
355 {
356 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
357 }
358 if let Some(ref val) = self.lei {
359 helpers::validate_pattern(
360 val,
361 "LEI",
362 "[A-Z0-9]{18,18}[0-9]{2,2}",
363 &helpers::child_path(path, "LEI"),
364 config,
365 collector,
366 );
367 }
368 }
369}
370
371#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
373pub struct FinancialInstitutionIdentification182 {
374 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
375 pub bicfi: Option<String>,
376 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
377 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
378 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
379 pub lei: Option<String>,
380}
381
382impl Validate for FinancialInstitutionIdentification182 {
383 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
384 if let Some(ref val) = self.bicfi {
385 helpers::validate_pattern(
386 val,
387 "BICFI",
388 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
389 &helpers::child_path(path, "BICFI"),
390 config,
391 collector,
392 );
393 }
394 if let Some(ref val) = self.clr_sys_mmb_id
395 && config.validate_optional_fields
396 {
397 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
398 }
399 if let Some(ref val) = self.lei {
400 helpers::validate_pattern(
401 val,
402 "LEI",
403 "[A-Z0-9]{18,18}[0-9]{2,2}",
404 &helpers::child_path(path, "LEI"),
405 config,
406 collector,
407 );
408 }
409 }
410}
411
412#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
414pub struct FinancialInstitutionIdentification183 {
415 #[serde(rename = "BICFI", skip_serializing_if = "Option::is_none")]
416 pub bicfi: Option<String>,
417 #[serde(rename = "ClrSysMmbId", skip_serializing_if = "Option::is_none")]
418 pub clr_sys_mmb_id: Option<ClearingSystemMemberIdentification21>,
419 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
420 pub lei: Option<String>,
421 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
422 pub nm: Option<String>,
423 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
424 pub pstl_adr: Option<PostalAddress242>,
425}
426
427impl Validate for FinancialInstitutionIdentification183 {
428 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
429 if let Some(ref val) = self.bicfi {
430 helpers::validate_pattern(
431 val,
432 "BICFI",
433 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
434 &helpers::child_path(path, "BICFI"),
435 config,
436 collector,
437 );
438 }
439 if let Some(ref val) = self.clr_sys_mmb_id
440 && config.validate_optional_fields
441 {
442 val.validate(&helpers::child_path(path, "ClrSysMmbId"), config, collector);
443 }
444 if let Some(ref val) = self.lei {
445 helpers::validate_pattern(
446 val,
447 "LEI",
448 "[A-Z0-9]{18,18}[0-9]{2,2}",
449 &helpers::child_path(path, "LEI"),
450 config,
451 collector,
452 );
453 }
454 if let Some(ref val) = self.nm {
455 helpers::validate_length(
456 val,
457 "Nm",
458 Some(1),
459 Some(140),
460 &helpers::child_path(path, "Nm"),
461 config,
462 collector,
463 );
464 }
465 if let Some(ref val) = self.nm {
466 helpers::validate_pattern(
467 val,
468 "Nm",
469 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
470 &helpers::child_path(path, "Nm"),
471 config,
472 collector,
473 );
474 }
475 if let Some(ref val) = self.pstl_adr
476 && config.validate_optional_fields
477 {
478 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
479 }
480 }
481}
482
483#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
485pub struct GenericOrganisationIdentification1 {
486 #[serde(rename = "Id")]
487 pub id: String,
488 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
489 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice>,
490 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
491 pub issr: Option<String>,
492}
493
494impl Validate for GenericOrganisationIdentification1 {
495 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
496 helpers::validate_length(
497 &self.id,
498 "Id",
499 Some(1),
500 Some(35),
501 &helpers::child_path(path, "Id"),
502 config,
503 collector,
504 );
505 if let Some(ref val) = self.schme_nm
506 && config.validate_optional_fields
507 {
508 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
509 }
510 if let Some(ref val) = self.issr {
511 helpers::validate_length(
512 val,
513 "Issr",
514 Some(1),
515 Some(35),
516 &helpers::child_path(path, "Issr"),
517 config,
518 collector,
519 );
520 }
521 }
522}
523
524#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
526pub struct GenericOrganisationIdentification11 {
527 #[serde(rename = "Id")]
528 pub id: String,
529 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
530 pub schme_nm: Option<OrganisationIdentificationSchemeName1Choice1>,
531 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
532 pub issr: Option<String>,
533}
534
535impl Validate for GenericOrganisationIdentification11 {
536 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
537 helpers::validate_length(
538 &self.id,
539 "Id",
540 Some(1),
541 Some(35),
542 &helpers::child_path(path, "Id"),
543 config,
544 collector,
545 );
546 if let Some(ref val) = self.schme_nm
547 && config.validate_optional_fields
548 {
549 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
550 }
551 if let Some(ref val) = self.issr {
552 helpers::validate_length(
553 val,
554 "Issr",
555 Some(1),
556 Some(35),
557 &helpers::child_path(path, "Issr"),
558 config,
559 collector,
560 );
561 }
562 }
563}
564
565#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
567pub struct GenericPersonIdentification1 {
568 #[serde(rename = "Id")]
569 pub id: String,
570 #[serde(rename = "SchmeNm", skip_serializing_if = "Option::is_none")]
571 pub schme_nm: Option<PersonIdentificationSchemeName1Choice>,
572 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
573 pub issr: Option<String>,
574}
575
576impl Validate for GenericPersonIdentification1 {
577 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
578 helpers::validate_length(
579 &self.id,
580 "Id",
581 Some(1),
582 Some(35),
583 &helpers::child_path(path, "Id"),
584 config,
585 collector,
586 );
587 if let Some(ref val) = self.schme_nm
588 && config.validate_optional_fields
589 {
590 val.validate(&helpers::child_path(path, "SchmeNm"), config, collector);
591 }
592 if let Some(ref val) = self.issr {
593 helpers::validate_length(
594 val,
595 "Issr",
596 Some(1),
597 Some(35),
598 &helpers::child_path(path, "Issr"),
599 config,
600 collector,
601 );
602 }
603 }
604}
605
606#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
608pub struct GenericPersonIdentification11 {
609 #[serde(rename = "Id")]
610 pub id: String,
611 #[serde(rename = "SchmeNm")]
612 pub schme_nm: PersonIdentificationSchemeName1Choice1,
613 #[serde(rename = "Issr", skip_serializing_if = "Option::is_none")]
614 pub issr: Option<String>,
615}
616
617impl Validate for GenericPersonIdentification11 {
618 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
619 helpers::validate_length(
620 &self.id,
621 "Id",
622 Some(1),
623 Some(35),
624 &helpers::child_path(path, "Id"),
625 config,
626 collector,
627 );
628 self.schme_nm
629 .validate(&helpers::child_path(path, "SchmeNm"), config, collector);
630 if let Some(ref val) = self.issr {
631 helpers::validate_length(
632 val,
633 "Issr",
634 Some(1),
635 Some(35),
636 &helpers::child_path(path, "Issr"),
637 config,
638 collector,
639 );
640 }
641 }
642}
643
644#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
646pub struct OrganisationIdentification291 {
647 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
648 pub any_bic: Option<String>,
649 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
650 pub lei: Option<String>,
651 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
652 pub othr: Option<Vec<GenericOrganisationIdentification1>>,
653}
654
655impl Validate for OrganisationIdentification291 {
656 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
657 if let Some(ref val) = self.any_bic {
658 helpers::validate_pattern(
659 val,
660 "AnyBIC",
661 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
662 &helpers::child_path(path, "AnyBIC"),
663 config,
664 collector,
665 );
666 }
667 if let Some(ref val) = self.lei {
668 helpers::validate_pattern(
669 val,
670 "LEI",
671 "[A-Z0-9]{18,18}[0-9]{2,2}",
672 &helpers::child_path(path, "LEI"),
673 config,
674 collector,
675 );
676 }
677 if let Some(ref vec) = self.othr
678 && config.validate_optional_fields
679 {
680 for item in vec {
681 item.validate(&helpers::child_path(path, "Othr"), config, collector);
682 }
683 }
684 }
685}
686
687#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
689pub struct OrganisationIdentification292 {
690 #[serde(rename = "AnyBIC", skip_serializing_if = "Option::is_none")]
691 pub any_bic: Option<String>,
692 #[serde(rename = "LEI", skip_serializing_if = "Option::is_none")]
693 pub lei: Option<String>,
694 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
695 pub othr: Option<Vec<GenericOrganisationIdentification11>>,
696}
697
698impl Validate for OrganisationIdentification292 {
699 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
700 if let Some(ref val) = self.any_bic {
701 helpers::validate_pattern(
702 val,
703 "AnyBIC",
704 "[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}",
705 &helpers::child_path(path, "AnyBIC"),
706 config,
707 collector,
708 );
709 }
710 if let Some(ref val) = self.lei {
711 helpers::validate_pattern(
712 val,
713 "LEI",
714 "[A-Z0-9]{18,18}[0-9]{2,2}",
715 &helpers::child_path(path, "LEI"),
716 config,
717 collector,
718 );
719 }
720 if let Some(ref vec) = self.othr
721 && config.validate_optional_fields
722 {
723 for item in vec {
724 item.validate(&helpers::child_path(path, "Othr"), config, collector);
725 }
726 }
727 }
728}
729
730#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
732pub struct OrganisationIdentificationSchemeName1Choice {
733 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
734 pub cd: Option<String>,
735 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
736 pub prtry: Option<String>,
737}
738
739impl Validate for OrganisationIdentificationSchemeName1Choice {
740 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
741 if let Some(ref val) = self.cd {
742 helpers::validate_length(
743 val,
744 "Cd",
745 Some(1),
746 Some(4),
747 &helpers::child_path(path, "Cd"),
748 config,
749 collector,
750 );
751 }
752 if let Some(ref val) = self.prtry {
753 helpers::validate_length(
754 val,
755 "Prtry",
756 Some(1),
757 Some(35),
758 &helpers::child_path(path, "Prtry"),
759 config,
760 collector,
761 );
762 }
763 }
764}
765
766#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
768pub struct OrganisationIdentificationSchemeName1Choice1 {
769 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
770 pub cd: Option<String>,
771}
772
773impl Validate for OrganisationIdentificationSchemeName1Choice1 {
774 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
775 if let Some(ref val) = self.cd {
776 helpers::validate_length(
777 val,
778 "Cd",
779 Some(1),
780 Some(4),
781 &helpers::child_path(path, "Cd"),
782 config,
783 collector,
784 );
785 }
786 }
787}
788
789#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
791pub struct OriginalGroupInformation29 {
792 #[serde(rename = "OrgnlMsgId")]
793 pub orgnl_msg_id: String,
794 #[serde(rename = "OrgnlMsgNmId")]
795 pub orgnl_msg_nm_id: String,
796 #[serde(rename = "OrgnlCreDtTm", skip_serializing_if = "Option::is_none")]
797 pub orgnl_cre_dt_tm: Option<String>,
798}
799
800impl Validate for OriginalGroupInformation29 {
801 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
802 helpers::validate_length(
803 &self.orgnl_msg_id,
804 "OrgnlMsgId",
805 Some(1),
806 Some(35),
807 &helpers::child_path(path, "OrgnlMsgId"),
808 config,
809 collector,
810 );
811 helpers::validate_length(
812 &self.orgnl_msg_nm_id,
813 "OrgnlMsgNmId",
814 Some(1),
815 Some(35),
816 &helpers::child_path(path, "OrgnlMsgNmId"),
817 config,
818 collector,
819 );
820 }
821}
822
823#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
825pub struct OriginalPaymentInstruction341 {
826 #[serde(rename = "OrgnlPmtInfId")]
827 pub orgnl_pmt_inf_id: String,
828 #[serde(rename = "OrgnlGrpInf")]
829 pub orgnl_grp_inf: OriginalGroupInformation29,
830 #[serde(rename = "TxInf")]
831 pub tx_inf: PaymentTransaction1091,
832}
833
834impl Validate for OriginalPaymentInstruction341 {
835 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
836 helpers::validate_length(
837 &self.orgnl_pmt_inf_id,
838 "OrgnlPmtInfId",
839 Some(1),
840 Some(35),
841 &helpers::child_path(path, "OrgnlPmtInfId"),
842 config,
843 collector,
844 );
845 self.orgnl_grp_inf
846 .validate(&helpers::child_path(path, "OrgnlGrpInf"), config, collector);
847 self.tx_inf
848 .validate(&helpers::child_path(path, "TxInf"), config, collector);
849 }
850}
851
852#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
854pub struct Party38Choice1 {
855 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
856 pub org_id: Option<OrganisationIdentification291>,
857 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
858 pub prvt_id: Option<PersonIdentification131>,
859}
860
861impl Validate for Party38Choice1 {
862 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
863 if let Some(ref val) = self.org_id
864 && config.validate_optional_fields
865 {
866 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
867 }
868 if let Some(ref val) = self.prvt_id
869 && config.validate_optional_fields
870 {
871 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
872 }
873 }
874}
875
876#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
878pub struct Party38Choice2 {
879 #[serde(rename = "OrgId", skip_serializing_if = "Option::is_none")]
880 pub org_id: Option<OrganisationIdentification292>,
881 #[serde(rename = "PrvtId", skip_serializing_if = "Option::is_none")]
882 pub prvt_id: Option<PersonIdentification132>,
883}
884
885impl Validate for Party38Choice2 {
886 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
887 if let Some(ref val) = self.org_id
888 && config.validate_optional_fields
889 {
890 val.validate(&helpers::child_path(path, "OrgId"), config, collector);
891 }
892 if let Some(ref val) = self.prvt_id
893 && config.validate_optional_fields
894 {
895 val.validate(&helpers::child_path(path, "PrvtId"), config, collector);
896 }
897 }
898}
899
900#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
902pub struct Party40Choice1 {
903 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
904 pub agt: Option<BranchAndFinancialInstitutionIdentification61>,
905}
906
907impl Validate for Party40Choice1 {
908 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
909 if let Some(ref val) = self.agt
910 && config.validate_optional_fields
911 {
912 val.validate(&helpers::child_path(path, "Agt"), config, collector);
913 }
914 }
915}
916
917#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
919pub struct Party40Choice2 {
920 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
921 pub agt: Option<BranchAndFinancialInstitutionIdentification62>,
922}
923
924impl Validate for Party40Choice2 {
925 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
926 if let Some(ref val) = self.agt
927 && config.validate_optional_fields
928 {
929 val.validate(&helpers::child_path(path, "Agt"), config, collector);
930 }
931 }
932}
933
934#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
936pub struct Party40Choice3 {
937 #[serde(rename = "Pty", skip_serializing_if = "Option::is_none")]
938 pub pty: Option<PartyIdentification1351>,
939 #[serde(rename = "Agt", skip_serializing_if = "Option::is_none")]
940 pub agt: Option<BranchAndFinancialInstitutionIdentification63>,
941}
942
943impl Validate for Party40Choice3 {
944 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
945 if let Some(ref val) = self.pty
946 && config.validate_optional_fields
947 {
948 val.validate(&helpers::child_path(path, "Pty"), config, collector);
949 }
950 if let Some(ref val) = self.agt
951 && config.validate_optional_fields
952 {
953 val.validate(&helpers::child_path(path, "Agt"), config, collector);
954 }
955 }
956}
957
958#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
960pub struct PartyIdentification1351 {
961 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
962 pub nm: Option<String>,
963 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
964 pub pstl_adr: Option<PostalAddress241>,
965 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
966 pub id: Option<Party38Choice1>,
967 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
968 pub ctry_of_res: Option<String>,
969}
970
971impl Validate for PartyIdentification1351 {
972 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
973 if let Some(ref val) = self.nm {
974 helpers::validate_length(
975 val,
976 "Nm",
977 Some(1),
978 Some(140),
979 &helpers::child_path(path, "Nm"),
980 config,
981 collector,
982 );
983 }
984 if let Some(ref val) = self.pstl_adr
985 && config.validate_optional_fields
986 {
987 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
988 }
989 if let Some(ref val) = self.id
990 && config.validate_optional_fields
991 {
992 val.validate(&helpers::child_path(path, "Id"), config, collector);
993 }
994 if let Some(ref val) = self.ctry_of_res {
995 helpers::validate_pattern(
996 val,
997 "CtryOfRes",
998 "[A-Z]{2,2}",
999 &helpers::child_path(path, "CtryOfRes"),
1000 config,
1001 collector,
1002 );
1003 }
1004 }
1005}
1006
1007#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1009pub struct PartyIdentification1352 {
1010 #[serde(rename = "Nm", skip_serializing_if = "Option::is_none")]
1011 pub nm: Option<String>,
1012 #[serde(rename = "PstlAdr", skip_serializing_if = "Option::is_none")]
1013 pub pstl_adr: Option<PostalAddress241>,
1014 #[serde(rename = "Id", skip_serializing_if = "Option::is_none")]
1015 pub id: Option<Party38Choice2>,
1016 #[serde(rename = "CtryOfRes", skip_serializing_if = "Option::is_none")]
1017 pub ctry_of_res: Option<String>,
1018}
1019
1020impl Validate for PartyIdentification1352 {
1021 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1022 if let Some(ref val) = self.nm {
1023 helpers::validate_length(
1024 val,
1025 "Nm",
1026 Some(1),
1027 Some(140),
1028 &helpers::child_path(path, "Nm"),
1029 config,
1030 collector,
1031 );
1032 }
1033 if let Some(ref val) = self.pstl_adr
1034 && config.validate_optional_fields
1035 {
1036 val.validate(&helpers::child_path(path, "PstlAdr"), config, collector);
1037 }
1038 if let Some(ref val) = self.id
1039 && config.validate_optional_fields
1040 {
1041 val.validate(&helpers::child_path(path, "Id"), config, collector);
1042 }
1043 if let Some(ref val) = self.ctry_of_res {
1044 helpers::validate_pattern(
1045 val,
1046 "CtryOfRes",
1047 "[A-Z]{2,2}",
1048 &helpers::child_path(path, "CtryOfRes"),
1049 config,
1050 collector,
1051 );
1052 }
1053 }
1054}
1055
1056#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1058pub struct PaymentCancellationReason51 {
1059 #[serde(rename = "Orgtr", skip_serializing_if = "Option::is_none")]
1060 pub orgtr: Option<PartyIdentification1352>,
1061 #[serde(rename = "Rsn")]
1062 pub rsn: CancellationReason33Choice1,
1063 #[serde(rename = "AddtlInf", skip_serializing_if = "Option::is_none")]
1064 pub addtl_inf: Option<Vec<String>>,
1065}
1066
1067impl Validate for PaymentCancellationReason51 {
1068 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1069 if let Some(ref val) = self.orgtr
1070 && config.validate_optional_fields
1071 {
1072 val.validate(&helpers::child_path(path, "Orgtr"), config, collector);
1073 }
1074 self.rsn
1075 .validate(&helpers::child_path(path, "Rsn"), config, collector);
1076 if let Some(ref vec) = self.addtl_inf {
1077 for item in vec {
1078 helpers::validate_length(
1079 item,
1080 "AddtlInf",
1081 Some(1),
1082 Some(105),
1083 &helpers::child_path(path, "AddtlInf"),
1084 config,
1085 collector,
1086 );
1087 }
1088 }
1089 if let Some(ref vec) = self.addtl_inf {
1090 for item in vec {
1091 helpers::validate_pattern(
1092 item,
1093 "AddtlInf",
1094 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ ]+",
1095 &helpers::child_path(path, "AddtlInf"),
1096 config,
1097 collector,
1098 );
1099 }
1100 }
1101 }
1102}
1103
1104#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1106pub struct PaymentTransaction1091 {
1107 #[serde(rename = "CxlId", skip_serializing_if = "Option::is_none")]
1108 pub cxl_id: Option<String>,
1109 #[serde(rename = "Case")]
1110 pub case: Case51,
1111 #[serde(rename = "OrgnlInstrId", skip_serializing_if = "Option::is_none")]
1112 pub orgnl_instr_id: Option<String>,
1113 #[serde(rename = "OrgnlEndToEndId")]
1114 pub orgnl_end_to_end_id: String,
1115 #[serde(rename = "OrgnlUETR")]
1116 pub orgnl_uetr: String,
1117 #[serde(rename = "OrgnlInstdAmt")]
1118 pub orgnl_instd_amt: ActiveOrHistoricCurrencyAndAmount,
1119 #[serde(rename = "OrgnlReqdExctnDt", skip_serializing_if = "Option::is_none")]
1120 pub orgnl_reqd_exctn_dt: Option<DateAndDateTime2Choice>,
1121 #[serde(rename = "OrgnlReqdColltnDt", skip_serializing_if = "Option::is_none")]
1122 pub orgnl_reqd_colltn_dt: Option<String>,
1123 #[serde(rename = "CxlRsnInf")]
1124 pub cxl_rsn_inf: PaymentCancellationReason51,
1125}
1126
1127impl Validate for PaymentTransaction1091 {
1128 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1129 if let Some(ref val) = self.cxl_id {
1130 helpers::validate_length(
1131 val,
1132 "CxlId",
1133 Some(1),
1134 Some(35),
1135 &helpers::child_path(path, "CxlId"),
1136 config,
1137 collector,
1138 );
1139 }
1140 self.case
1141 .validate(&helpers::child_path(path, "Case"), config, collector);
1142 if let Some(ref val) = self.orgnl_instr_id {
1143 helpers::validate_length(
1144 val,
1145 "OrgnlInstrId",
1146 Some(1),
1147 Some(35),
1148 &helpers::child_path(path, "OrgnlInstrId"),
1149 config,
1150 collector,
1151 );
1152 }
1153 helpers::validate_length(
1154 &self.orgnl_end_to_end_id,
1155 "OrgnlEndToEndId",
1156 Some(1),
1157 Some(35),
1158 &helpers::child_path(path, "OrgnlEndToEndId"),
1159 config,
1160 collector,
1161 );
1162 helpers::validate_pattern(
1163 &self.orgnl_uetr,
1164 "OrgnlUETR",
1165 "[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}",
1166 &helpers::child_path(path, "OrgnlUETR"),
1167 config,
1168 collector,
1169 );
1170 self.orgnl_instd_amt.validate(
1171 &helpers::child_path(path, "OrgnlInstdAmt"),
1172 config,
1173 collector,
1174 );
1175 if let Some(ref val) = self.orgnl_reqd_exctn_dt
1176 && config.validate_optional_fields
1177 {
1178 val.validate(
1179 &helpers::child_path(path, "OrgnlReqdExctnDt"),
1180 config,
1181 collector,
1182 );
1183 }
1184 self.cxl_rsn_inf
1185 .validate(&helpers::child_path(path, "CxlRsnInf"), config, collector);
1186 }
1187}
1188
1189#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1191pub struct PersonIdentification131 {
1192 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1193 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
1194 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1195 pub othr: Option<Vec<GenericPersonIdentification1>>,
1196}
1197
1198impl Validate for PersonIdentification131 {
1199 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1200 if let Some(ref val) = self.dt_and_plc_of_birth
1201 && config.validate_optional_fields
1202 {
1203 val.validate(
1204 &helpers::child_path(path, "DtAndPlcOfBirth"),
1205 config,
1206 collector,
1207 );
1208 }
1209 if let Some(ref vec) = self.othr
1210 && config.validate_optional_fields
1211 {
1212 for item in vec {
1213 item.validate(&helpers::child_path(path, "Othr"), config, collector);
1214 }
1215 }
1216 }
1217}
1218
1219#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1221pub struct PersonIdentification132 {
1222 #[serde(rename = "DtAndPlcOfBirth", skip_serializing_if = "Option::is_none")]
1223 pub dt_and_plc_of_birth: Option<DateAndPlaceOfBirth1>,
1224 #[serde(rename = "Othr", skip_serializing_if = "Option::is_none")]
1225 pub othr: Option<Vec<GenericPersonIdentification11>>,
1226}
1227
1228impl Validate for PersonIdentification132 {
1229 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1230 if let Some(ref val) = self.dt_and_plc_of_birth
1231 && config.validate_optional_fields
1232 {
1233 val.validate(
1234 &helpers::child_path(path, "DtAndPlcOfBirth"),
1235 config,
1236 collector,
1237 );
1238 }
1239 if let Some(ref vec) = self.othr
1240 && config.validate_optional_fields
1241 {
1242 for item in vec {
1243 item.validate(&helpers::child_path(path, "Othr"), config, collector);
1244 }
1245 }
1246 }
1247}
1248
1249#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1251pub struct PersonIdentificationSchemeName1Choice {
1252 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1253 pub cd: Option<String>,
1254 #[serde(rename = "Prtry", skip_serializing_if = "Option::is_none")]
1255 pub prtry: Option<String>,
1256}
1257
1258impl Validate for PersonIdentificationSchemeName1Choice {
1259 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1260 if let Some(ref val) = self.cd {
1261 helpers::validate_length(
1262 val,
1263 "Cd",
1264 Some(1),
1265 Some(4),
1266 &helpers::child_path(path, "Cd"),
1267 config,
1268 collector,
1269 );
1270 }
1271 if let Some(ref val) = self.prtry {
1272 helpers::validate_length(
1273 val,
1274 "Prtry",
1275 Some(1),
1276 Some(35),
1277 &helpers::child_path(path, "Prtry"),
1278 config,
1279 collector,
1280 );
1281 }
1282 }
1283}
1284
1285#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1287pub struct PersonIdentificationSchemeName1Choice1 {
1288 #[serde(rename = "Cd", skip_serializing_if = "Option::is_none")]
1289 pub cd: Option<String>,
1290}
1291
1292impl Validate for PersonIdentificationSchemeName1Choice1 {
1293 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1294 if let Some(ref val) = self.cd {
1295 helpers::validate_length(
1296 val,
1297 "Cd",
1298 Some(1),
1299 Some(4),
1300 &helpers::child_path(path, "Cd"),
1301 config,
1302 collector,
1303 );
1304 }
1305 }
1306}
1307
1308#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1310pub struct PostalAddress241 {
1311 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1312 pub dept: Option<String>,
1313 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1314 pub sub_dept: Option<String>,
1315 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1316 pub strt_nm: Option<String>,
1317 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1318 pub bldg_nb: Option<String>,
1319 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1320 pub bldg_nm: Option<String>,
1321 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1322 pub flr: Option<String>,
1323 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1324 pub pst_bx: Option<String>,
1325 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1326 pub room: Option<String>,
1327 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1328 pub pst_cd: Option<String>,
1329 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1330 pub twn_nm: Option<String>,
1331 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1332 pub twn_lctn_nm: Option<String>,
1333 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1334 pub dstrct_nm: Option<String>,
1335 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1336 pub ctry_sub_dvsn: Option<String>,
1337 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1338 pub ctry: Option<String>,
1339 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1340 pub adr_line: Option<Vec<String>>,
1341}
1342
1343impl Validate for PostalAddress241 {
1344 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1345 if let Some(ref val) = self.dept {
1346 helpers::validate_length(
1347 val,
1348 "Dept",
1349 Some(1),
1350 Some(70),
1351 &helpers::child_path(path, "Dept"),
1352 config,
1353 collector,
1354 );
1355 }
1356 if let Some(ref val) = self.sub_dept {
1357 helpers::validate_length(
1358 val,
1359 "SubDept",
1360 Some(1),
1361 Some(70),
1362 &helpers::child_path(path, "SubDept"),
1363 config,
1364 collector,
1365 );
1366 }
1367 if let Some(ref val) = self.strt_nm {
1368 helpers::validate_length(
1369 val,
1370 "StrtNm",
1371 Some(1),
1372 Some(70),
1373 &helpers::child_path(path, "StrtNm"),
1374 config,
1375 collector,
1376 );
1377 }
1378 if let Some(ref val) = self.bldg_nb {
1379 helpers::validate_length(
1380 val,
1381 "BldgNb",
1382 Some(1),
1383 Some(16),
1384 &helpers::child_path(path, "BldgNb"),
1385 config,
1386 collector,
1387 );
1388 }
1389 if let Some(ref val) = self.bldg_nm {
1390 helpers::validate_length(
1391 val,
1392 "BldgNm",
1393 Some(1),
1394 Some(35),
1395 &helpers::child_path(path, "BldgNm"),
1396 config,
1397 collector,
1398 );
1399 }
1400 if let Some(ref val) = self.flr {
1401 helpers::validate_length(
1402 val,
1403 "Flr",
1404 Some(1),
1405 Some(70),
1406 &helpers::child_path(path, "Flr"),
1407 config,
1408 collector,
1409 );
1410 }
1411 if let Some(ref val) = self.pst_bx {
1412 helpers::validate_length(
1413 val,
1414 "PstBx",
1415 Some(1),
1416 Some(16),
1417 &helpers::child_path(path, "PstBx"),
1418 config,
1419 collector,
1420 );
1421 }
1422 if let Some(ref val) = self.room {
1423 helpers::validate_length(
1424 val,
1425 "Room",
1426 Some(1),
1427 Some(70),
1428 &helpers::child_path(path, "Room"),
1429 config,
1430 collector,
1431 );
1432 }
1433 if let Some(ref val) = self.pst_cd {
1434 helpers::validate_length(
1435 val,
1436 "PstCd",
1437 Some(1),
1438 Some(16),
1439 &helpers::child_path(path, "PstCd"),
1440 config,
1441 collector,
1442 );
1443 }
1444 if let Some(ref val) = self.twn_nm {
1445 helpers::validate_length(
1446 val,
1447 "TwnNm",
1448 Some(1),
1449 Some(35),
1450 &helpers::child_path(path, "TwnNm"),
1451 config,
1452 collector,
1453 );
1454 }
1455 if let Some(ref val) = self.twn_lctn_nm {
1456 helpers::validate_length(
1457 val,
1458 "TwnLctnNm",
1459 Some(1),
1460 Some(35),
1461 &helpers::child_path(path, "TwnLctnNm"),
1462 config,
1463 collector,
1464 );
1465 }
1466 if let Some(ref val) = self.dstrct_nm {
1467 helpers::validate_length(
1468 val,
1469 "DstrctNm",
1470 Some(1),
1471 Some(35),
1472 &helpers::child_path(path, "DstrctNm"),
1473 config,
1474 collector,
1475 );
1476 }
1477 if let Some(ref val) = self.ctry_sub_dvsn {
1478 helpers::validate_length(
1479 val,
1480 "CtrySubDvsn",
1481 Some(1),
1482 Some(35),
1483 &helpers::child_path(path, "CtrySubDvsn"),
1484 config,
1485 collector,
1486 );
1487 }
1488 if let Some(ref val) = self.ctry {
1489 helpers::validate_pattern(
1490 val,
1491 "Ctry",
1492 "[A-Z]{2,2}",
1493 &helpers::child_path(path, "Ctry"),
1494 config,
1495 collector,
1496 );
1497 }
1498 if let Some(ref vec) = self.adr_line {
1499 for item in vec {
1500 helpers::validate_length(
1501 item,
1502 "AdrLine",
1503 Some(1),
1504 Some(70),
1505 &helpers::child_path(path, "AdrLine"),
1506 config,
1507 collector,
1508 );
1509 }
1510 }
1511 }
1512}
1513
1514#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1516pub struct PostalAddress242 {
1517 #[serde(rename = "Dept", skip_serializing_if = "Option::is_none")]
1518 pub dept: Option<String>,
1519 #[serde(rename = "SubDept", skip_serializing_if = "Option::is_none")]
1520 pub sub_dept: Option<String>,
1521 #[serde(rename = "StrtNm", skip_serializing_if = "Option::is_none")]
1522 pub strt_nm: Option<String>,
1523 #[serde(rename = "BldgNb", skip_serializing_if = "Option::is_none")]
1524 pub bldg_nb: Option<String>,
1525 #[serde(rename = "BldgNm", skip_serializing_if = "Option::is_none")]
1526 pub bldg_nm: Option<String>,
1527 #[serde(rename = "Flr", skip_serializing_if = "Option::is_none")]
1528 pub flr: Option<String>,
1529 #[serde(rename = "PstBx", skip_serializing_if = "Option::is_none")]
1530 pub pst_bx: Option<String>,
1531 #[serde(rename = "Room", skip_serializing_if = "Option::is_none")]
1532 pub room: Option<String>,
1533 #[serde(rename = "PstCd", skip_serializing_if = "Option::is_none")]
1534 pub pst_cd: Option<String>,
1535 #[serde(rename = "TwnNm", skip_serializing_if = "Option::is_none")]
1536 pub twn_nm: Option<String>,
1537 #[serde(rename = "TwnLctnNm", skip_serializing_if = "Option::is_none")]
1538 pub twn_lctn_nm: Option<String>,
1539 #[serde(rename = "DstrctNm", skip_serializing_if = "Option::is_none")]
1540 pub dstrct_nm: Option<String>,
1541 #[serde(rename = "CtrySubDvsn", skip_serializing_if = "Option::is_none")]
1542 pub ctry_sub_dvsn: Option<String>,
1543 #[serde(rename = "Ctry", skip_serializing_if = "Option::is_none")]
1544 pub ctry: Option<String>,
1545 #[serde(rename = "AdrLine", skip_serializing_if = "Option::is_none")]
1546 pub adr_line: Option<Vec<String>>,
1547}
1548
1549impl Validate for PostalAddress242 {
1550 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1551 if let Some(ref val) = self.dept {
1552 helpers::validate_length(
1553 val,
1554 "Dept",
1555 Some(1),
1556 Some(70),
1557 &helpers::child_path(path, "Dept"),
1558 config,
1559 collector,
1560 );
1561 }
1562 if let Some(ref val) = self.dept {
1563 helpers::validate_pattern(
1564 val,
1565 "Dept",
1566 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1567 &helpers::child_path(path, "Dept"),
1568 config,
1569 collector,
1570 );
1571 }
1572 if let Some(ref val) = self.sub_dept {
1573 helpers::validate_length(
1574 val,
1575 "SubDept",
1576 Some(1),
1577 Some(70),
1578 &helpers::child_path(path, "SubDept"),
1579 config,
1580 collector,
1581 );
1582 }
1583 if let Some(ref val) = self.sub_dept {
1584 helpers::validate_pattern(
1585 val,
1586 "SubDept",
1587 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1588 &helpers::child_path(path, "SubDept"),
1589 config,
1590 collector,
1591 );
1592 }
1593 if let Some(ref val) = self.strt_nm {
1594 helpers::validate_length(
1595 val,
1596 "StrtNm",
1597 Some(1),
1598 Some(70),
1599 &helpers::child_path(path, "StrtNm"),
1600 config,
1601 collector,
1602 );
1603 }
1604 if let Some(ref val) = self.strt_nm {
1605 helpers::validate_pattern(
1606 val,
1607 "StrtNm",
1608 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1609 &helpers::child_path(path, "StrtNm"),
1610 config,
1611 collector,
1612 );
1613 }
1614 if let Some(ref val) = self.bldg_nb {
1615 helpers::validate_length(
1616 val,
1617 "BldgNb",
1618 Some(1),
1619 Some(16),
1620 &helpers::child_path(path, "BldgNb"),
1621 config,
1622 collector,
1623 );
1624 }
1625 if let Some(ref val) = self.bldg_nb {
1626 helpers::validate_pattern(
1627 val,
1628 "BldgNb",
1629 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1630 &helpers::child_path(path, "BldgNb"),
1631 config,
1632 collector,
1633 );
1634 }
1635 if let Some(ref val) = self.bldg_nm {
1636 helpers::validate_length(
1637 val,
1638 "BldgNm",
1639 Some(1),
1640 Some(35),
1641 &helpers::child_path(path, "BldgNm"),
1642 config,
1643 collector,
1644 );
1645 }
1646 if let Some(ref val) = self.bldg_nm {
1647 helpers::validate_pattern(
1648 val,
1649 "BldgNm",
1650 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1651 &helpers::child_path(path, "BldgNm"),
1652 config,
1653 collector,
1654 );
1655 }
1656 if let Some(ref val) = self.flr {
1657 helpers::validate_length(
1658 val,
1659 "Flr",
1660 Some(1),
1661 Some(70),
1662 &helpers::child_path(path, "Flr"),
1663 config,
1664 collector,
1665 );
1666 }
1667 if let Some(ref val) = self.flr {
1668 helpers::validate_pattern(
1669 val,
1670 "Flr",
1671 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1672 &helpers::child_path(path, "Flr"),
1673 config,
1674 collector,
1675 );
1676 }
1677 if let Some(ref val) = self.pst_bx {
1678 helpers::validate_length(
1679 val,
1680 "PstBx",
1681 Some(1),
1682 Some(16),
1683 &helpers::child_path(path, "PstBx"),
1684 config,
1685 collector,
1686 );
1687 }
1688 if let Some(ref val) = self.pst_bx {
1689 helpers::validate_pattern(
1690 val,
1691 "PstBx",
1692 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1693 &helpers::child_path(path, "PstBx"),
1694 config,
1695 collector,
1696 );
1697 }
1698 if let Some(ref val) = self.room {
1699 helpers::validate_length(
1700 val,
1701 "Room",
1702 Some(1),
1703 Some(70),
1704 &helpers::child_path(path, "Room"),
1705 config,
1706 collector,
1707 );
1708 }
1709 if let Some(ref val) = self.room {
1710 helpers::validate_pattern(
1711 val,
1712 "Room",
1713 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1714 &helpers::child_path(path, "Room"),
1715 config,
1716 collector,
1717 );
1718 }
1719 if let Some(ref val) = self.pst_cd {
1720 helpers::validate_length(
1721 val,
1722 "PstCd",
1723 Some(1),
1724 Some(16),
1725 &helpers::child_path(path, "PstCd"),
1726 config,
1727 collector,
1728 );
1729 }
1730 if let Some(ref val) = self.pst_cd {
1731 helpers::validate_pattern(
1732 val,
1733 "PstCd",
1734 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1735 &helpers::child_path(path, "PstCd"),
1736 config,
1737 collector,
1738 );
1739 }
1740 if let Some(ref val) = self.twn_nm {
1741 helpers::validate_length(
1742 val,
1743 "TwnNm",
1744 Some(1),
1745 Some(35),
1746 &helpers::child_path(path, "TwnNm"),
1747 config,
1748 collector,
1749 );
1750 }
1751 if let Some(ref val) = self.twn_nm {
1752 helpers::validate_pattern(
1753 val,
1754 "TwnNm",
1755 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1756 &helpers::child_path(path, "TwnNm"),
1757 config,
1758 collector,
1759 );
1760 }
1761 if let Some(ref val) = self.twn_lctn_nm {
1762 helpers::validate_length(
1763 val,
1764 "TwnLctnNm",
1765 Some(1),
1766 Some(35),
1767 &helpers::child_path(path, "TwnLctnNm"),
1768 config,
1769 collector,
1770 );
1771 }
1772 if let Some(ref val) = self.twn_lctn_nm {
1773 helpers::validate_pattern(
1774 val,
1775 "TwnLctnNm",
1776 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1777 &helpers::child_path(path, "TwnLctnNm"),
1778 config,
1779 collector,
1780 );
1781 }
1782 if let Some(ref val) = self.dstrct_nm {
1783 helpers::validate_length(
1784 val,
1785 "DstrctNm",
1786 Some(1),
1787 Some(35),
1788 &helpers::child_path(path, "DstrctNm"),
1789 config,
1790 collector,
1791 );
1792 }
1793 if let Some(ref val) = self.dstrct_nm {
1794 helpers::validate_pattern(
1795 val,
1796 "DstrctNm",
1797 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1798 &helpers::child_path(path, "DstrctNm"),
1799 config,
1800 collector,
1801 );
1802 }
1803 if let Some(ref val) = self.ctry_sub_dvsn {
1804 helpers::validate_length(
1805 val,
1806 "CtrySubDvsn",
1807 Some(1),
1808 Some(35),
1809 &helpers::child_path(path, "CtrySubDvsn"),
1810 config,
1811 collector,
1812 );
1813 }
1814 if let Some(ref val) = self.ctry_sub_dvsn {
1815 helpers::validate_pattern(
1816 val,
1817 "CtrySubDvsn",
1818 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1819 &helpers::child_path(path, "CtrySubDvsn"),
1820 config,
1821 collector,
1822 );
1823 }
1824 if let Some(ref val) = self.ctry {
1825 helpers::validate_pattern(
1826 val,
1827 "Ctry",
1828 "[A-Z]{2,2}",
1829 &helpers::child_path(path, "Ctry"),
1830 config,
1831 collector,
1832 );
1833 }
1834 if let Some(ref vec) = self.adr_line {
1835 for item in vec {
1836 helpers::validate_length(
1837 item,
1838 "AdrLine",
1839 Some(1),
1840 Some(70),
1841 &helpers::child_path(path, "AdrLine"),
1842 config,
1843 collector,
1844 );
1845 }
1846 }
1847 if let Some(ref vec) = self.adr_line {
1848 for item in vec {
1849 helpers::validate_pattern(
1850 item,
1851 "AdrLine",
1852 "[0-9a-zA-Z/\\-\\?:\\(\\)\\.,'\\+ !#$%&\\*=^_`\\{\\|\\}~\";<>@\\[\\\\\\]]+",
1853 &helpers::child_path(path, "AdrLine"),
1854 config,
1855 collector,
1856 );
1857 }
1858 }
1859 }
1860}
1861
1862#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
1864pub struct UnderlyingTransaction241 {
1865 #[serde(rename = "OrgnlPmtInfAndCxl")]
1866 pub orgnl_pmt_inf_and_cxl: OriginalPaymentInstruction341,
1867}
1868
1869impl Validate for UnderlyingTransaction241 {
1870 fn validate(&self, path: &str, config: &ParserConfig, collector: &mut ErrorCollector) {
1871 self.orgnl_pmt_inf_and_cxl.validate(
1872 &helpers::child_path(path, "OrgnlPmtInfAndCxl"),
1873 config,
1874 collector,
1875 );
1876 }
1877}