Class SepaMessageInfo
Describes the details of a particular SEPA message variant.
public sealed class SepaMessageInfo
- Inheritance
-
SepaMessageInfo
- Inherited Members
Remarks
At a minimum there are the properties MessageType, Version, and MessageTag which generically describe the message type. These basic properties are set in the object constructor and cannot be changed thereafter.
For special variants of SEPA messages, the optional properties XmlNamespace and XmlSchemaLocation provide further information about the variant. These properties can be changed after the object has been created.
Constructors
SepaMessageInfo(SepaMessageInfo)
Creates a new SepaMessageInfo object as a copy of another one.
public SepaMessageInfo(SepaMessageInfo aMessageInfo)
Parameters
aMessageInfo
SepaMessageInfoSepaMessageInfo to copy. Must not be
null
.
Exceptions
- ArgumentNullException
The aMessageInfo parameter was
null
.
SepaMessageInfo(SepaMessageType, int)
Creates a new generic SepaMessageInfo object for a given message type and version.
public SepaMessageInfo(SepaMessageType nMessageType, int nVersion)
Parameters
nMessageType
SepaMessageTypeThe fundamental SEPA message type.
nVersion
intThe SEPA message version number. This usually corresponds with the last two digits of a payment initiation name. For example, given the message specification "pain.001.002.03", the version number would be 3. The value must not be 0 or negative.
Exceptions
- ArgumentException
The parameter nVersion was less than 1 or the parameter nMessageType was invalid.
SepaMessageInfo(SepaMessageType, int, string, string, string)
Creates a fully specified new SepaMessageInfo object.
public SepaMessageInfo(SepaMessageType nMessageType, int nVersion, string sMessageTag, string sXmlNamespace, string sXmlSchemaLocation)
Parameters
nMessageType
SepaMessageTypeThe fundamental SEPA message type.
nVersion
intThe SEPA message version number. This usually corresponds with the last two digits of a payment initiataion name. For example, given the message specification "pain.001.002.03", the version number would be 3. The value must not be 0 or negative.
sMessageTag
stringThe mandatory SEPA message (XML) tag. Note that the correct message tag that must be used is usually predetermined by the message type and version.
sXmlNamespace
stringThe optional XML namespace. This may be an empty string in order to signify the unnamed default namespace. This may be
null
if the XML namespace shall not be specified at this time.sXmlSchemaLocation
stringThe optional XML schema location. This may be
null
if the XML schema location shall not be specified. If a schema location is given, then the XML namespace must also be specified.
Exceptions
- ArgumentNullException
The sMessageTag parameter was
null
.- ArgumentException
The parameter nVersion was less than 1, or the parameter sMessageTag was not a valid XML tag name.
SepaMessageInfo(string)
Creates a new SepaMessageInfo object for a message based on a given XML namespace.
public SepaMessageInfo(string sXmlNamespace)
Parameters
sXmlNamespace
stringThe XML namespace based on which a new message shall be created. This must not be
null
. The SepaMessageType, and the message version are all derived from that given namespace name. This must be a well known namespace, or it must contain an embedded message type identifier, such as "camt.052.001.08" or "pain.001.001.03".
Exceptions
- ArgumentException
It was not possible to create a message based on the given namespace name. This is probably due to an unknown or malformed namespace name.
Properties
MessageTag
The SEPA message XML tag.
public string MessageTag { get; }
Property Value
MessageType
The fundamental SEPA message type.
public SepaMessageType MessageType { get; }
Property Value
PainIdentifier
The SEPA message identifier.
public string PainIdentifier { get; }
Property Value
Remarks
This returns a string in the format "pain.000.000.00" which identifies the SEPA message type and version. If a XmlNamespace was set, then it is used in an attempt to determine the exact message variant.
If this message info does not describe a Pain message, then null
is
returned.
Version
The SEPA message version.
public int Version { get; }
Property Value
Remarks
This usually corresponds with the last two digits of a payment initiataion name. For example, given the message specification "pain.001.002.03", the version number would be 3. The value must not be 0 or negative.
WellKnownMessage
If created via Create(SepaWellKnownMessageInfos), then this is the SepaWellKnownMessageInfos value that used for creating this instance.
public SepaWellKnownMessageInfos WellKnownMessage { get; }
Property Value
XmlNamespace
The SEPA message XML namespace URN.
public string XmlNamespace { get; set; }
Property Value
Remarks
This may be an empty string to signify the unnamed default namespace.
This may be null
for a generic SEPA message information.
XmlSchemaLocation
The SEPA message XML schema location.
public string XmlSchemaLocation { get; set; }
Property Value
Remarks
This may be null
if the schema location was not included in a parsed
message, or should not be included in a generated message.
Methods
Clone()
Creates a copy of this SepaMessageInfo object.
public SepaMessageInfo Clone()
Returns
- SepaMessageInfo
A copy of this SepaMessageInfo object.
Create(SepaWellKnownMessageInfos)
Creates a SepaMessageInfo object for a well known message variant.
public static SepaMessageInfo Create(SepaWellKnownMessageInfos nWellKnownMessage)
Parameters
nWellKnownMessage
SepaWellKnownMessageInfosThe well known message variant for which to create a new SepaMessageInfo object.
Returns
Exceptions
- ArgumentException
The given parameter
nWellKnownMessage
had an unknown value.
Create(string, string)
Creates a SepaMessageInfo object for a particular SEPA message tag.
public static SepaMessageInfo Create(string sMessageTag, string sXmlNamespace)
Parameters
sMessageTag
stringThe XML message tag for which a SepaMessageInfo object shall be created. Currently this must be one of "CstmrCdtTrfInitn", "CstmrDrctDbtInitn", "CstmrPmtStsRpt", "BkToCstmrAcctRpt", "BkToCstmrStmt", or "BkToCstmrDbtCdtNtfctn". For any unknown message tag this method will return
null
.sXmlNamespace
stringThe XML namespace URN from the XML document.
Returns
- SepaMessageInfo
A new SepaMessageInfo object which describes a SEPA message with the given message tag or
null
.
GetAllWellKnownMessageInfos(SepaMessageType)
Get the SepaMessageInfo for all SepaWellKnownMessageInfos that are supported by this implementation.
public static SepaMessageInfo[] GetAllWellKnownMessageInfos(SepaMessageType nMessageType)
Parameters
nMessageType
SepaMessageType
Returns
Exceptions
- ArgumentException
The given
nMessageType
was Null, or an undefined enumeration value.
GetAllWellKnownMessageInfos(SepaMessageType, string)
Get the SepaMessageInfo for all SepaWellKnownMessageInfos for a particular country that are supported by this implementation.
public static SepaMessageInfo[] GetAllWellKnownMessageInfos(SepaMessageType nMessageType, string sCountryCode)
Parameters
nMessageType
SepaMessageTypesCountryCode
stringOptional country code which limits the returned message infos to only those that have been specified by that specific country. If this is
null
, then really all known message infos are returned.
Returns
- SepaMessageInfo[]
Always returns a non-null array of newly created SepaMessageInfo instances. The returned array may be empty, if a
sCountryCode
was provided for which there are no message infos known.
Exceptions
- ArgumentException
The given
nMessageType
was Null, or an undefined enumeration value.
GetAustrianWellKnownMessageInfo(string)
public static SepaWellKnownMessageInfos GetAustrianWellKnownMessageInfo(string sMessageFormat)
Parameters
sMessageFormat
string
Returns
GetCountryCode(SepaWellKnownMessageInfos)
public static string GetCountryCode(SepaWellKnownMessageInfos nWellKnownMessage)
Parameters
nWellKnownMessage
SepaWellKnownMessageInfos
Returns
- string
Returns the country code of the country that specified the particular well known message info, or
null
, if it was a generic or internationally specified message.
GetMessageTag(SepaMessageType)
Get the XML message tag that shall be used for the given message type.
public static string GetMessageTag(SepaMessageType nMessageType)
Parameters
nMessageType
SepaMessageType
Returns
Remarks
This method only returns the current message tags. It never returns the obsolete "pain.001.001.02" or "pain.008.001.01" message tags.
Exceptions
- ArgumentException
The given
nMessageType
was Null, or an undefined enumeration value.
GetNamespace(SepaWellKnownMessageInfos)
Gets the XML namespace URN for a particular well known SEPA message variant.
public static string GetNamespace(SepaWellKnownMessageInfos nWellKnownMessage)
Parameters
nWellKnownMessage
SepaWellKnownMessageInfosThe SEPA message variant for which to get the XML namespace URN.
Returns
- string
Returns the XML namespace URN, or an empty string if it is a generic message variant, or
null
if the given message variant is not known.
GetSwissWellKnownMessageInfo(string)
public static SepaWellKnownMessageInfos GetSwissWellKnownMessageInfo(string sMessageFormat)
Parameters
sMessageFormat
string
Returns
GetZkaWellKnownMessageInfo(string)
Returns the ZKA defined message for a given message format.
public static SepaWellKnownMessageInfos GetZkaWellKnownMessageInfo(string sMessageFormat)
Parameters
sMessageFormat
stringA message format string in the format "pain.000.000.00", or "camt.000.000.00".
Returns
- SepaWellKnownMessageInfos
If the message format is known, then the corresponding well known ZKA format is returned. If the message format is not known, then Null is returned.
NewMessage()
Creates a new SepaMessage object with the given SEPA message type.
public SepaMessage NewMessage()
Returns
- SepaMessage
A new SepaMessage object.
Exceptions
- NotSupportedException
There is no implementation available for this MessageType.
ToString()
public override string ToString()