Skip to main content

open_payments_iso20022_auth/
auth_024_001_04.rs

1// Open Payment Message Parsing Library
2// https://github.com/Open-Payments/iso20022-rs
3//
4// This library is designed to parse message formats based on the ISO 20022 standards,
5// including but not limited to FedNow messages. It supports various financial message types,
6// such as customer credit transfers, payment status reports, administrative notifications, 
7// and other ISO 20022 messages, using Serde for efficient serialization and deserialization.
8//
9// Copyright (c) 2024 Open Payments
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14//     http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21//
22// You may obtain a copy of this library at
23// https://github.com/Open-Payments/iso20022-rs
24
25
26#![allow(unused_imports)]
27use regex::Regex;
28use iso20022_common::{common::*, ValidationError};
29#[cfg(feature = "derive_serde")]
30use serde::{Deserialize, Serialize};
31
32// PaymentRegulatoryInformationNotificationV04 ...
33#[cfg_attr(feature = "derive_debug", derive(Debug))]
34#[cfg_attr(feature = "derive_default", derive(Default))]
35#[cfg_attr(feature = "derive_serde", derive(Serialize, Deserialize))]
36#[cfg_attr(feature = "derive_clone", derive(Clone))]
37#[cfg_attr(feature = "derive_partial_eq", derive(PartialEq))]
38pub struct PaymentRegulatoryInformationNotificationV04 {
39	#[cfg_attr( feature = "derive_serde", serde(rename = "GrpHdr") )]
40	pub grp_hdr: CurrencyControlHeader9,
41	#[cfg_attr( feature = "derive_serde", serde(rename = "TxNtfctn") )]
42	pub tx_ntfctn: Vec<RegulatoryReportingNotification4>,
43	#[cfg_attr( feature = "derive_serde", serde(rename = "SplmtryData", skip_serializing_if = "Option::is_none") )]
44	pub splmtry_data: Option<Vec<SupplementaryData1>>,
45}
46
47impl PaymentRegulatoryInformationNotificationV04 {
48	pub fn validate(&self) -> Result<(), ValidationError> {
49		self.grp_hdr.validate()?;
50		for item in &self.tx_ntfctn { item.validate()? }
51		if let Some(ref vec) = self.splmtry_data { for item in vec { item.validate()? } }
52		Ok(())
53	}
54}