Class SepaDocument
A complete SEPA XML Document.
Inheritance
Inherited Members
Namespace: Subsembly.Sepa
Assembly: Subsembly.Sepa.dll
Syntax
public class SepaDocument
Remarks
A SepaDocument combines a SepaMessageInfo message format specification with the actual SepaMessage content. Both may be set at construction time or later. In any case, both must have been set before the SEPA document can be written.
Any SEPA file can be loaded through one of the NewDocument(Stream) overloads. The SepaDocument automatically determines the SEPA message type from the loaded data and creates a matching SepaMessage derived instance for the loaded data.
Constructors
SepaDocument()
Creates a new SEPA document.
Declaration
public SepaDocument()
Remarks
Before the SepaDocument can be written, it needs a MessageInfo and a Message.
SepaDocument(SepaMessageInfo)
Creates a new SEPA document with the specified SEPA message info.
Declaration
public SepaDocument(SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
SepaMessageInfo | aMessageInfo | The message format specification or |
SepaDocument(SepaMessageInfo, SepaMessage)
Creates a new SEPA document with the specified SEPA message info and message.
Declaration
public SepaDocument(SepaMessageInfo aMessageInfo, SepaMessage aMessage)
Parameters
Type | Name | Description |
---|---|---|
SepaMessageInfo | aMessageInfo | The message format specification or |
SepaMessage | aMessage | The message content or |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The message type of the given SepaMessageInfo and SepaMessage was different. If both are given, then their message type must be the same. |
Properties
EbicsOrderType
The EBICS order type identification used to transfer this SEPA document.
Declaration
public string EbicsOrderType { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If the required EBICS order type could not be derived from the
Message, or if no message is present, then this property is
null
. Otherwise it is one of the EBICS order type codes according to
the EBICS specification. For example "CCT" for SEPA credit transfers and
"CDD" for SEPA CORE direct debit messages.
The returned order types are the order types for the plain non-container EBICS order variants.
HbciSegmentType
The HBCI segment type used to transfer this SEPA document.
Declaration
public string HbciSegmentType { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If the required HBCI segment type could not be derived from the
Message, or if no message is present, then this property is
null
. Otherwise it is one of the HBCI segment types according to
the HBCI specification. For example "HKCCS" for single SEPA credit transfers and
"HKDSE" for SEPA CORE direct debit messages.
For a bank to customer account report the HBCI segment type "HKCAZ" is returned.
Bank to customer statements and bank to customer debit credit notifications are
not supported in HBCI and thus null
is returned in these cases.
Message
The SEPA message object or null
.
Declaration
public SepaMessage Message { get; set; }
Property Value
Type | Description |
---|---|
SepaMessage |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a SepaMessage with a different SepaMessageType than the currently specified MessageInfo. |
MessageInfo
The SEPA message info object or null
.
Declaration
public SepaMessageInfo MessageInfo { get; set; }
Property Value
Type | Description |
---|---|
SepaMessageInfo |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a SepaMessageInfo with a different SepaMessageType than the currently contained Message. |
MessageType
The message type of this SEPA document.
Declaration
public SepaMessageType MessageType { get; }
Property Value
Type | Description |
---|---|
SepaMessageType |
Remarks
If neither MessageInfo nor Message have been set, then this value is Null.
ServiceLevel
Provides the ServiceLevelCode for this SEPA payment document.
Declaration
public string ServiceLevel { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If this is neither a CreditTransferPaymentInitiation,
nor a DirectDebitPaymentInitiation, then null
is returned.
Looks at all ServiceLevelCode values in all
SepaPaymentInformations and all
SepaTransactionInformations. If all non-null
ServiceLevelCode values contain the same unique
value, then it will be returned. If a differing non-null
value is found,
then null
is returned. If none of the
ServiceLevelCode values have been set, then the
transactions are checked, whether they all meet the requirements for SEPA payment.
If so, then SEPA is returned.
XmlEncoding
The encoding generated by the WriteDocument methods.
Declaration
public Encoding XmlEncoding { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
Remarks
If XmlEncoding is a null
reference, then WriteDocument writes
out the stream as UTF-8 and omits the encoding attribute from the
ProcessingInstruction.
Methods
NewDocument(Stream)
Creates a new SepaDocument from a stream.
Declaration
public static SepaDocument NewDocument(Stream aStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | aStream |
Returns
Type | Description |
---|---|
SepaDocument |
NewDocument(TextReader)
Creates a new SepaDocument from a TextReader.
Declaration
public static SepaDocument NewDocument(TextReader aTextReader)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | aTextReader |
Returns
Type | Description |
---|---|
SepaDocument |
NewDocument(String)
Creates a new SepaDocument from the content of a (XML-)file.
Declaration
public static SepaDocument NewDocument(string sFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName | Complete path to the file. Must not be |
Returns
Type | Description |
---|---|
SepaDocument |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
System.ArgumentException | The parameter |
NewDocumentXml(XmlReader)
Creates a new SepaDocument from the given XML data.
Declaration
public static SepaDocument NewDocumentXml(XmlReader aXmlReader)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader |
Returns
Type | Description |
---|---|
SepaDocument | If the XML reader is already at the end of the input, then |
Remarks
Based on the actual XML data, this will create a SepaDocument with a derived concrete SepaMessage instance that matches the XML namespace or the XML message tag, that was found in the data.
WriteDocument(Stream)
Write the entire SEPA document to the given Stream.
Declaration
public void WriteDocument(Stream aStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | aStream |
Remarks
Many of a message's properties will be checked during the write operation. Exceptions of different types can be thrown during the write process.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Either MessageInfo or Message has not been set and is
|
WriteDocument(TextWriter)
Write the entire SEPA document to the given TextWriter.
Declaration
public void WriteDocument(TextWriter aWriter)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | aWriter |
Remarks
Many of a message's properties will be checked during the write operation. Exceptions of different types can be thrown during the write process.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Either MessageInfo or Message has not been set and is
|
WriteDocument(String)
Write the entire SEPA document to the given file.
Declaration
public void WriteDocument(string sFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName |
Remarks
Many of a message's properties will be checked during the write operation. Exceptions of different types can be thrown during the write process. If WriteDocument fails, it is possible and likely, that a corrupt file remains.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter sFileName was |
System.ArgumentException | The parameter sFileName was an empty string. |
System.InvalidOperationException | Either MessageInfo or Message has not been set and is
|
WriteDocumentData()
Declaration
public byte[] WriteDocumentData()
Returns
Type | Description |
---|---|
System.Byte[] | The complete SEPA document serialised into a byte array using the given XmlEncoding. |
WriteDocumentString()
Declaration
public string WriteDocumentString()
Returns
Type | Description |
---|---|
System.String |
WriteDocumentXml(XmlWriter)
Declaration
public void WriteDocumentXml(XmlWriter aXmlWriter)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter |
Remarks
Many of a message's properties will be checked during the write operation. Exceptions of different types can be thrown during the write process.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Either MessageInfo or Message has not been set and is
|
WriteXml(XmlWriter)
Declaration
public void WriteXml(XmlWriter aXmlWriter)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter |
Remarks
Many of a message's properties will be checked during the write operation. Exceptions of different types can be thrown during the write process.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Either MessageInfo or Message has not been set and is
|