Skip to main content

Message

Struct Message 

Source
pub struct Message<'a, Doc: Debug + Default + Clone + PartialEq + Serialize + Deserialize<'a> + Validate> {
    pub xml_string: &'a str,
    pub inner: BizMsgEnvlp<AppHdr<Signature, Signature>, Doc, Dmkr, Dmkr>,
}

Fields§

§xml_string: &'a str

XML string representing the inner type. Used internally to parse the inner type. An incoming message will use this field for helping to determine what the inner type is.

use the to_xml() method to get the XML string representation of the message inner type.

§inner: BizMsgEnvlp<AppHdr<Signature, Signature>, Doc, Dmkr, Dmkr>

Internal representation of the message envelope

Implementations§

Source§

impl<'a, Doc> Message<'a, Doc>

Source

pub fn builder() -> Self

Source

pub fn app_hdr(&self) -> Option<AppHdr<Signature, Signature>>

Return the application header from the message envelope

Source

pub fn set_app_hdr(self, app_hdr: AppHdr<Signature, Signature>) -> Self

Set the application header AppHdr of the message Note, this will overwrite the existing AppHdr

Source

pub fn set_recipient(self, recipient: Party44Choice) -> Self

Set the recipient of the message

Source

pub fn set_recipient_org_id(self, org_id: OrganisationIdentification29) -> Self

Set the recipient organization id of the message. This is a simplified version of set_recipient that only takes an organization id. Use the set_recipient_fi_id() method to set a financial institutiton id. Note, this will overwrite any existing recipient.

Source

pub fn set_recipient_fi_id( self, fin_instn_id: FinancialInstitutionIdentification18, ) -> Self

Set the recipient financial institution id of the message. This is a simplified version of set_recipient that only takes a financial institution id. Use the set_recipient_org_id() method to set an organization id. Note, this will overwrite any existing recipient.

Source

pub fn set_recipient_prvt_id(self, prvt_id: PersonIdentification13) -> Self

Set the recipient private individual id of the message. This is a simplified version of set_recipient that only takes a private individual id. Use the set_recipient_org_id() method to set an organization id or the set_recipient_fi_id() method to set a financial institution id. Note, this will overwrite any existing recipient.

Source

pub fn set_sender(self, sender: Party44Choice) -> Self

Set the sender of the message

Source

pub fn set_sender_org_id(self, org_id: OrganisationIdentification29) -> Self

Set the sender organization id of the message. This is a simplified version of set_sender that only takes an organization id. Use the set_sender_fi_id() method to set a financial institutiton id. Note, this will overwrite any existing sender.

Source

pub fn set_sender_fi_id( self, fin_instn_id: FinancialInstitutionIdentification18, ) -> Self

Set the sender financial institution id of the message. This is a simplified version of set_sender that only takes a financial institution id. Use the set_sender_org_id() method to set an organization id. Note, this will overwrite any existing sender.

Source

pub fn set_sender_prvt_id(self, prvt_id: PersonIdentification13) -> Self

Set the sender private individual id of the message. This is a simplified version of set_sender that only takes a private individual id. Use the set_sender_org_id() method to set an organization id or the set_sender_fi_id() method to set a financial institution id. Note, this will overwrite any existing sender.

Source

pub fn set_biz_msg_idr(self, idr: Max35Text) -> Self

e.g. Document

Source

pub fn set_msg_def_idr(self, idr: Max35Text) -> Self

e.g. pacs.008.001.07

Source

pub fn set_cre_dt(self) -> Self

Set the created date time of the message. This will be set to the current UTC time.

Source

pub fn set_namespace(self) -> Self

Set the xml namespace of the message and business header.

Source

pub fn set_document(self, doc: Doc) -> Self

Set the document of the message. Note, the document must set its own namespace value. By default, all root iso-20022 message documents have an attribute field, xmlns, that is used to set the document namespace. The document namespace must be set before calling this method.

Source

pub fn sign_document( self, signer: impl Signer<Signature>, xpath: Option<&str>, ) -> Result<Self, Error>

Sign the document at an optional xpath, e.g. /Document/AcctOpngInstr If no xpath is provided, the entire document will be signed, e.g. /Document Note, this will overwrite any existing signature.

use iso_20022_sdk::prelude::*;

let msg = Message::<_>::builder()
    // Document must be set before signing
    .set_document(doc)
    // Sign the entire document
    .sign_document(&signer, None);

Source

pub fn set_rltd(self, rltd: BusinessApplicationHeader7<Signature>) -> Self

Set the related business reference of the message.

Source

pub fn document(&self) -> Doc

Return the envelope document.

Source

pub fn to_xml(&self) -> Result<String, Error>

Return the serialized xml string of the inner type.

Source

pub fn from_xml(xml_string: &'a str) -> Result<Self, Error>

parse the header from the xml string

Trait Implementations§

Source§

impl<'a, Doc: Clone + Debug + Default + Clone + PartialEq + Serialize + Deserialize<'a> + Validate> Clone for Message<'a, Doc>

Source§

fn clone(&self) -> Message<'a, Doc>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, Doc: Debug + Debug + Default + Clone + PartialEq + Serialize + Deserialize<'a> + Validate> Debug for Message<'a, Doc>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, Doc: Default + Debug + Default + Clone + PartialEq + Serialize + Deserialize<'a> + Validate> Default for Message<'a, Doc>

Source§

fn default() -> Message<'a, Doc>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, Doc> Freeze for Message<'a, Doc>
where Doc: Freeze,

§

impl<'a, Doc> RefUnwindSafe for Message<'a, Doc>
where Doc: RefUnwindSafe,

§

impl<'a, Doc> Send for Message<'a, Doc>
where Doc: Send,

§

impl<'a, Doc> Sync for Message<'a, Doc>
where Doc: Sync,

§

impl<'a, Doc> Unpin for Message<'a, Doc>
where Doc: Unpin,

§

impl<'a, Doc> UnsafeUnpin for Message<'a, Doc>
where Doc: UnsafeUnpin,

§

impl<'a, Doc> UnwindSafe for Message<'a, Doc>
where Doc: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.