• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Class Swift9xxBase

    Generic base class for SWIFT MT-940 and SWIFT MT-942 Cash Management messages.

    Inheritance
    System.Object
    Swift9xxBase
    SwiftInterimTransRept
    SwiftStatement
    Implements
    System.Collections.IEnumerable
    System.IComparable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Subsembly.Swift
    Assembly: Subsembly.Sepa.dll
    Syntax
    public class Swift9xxBase : IEnumerable, IComparable
    Remarks

    This base class implements the common properties and utility methods that are applicable to most SWIFT MT-9xx Cash Management messages. It can be used to read most information from a MT-940 or MT-942 message without knowing the message type. After successfully reading a message with ReadMessage(SwiftStatementReader), the property MT is set to indicate the message type that was actually read.

    The following derived classes are included in the Subsembly.Swift namespace: SwiftStatement for MT-940 messages and SwiftInterimTransRept for MT-942 messages. Specialisations for MT-920, MT-941, and MT-950 may be added in future versions.

    Properties

    Account

    Declaration
    public SwiftAcct Account { get; }
    Property Value
    Type Description
    SwiftAcct

    AccountBankCode

    The account bank code extracted from the AccountIdentification.

    Declaration
    public string AccountBankCode { get; }
    Property Value
    Type Description
    System.String

    AccountBIC

    The account BIC extracted from the AccountIdentification.

    Declaration
    public string AccountBIC { get; }
    Property Value
    Type Description
    System.String

    AccountCurrency

    The account currency code extracted from the AccountIdentification.

    Declaration
    public string AccountCurrency { get; }
    Property Value
    Type Description
    System.String

    AccountIBAN

    The account IBAN extracted from the AccountIdentification.

    Declaration
    public string AccountIBAN { get; }
    Property Value
    Type Description
    System.String

    AccountIdentification

    Account identification for this message.

    Declaration
    public string AccountIdentification { get; set; }
    Property Value
    Type Description
    System.String

    The AccountIdentification property corresponds with field 25 of a SWIFT MT-9xx message. This field must not be longer than 35 characters.

    Remarks

    SWIFT does not define any specific structure or content of this field. However there are several national and proprietary guidelines on how to use this field.

    See Also
    Account

    AccountNumber

    The account number extracted from the AccountIdentification.

    Declaration
    public string AccountNumber { get; }
    Property Value
    Type Description
    System.String

    Count

    Provides the number of StatementLines.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    System.Int32

    CreationDate

    Declaration
    protected virtual DateTime CreationDate { get; }
    Property Value
    Type Description
    System.DateTime

    MT

    The actual MT message type that was read by ReadMessage(SwiftStatementReader).

    Declaration
    public int MT { get; }
    Property Value
    Type Description
    System.Int32

    This is initially zero and is updated to 940 or 942 depending on the message type that was read by ReadMessage(SwiftStatementReader).

    RelatedReference

    The transaction reference that this message relates to.

    Declaration
    public string RelatedReference { get; set; }
    Property Value
    Type Description
    System.String

    The related reference corresponds with field 21 of a SWIFT MT-9xx message. This field must not start or end with a slash ’/’ and must not contain two consecutive slashes ’//’. It must not be longer than 16 characters.

    Remarks

    If a MT-9xx message was solicited through another SWIFT message such as MT-920, then the related reference field of the response SWIFT message should contain the transaction reference of the requesting message. If a MT-9xx message was requested through other means or is an unsolicited message, then the related reference is not used and should be omitted.

    SequenceNumber

    The sequence number of the message in a multi-message statement.

    Declaration
    public int SequenceNumber { get; set; }
    Property Value
    Type Description
    System.Int32

    The SequenceNumber property corresponds with the second subfield of field 28 or 28C of a SWIFT MT-9xx message. This subfield contains up to five digits (two digits for field 28) that represent the sequence number. If a sequence number is not applicable, then the value zero is used instead.

    Remarks

    The Sequence Number subfield is optional. Therefore it will only appear in generated messages, if it is non-zero.

    StatementLines

    Collection of SwiftStatementLine instances that contain the statement lines this message.

    Declaration
    public IList StatementLines { get; }
    Property Value
    Type Description
    System.Collections.IList

    The collection is initially all empty. It is populated by reading a MT-9xx message or by manually adding statement lines to this message. The collection is always maintained sorted by the EntryDate of the statement lines.

    The caller may only read the returned collection any must not change it or change any of the SwiftStatementLine instances that it contains. Any changes to the statement must be done through properties and/or methods of this or the derived instances.

    StatementNumber

    Statement number of this message.

    Declaration
    public int StatementNumber { get; set; }
    Property Value
    Type Description
    System.Int32

    The StatementNumber property corresponds with the first subfield of field 28 or 28C of a SWIFT MT-9xx message. This subfield contains up to five digits that represent the statement number. If a statement number is not applicable, then the value zero is used instead.

    TransactionReference

    Transaction reference assigned by the sender to unambiguously identify the message.

    Declaration
    public string TransactionReference { get; set; }
    Property Value
    Type Description
    System.String

    The transaction reference corresponds with field 20 of a SWIFT MT-9xx message. This field must not start or end with a slash ’/’ and must not contain two consecutive slashes ’//’. It must not be longer than 16 characters.

    Methods

    AddStatementLine(SwiftStatementLine)

    Declaration
    public virtual void AddStatementLine(SwiftStatementLine aStatementLine)
    Parameters
    Type Name Description
    SwiftStatementLine aStatementLine

    CompareTo(Object)

    Declaration
    public int CompareTo(object aObject)
    Parameters
    Type Name Description
    System.Object aObject
    Returns
    Type Description
    System.Int32

    GetEnumerator()

    Declaration
    public IEnumerator GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    GetStatementLine(Int32)

    Direct access to individual statement lines.

    Declaration
    public SwiftStatementLine GetStatementLine(int i)
    Parameters
    Type Name Description
    System.Int32 i

    The index position of the statement line to retrieve.

    Returns
    Type Description
    SwiftStatementLine

    The statement line at the requested position.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    The given index position was outside of the range of the available statement lines.

    Insert(SwiftStatementLine)

    Insert a new statement line into this statement lines collection.

    Declaration
    public int Insert(SwiftStatementLine aStatementLine)
    Parameters
    Type Name Description
    SwiftStatementLine aStatementLine

    The new statement line that shall be inserted. The statement line It will be inserted according to it's entry date in order to ensure that the collection is always maintained in a sorted order. If there are already entries with the same entry date in this collection, then the new statement line will always be added behind as the very last entry with that entry date. If the given statement line does not have an entry date, then it is added to the very end of the collection.

    Returns
    Type Description
    System.Int32

    Returns the index position at which the new statement line was inserted.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter aStatementLine was null.

    ParseField(SwiftStatementReaderState, SwiftField)

    Callback that is invoked by ReadMessage(SwiftStatementReader) for any fields that are unknown to this Swift9xxBase class.

    Declaration
    protected virtual void ParseField(SwiftStatementReaderState nState, SwiftField aField)
    Parameters
    Type Name Description
    SwiftStatementReaderState nState

    The state that the SwiftStatementReader is in, after the provided field has been read.

    SwiftField aField

    The SwiftField that is unknown to this Swift9xxBase class which shall be processed by the derived class.

    ReadAllMessages(SwiftStatementReader, Int32)

    Reads all SWIFT MT-9xx messages from the given SwiftStatementReader, creating a new Swift9xxBase instance for every message read.

    Declaration
    public static Swift9xxBase[] ReadAllMessages(SwiftStatementReader aStatementReader, int nMT)
    Parameters
    Type Name Description
    SwiftStatementReader aStatementReader
    System.Int32 nMT

    The expected Message Type of all SWIFT messages contained in the source. This must be either 940, or 942, or 999. If this is 940 or 999, then instances of SwiftStatement will be created for reading the messages. If this is 942, then SwiftInterimTransRept instances will be created for reading the messages.

    Returns
    Type Description
    Swift9xxBase[]

    An array of Swift9xxBase derived instances that contain all the MT-940 or MT-942 messages that have been read. If the given SwiftStatementReader was already at the end of the data when this method was called, then an empty array is returned.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter aStatementReader was null.

    System.ArgumentException

    An unknown message type was set in nMT.

    ReadAllMessages(Stream, Int32)

    Reads all SWIFT MT-9xx messages from the given stream, creating a new Swift9xxBase instance for every message read.

    Declaration
    public static Swift9xxBase[] ReadAllMessages(Stream aStream, int nMT)
    Parameters
    Type Name Description
    System.IO.Stream aStream

    An input stream from which the statement data shall be read. This stream will not be closed by this method.

    System.Int32 nMT

    The expected Message Type of all SWIFT messages contained in the source. This must be either 940, or 942, or 999. If this is 940 or 999, then instances of SwiftStatement will be created for reading the messages. If this is 942, then SwiftInterimTransRept instances will be created for reading the messages.

    Returns
    Type Description
    Swift9xxBase[]

    An array of Swift9xxBase derived instances that contain all the MT-940 or MT-942 messages that have been read. If the given aStream was already at the end of the data when this method was called, then an empty array is returned.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter aStream was null.

    System.ArgumentException

    An unknown message type was set in nMT.

    ReadAllMessages(TextReader, Int32)

    Reads all SWIFT MT-9xx messages from the given stream, creating a new Swift9xxBase instance for every message read.

    Declaration
    public static Swift9xxBase[] ReadAllMessages(TextReader aTextReader, int nMT)
    Parameters
    Type Name Description
    System.IO.TextReader aTextReader
    System.Int32 nMT

    The expected Message Type of all SWIFT messages contained in the source. This must be either 940, or 942, or 999. If this is 940 or 999, then instances of SwiftStatement will be created for reading the messages. If this is 942, then SwiftInterimTransRept instances will be created for reading the messages.

    Returns
    Type Description
    Swift9xxBase[]

    An array of Swift9xxBase derived instances that contain all the MT-940 or MT-942 messages that have been read. If the given aTextReader was already at the end of the data when this method was called, then an empty array is returned.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter aTextReader was null.

    System.ArgumentException

    An unknown message type was set in nMT.

    ReadAllMessages(String, Int32)

    Reads all SWIFT MT-9xx messages from the given file, creating new Swift9xxBase derived instances for every message read.

    Declaration
    public static Swift9xxBase[] ReadAllMessages(string sFilename, int nMT)
    Parameters
    Type Name Description
    System.String sFilename
    System.Int32 nMT

    The expected Message Type of all SWIFT messages contained in the source. This must be either 940, or 942, or 999. If this is 940 or 999, then instances of SwiftStatement will be created for reading the messages. If this is 942, then SwiftInterimTransRept instances will be created for reading the messages.

    Returns
    Type Description
    Swift9xxBase[]

    An array of Swift9xxBase derived instances that contain all the MT-940 or MT-942 messages that have been read.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sFilename was null.

    System.ArgumentException

    An unknown message type was set in nMT.

    ReadMessage(SwiftStatementReader)

    Reads a single MT-9xx message terminated by EndOfText or EndOfStream.

    Declaration
    public bool ReadMessage(SwiftStatementReader aStatementReader)
    Parameters
    Type Name Description
    SwiftStatementReader aStatementReader

    A SwiftStatementReader instance that provides the SWIFT MT-9xx message to be read.

    Returns
    Type Description
    System.Boolean

    If a message was read, then true is returned. If the provided input was completely empty, then false is returned.

    Remarks

    This method will read and parse all fields that are known by this Swift9xxBase class and update the properties according to the field data that was read. Also, all statement lines that appear in the input are automatically added to the StatementLines collection of this class. All remaining, unknown fields are forwarded to the abstract method ParseField(SwiftStatementReaderState, SwiftField) for reading.

    WriteProlog(SwiftWriter)

    Writes the common MT-9xx prolog fields.

    Declaration
    protected void WriteProlog(SwiftWriter aSwiftWriter)
    Parameters
    Type Name Description
    SwiftWriter aSwiftWriter

    Destination to write the SWIFT MT-9xx prolog fields to.

    Remarks

    the common prolog consists of the fields 20, 21, 25, and 28C.

    WriteStatementLines(SwiftWriter)

    Writes all contained Statement Lines as a sequence of SWIFT fields 61 and 86.

    Declaration
    protected void WriteStatementLines(SwiftWriter aSwiftWriter)
    Parameters
    Type Name Description
    SwiftWriter aSwiftWriter

    Destination to write the SWIFT Statement Lines to.

    Implements

    System.Collections.IEnumerable
    System.IComparable
    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH