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