Class SepaDocument

Namespace
Subsembly.Sepa
Assembly
Subsembly.Sepa.dll

A complete SEPA XML Document.

public class SepaDocument
Inheritance
SepaDocument
Inherited Members

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.

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.

public SepaDocument(SepaMessageInfo aMessageInfo)

Parameters

aMessageInfo SepaMessageInfo

The message format specification or null.

SepaDocument(SepaMessageInfo, SepaMessage)

Creates a new SEPA document with the specified SEPA message info and message.

public SepaDocument(SepaMessageInfo aMessageInfo, SepaMessage aMessage)

Parameters

aMessageInfo SepaMessageInfo

The message format specification or null.

aMessage SepaMessage

The message content or null.

Exceptions

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.

public string EbicsOrderType { get; }

Property Value

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.

public string HbciSegmentType { get; }

Property Value

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.

public SepaMessage Message { get; set; }

Property Value

SepaMessage

Exceptions

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.

public SepaMessageInfo MessageInfo { get; set; }

Property Value

SepaMessageInfo

Exceptions

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.

public SepaMessageType MessageType { get; }

Property Value

SepaMessageType

Remarks

If neither MessageInfo nor Message have been set, then this value is Null.

ServiceLevel

Provides the ServiceLevelCode for this SEPA payment document.

public string ServiceLevel { get; }

Property Value

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.

public Encoding XmlEncoding { get; set; }

Property Value

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(byte[])

Creates a new SepaDocument from binary XML data.

public static SepaDocument NewDocument(byte[] vbRawData)

Parameters

vbRawData byte[]

Returns

SepaDocument

NewDocument(Stream)

Creates a new SepaDocument from a stream.

public static SepaDocument NewDocument(Stream aStream)

Parameters

aStream Stream

Returns

SepaDocument

NewDocument(TextReader)

Creates a new SepaDocument from a TextReader.

public static SepaDocument NewDocument(TextReader aTextReader)

Parameters

aTextReader TextReader

Returns

SepaDocument

NewDocument(string)

Creates a new SepaDocument from the content of a (XML-)file.

public static SepaDocument NewDocument(string sFileName)

Parameters

sFileName string

Complete path to the file. Must not be null or empty.

Returns

SepaDocument

Exceptions

ArgumentNullException

The parameter sFileName was null.

ArgumentException

The parameter sFileName was an empty string.

NewDocumentXml(XmlReader)

Creates a new SepaDocument from the given XML data.

public static SepaDocument NewDocumentXml(XmlReader aXmlReader)

Parameters

aXmlReader XmlReader

Returns

SepaDocument

If the XML reader is already at the end of the input, then null is returned. Otherwise the SEPA document from the input is returned.

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.

public void WriteDocument(Stream aStream)

Parameters

aStream Stream

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

InvalidOperationException

Either MessageInfo or Message has not been set and is null.

WriteDocument(TextWriter)

Write the entire SEPA document to the given TextWriter.

public void WriteDocument(TextWriter aWriter)

Parameters

aWriter TextWriter

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

InvalidOperationException

Either MessageInfo or Message has not been set and is null.

WriteDocument(string)

Write the entire SEPA document to the given file.

public void WriteDocument(string sFileName)

Parameters

sFileName string

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

ArgumentNullException

The parameter sFileName was null.

ArgumentException

The parameter sFileName was an empty string.

InvalidOperationException

Either MessageInfo or Message has not been set and is null.

WriteDocumentData()

public byte[] WriteDocumentData()

Returns

byte[]

The complete SEPA document serialised into a byte array using the given XmlEncoding.

WriteDocumentString()

public string WriteDocumentString()

Returns

string

WriteDocumentXml(XmlWriter)

public void WriteDocumentXml(XmlWriter aXmlWriter)

Parameters

aXmlWriter XmlWriter

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

InvalidOperationException

Either MessageInfo or Message has not been set and is null.

WriteXml(XmlWriter)

public void WriteXml(XmlWriter aXmlWriter)

Parameters

aXmlWriter XmlWriter

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

InvalidOperationException

Either MessageInfo or Message has not been set and is null.