payment_message/
lib.rs

1// FedNow Message Parsing Library
2// https://github.com/Open-Payments/messages
3//
4// This library is designed to parse FedNow message formats based on ISO 20022 standards.
5// It handles various message types, including administrative notifications, payment status reports, 
6// customer credit transfers, and more, using Serde for efficient serialization and deserialization.
7//
8// Copyright (c) 2024 Open Payments by Harishankar Narayanan
9// Licensed under the Apache License, Version 2.0 (the "License");
10// you may not use this file except in compliance with the License.
11// You may obtain a copy of the License at
12//
13//     http://www.apache.org/licenses/LICENSE-2.0
14//
15// Unless required by applicable law or agreed to in writing, software
16// distributed under the License is distributed on an "AS IS" BASIS,
17// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18// See the License for the specific language governing permissions and
19// limitations under the License.
20//
21// You may obtain a copy of this library at
22// https://github.com/Open-Payments/messages
23
24pub mod message;
25
26use serde::{Deserialize, Serialize};
27use serde_valid::Validate;
28use utoipa::ToSchema;
29use std::cmp::PartialEq;
30
31use crate::message::fednow::fednow_incoming_external::FedNowIncoming;
32use crate::message::fednow::fednow_outgoing_external::FedNowOutgoing;
33
34#[derive(Debug, Validate, ToSchema, Serialize, Deserialize, PartialEq)]
35pub enum FednowMessage {
36    #[validate]
37    #[serde(rename = "FedNowIncoming")]
38    FedNowIncoming(Box<FedNowIncoming>),
39
40	#[validate]
41    #[serde(rename = "FedNowOutgoing")]
42    FedNowOutgoing(Box<FedNowOutgoing>),
43}