Class SwiftStatementLine
A SwiftStatementLine collects all the information from the SWIFT fields 61 and 86, which together make up a statement line.
Inheritance
Inherited Members
Namespace: Subsembly.Swift
Assembly: Subsembly.Sepa.dll
Syntax
public class SwiftStatementLine
Remarks
Statement lines appear in the SWIFT message types MT-940 (Customer Statement Message) and MT-942 (Interim Transaction Report) and many others.
Strictly speaking, a SWIFT Statement Line consists solely of the SWIFT field 61. In some message types the field 61 can be optionally accompanied by an immediately following field 86 (Information to Account Owner).
According to SWIFT, field 86 contains just plain text information. The german ZKA, however, defines a very special structured layout for this field. Using this structured layout, field 86 carries many more attributes about the statement line. This class supports that structured layout and can extract all information from it. If field 86 is not structured according to the ZKA, then the entire field 86 is simply taken as informational text.
Constructors
SwiftStatementLine()
Creates an all empty statement line.
Declaration
public SwiftStatementLine()
Remarks
Use this constructor to create your own hand crafted statement line.
SwiftStatementLine(SwiftField)
Creates a statement line by initialising its properties from the given SWIFT field 61.
Declaration
public SwiftStatementLine(SwiftField aField61)
Parameters
Type | Name | Description |
---|---|---|
SwiftField | aField61 | The SWIFT field 61 that provides the data for this SwiftStatementLine instance. |
Remarks
If no entry date is provided in the given SWIFT field 61, then the EntryDate property will be initialised with a logical null value.
The currency of the transaction amount will be "XXX" unless a Funds Code subfield is present in the given field 61. If so, then currency will be "XX" followed by the extracted funds code letter.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Parameter aField61 was |
System.ArgumentOutOfRangeException | The given SWIFT field was not a non-generic field with tag 61 or its content was
|
SwiftException | The content of the SWIFT field is malformed. The SwiftExceptionCode will be MalformedFieldContent. |
Fields
MaxBankRefLength
Max length of the BankRef property value.
Declaration
public const int MaxBankRefLength = 16
Field Value
Type | Description |
---|---|
System.Int32 |
MaxCreditorIdLength
Max length of the SEPA field CreditorId property value.
Declaration
public const int MaxCreditorIdLength = 35
Field Value
Type | Description |
---|---|
System.Int32 |
MaxEndToEndIdLength
Max length of the SEPA field EndToEndId property value.
Declaration
public const int MaxEndToEndIdLength = 35
Field Value
Type | Description |
---|---|
System.Int32 |
MaxEntryTextLength
Max length of the EntryText property value.
Declaration
public const int MaxEntryTextLength = 27
Field Value
Type | Description |
---|---|
System.Int32 |
MaxMandateIdLength
Max length of the SEPA field MandateId property value.
Declaration
public const int MaxMandateIdLength = 35
Field Value
Type | Description |
---|---|
System.Int32 |
MaxOwnerRefLength
Max length of the OwnerRef property value.
Declaration
public const int MaxOwnerRefLength = 35
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPayeePayerAcctNoLength
Max length of the PayeePayerAcctNo property value.
Declaration
public const int MaxPayeePayerAcctNoLength = 34
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPayeePayerBankCodeLength
Max length of the PayeePayerBankCode property value.
Declaration
public const int MaxPayeePayerBankCodeLength = 12
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPayeePayerNameLength
Max length of the PayeePayerName1 and PayeePayerName2 property values.
Declaration
public const int MaxPayeePayerNameLength = 27
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPaymtPurposeLineLength
Max length of a single string of the string array stored in the PaymtPurpose property.
Declaration
public const int MaxPaymtPurposeLineLength = 65
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPaymtPurposeLines
Max number of strings in the string array stored in the PaymtPurpose property.
Declaration
public const int MaxPaymtPurposeLines = 14
Field Value
Type | Description |
---|---|
System.Int32 |
MaxPrimaNotaNoLength
Max length of the PrimaNotaNo property value.
Declaration
public const int MaxPrimaNotaNoLength = 10
Field Value
Type | Description |
---|---|
System.Int32 |
MaxSupplementaryDetailsLength
Max length of the SupplementaryDetails property value.
Declaration
public const int MaxSupplementaryDetailsLength = 34
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
Amount
The monetary amount and the currency of this transaction.
Declaration
public SwiftAmt Amount { get; }
Property Value
Type | Description |
---|---|
SwiftAmt | The amount value corresponds with subfield 5 (Amount) of SWIFT field :61: (Statement Line). The Amount is a required subfield and therefore is never null after parsing. If subfield 4 (Funds Code) of SWIFT field :61: (Statement Line) is present, then the currency will be "XX" followed by the extracted funds code letter. Otherwise the currency will be "XXX". |
BankRef
The optional Account Servicing Institution’s Reference (Bankreferenz) of this transaction.
Declaration
public string BankRef { get; set; }
Property Value
Type | Description |
---|---|
System.String | The BankRef property corresponds with subfield 8 (Account Servicing Institution’s Reference) of SWIFT field :61: (Statement Line). The value stored in this property excludes the two leading slashes (//) that separate this subfield from the preceeding subfield. The value is optional and almost always will be |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not match the requirements for this field. |
ChargesAmount
The total sum of all charges of this statement line.
Declaration
public decimal ChargesAmount { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal |
See Also
ChargesAmountCurrency
The currency code of all charges of this statement line.
Declaration
public string ChargesAmountCurrency { get; set; }
Property Value
Type | Description |
---|---|
System.String |
See Also
CreditorId
The optional SEPA Creditor-Identification.
Declaration
public string CreditorId { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules and the transaction is a SEPA transaction, then the CRED or DEBT
corresponds to the CreditorId property, depending on whether this is a debit or
not. Otherwise the CreditorId will be The ZKA SEPA specification permits any text with up to 35 characters. Thus, this is also what is enforced by this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 35 characters. |
Currency
The currency code of this transaction.
Declaration
public string Currency { get; set; }
Property Value
Type | Description |
---|---|
System.String | The currency code is actually not stored in a SWIFT Statement Line, only the
Funds Code is. Therefore, if subfield 4 (Funds Code) of SWIFT field :61: (Statement
Line) is present, then the currency will be "XX" followed by the extracted funds
code letter. Otherwise the currency will be |
DebitCreditMark
The Debit/Credit Mark (Soll/Haben-Kennung) of this transaction.
Declaration
public string DebitCreditMark { get; set; }
Property Value
Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
System.String | The DebitCreditMark property corresponds with subfield 3 (Debit/Credit Mark) of SWIFT field :61: (Statement Line). The Debit/Credit Mark is a required subfield and therefore is never null after parsing. SWIFT defines the following possible values for the Debit/Credit Mark subfield (case is significant):
Any of these six values are accepted, regardless of the actual SWIFT message that contains this statement line. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | An attempt was made to set a string value that was none of the six defined acceptable values for this field. |
DecValue
The actual decimal value of this transaction with sign.
Declaration
public decimal DecValue { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal | If this is a debit transaction, then this property has a negative decimal value. Otherwise it has a positive decimal value. When setting this property, the DebitCreditMark is set to "C" for positive values including zero and "D" for negative values. |
EndToEndId
The optional SEPA End-to-End-Identification.
Declaration
public string EndToEndId { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules and the transaction is a SEPA transaction, then the EREF corresponds to
the EndToEndId property. Otherwise the EndToEndId will be The ZKA SEPA specification permits any text with up to 35 characters. Thus, this is also what is enforced by this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 35 characters. |
EntryDate
The Entry Date (Buchungsdatum) of this transaction.
Declaration
public SwiftDate EntryDate { get; set; }
Property Value
Type | Description |
---|---|
SwiftDate | The EntryDate property corresponds with subfield 2 (Entry Date) of SWIFT field :61: (Statement Line). The year component of the date (which does not exist in the SWIFT subfield) is derived from the value date. The year of the entry date is chosen such that the resulting entry date is as close as possible to the value date. For example: If the Value Date subfield is 031231 and the Entry Date subfield is 0101, then the year 2004 and not 2003 is used for the entry date, because 2004-01-01 is closer to 2003-12-31 than 2003-01-01. If no Entry Date subfield is present in SWIFT field :61:, then it is assumed to be equal to the ValueDate. Hence, if no Entry Date subfield is present, this property returns the ValueDate instead. The EntryDate may contain any virtual date that can be represented by the SwiftDate type! |
EntryText
The optional entry text (Buchungstext) of this transaction.
Declaration
public string EntryText { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 00 corresponds to the EntryText property.
Otherwise the EntryText will be The ZKA subfield permits any text with up to 27 characters. Thus, this is also what is enforced by this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 27 characters. |
FundsCode
The funds code (3rd letter of currency code) of this transaction.
Declaration
public char FundsCode { get; set; }
Property Value
Type | Description |
---|---|
System.Char | The funds code corresponds with subfield 4 (Funds Code) of SWIFT field :61: (Statement Line). The funds code is optional and will be a nul character if not present. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | An attempt was made to set a non alpha and non-nul character. |
HasEntryDate
Indicates whether this EntryDate was explicitly provided, or whether it is just the ValueDate default value.
Declaration
public bool HasEntryDate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDebit
Indicates whether this is a debit entry.
Declaration
public bool IsDebit { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Is |
IsReversal
Indicates whether this is a reversal entry.
Declaration
public bool IsReversal { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Is |
MandateId
The optional SEPA Mandate-Identification.
Declaration
public string MandateId { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules and the transaction is a SEPA transaction, then the MREF corresponds to
the MandateId property. Otherwise the MandateId will be The ZKA SEPA specification permits any text with up to 35 characters. Thus, this is also what is enforced by this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 35 characters. |
OriginalAmount
The originally instructed amount of this statement line.
Declaration
public decimal OriginalAmount { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal |
See Also
OriginalAmountCurrency
The currency code of the originally instructed amount of this statement line.
Declaration
public string OriginalAmountCurrency { get; set; }
Property Value
Type | Description |
---|---|
System.String |
See Also
OwnerRef
The Reference for the Account Owner (Kundenreferenz) of this transaction.
Declaration
public string OwnerRef { get; set; }
Property Value
Type | Description |
---|---|
System.String | The OwnerRef property corresponds with subfield 7 (Reference for the Account Owner) of SWIFT field :61: (Statement Line). The Reference for the Account Owner is a required subfield and therefore is never null after parsing. It may consist of up to 16 characters from the All character set. The value NONREF may (and almost always will) appear in order to indicate that no owner reference is available. SEPA: If the SWIFT subfield contains KREF+ then the actual value is taken from the SEPA structured SWIFT field :86: KREF+ entry. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not match the requirements for this field. |
PayeePayerAcctNo
The account number of the other payee or payer (not the account owner).
Declaration
public string PayeePayerAcctNo { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 31 corresponds to the PayeePayerAcctNo property.
Otherwise the PayeePayerAcctNo will be The ZKA subfield permits alphanumeric account numbers with a length of up to 34 digits. Thus, this is also what is enforced by this property. SEPA: With SEPA payments this field will hold the IBAN of the payee or payer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 34 characters or did contain special characters. |
PayeePayerBankCode
The bank code number of the other payee or payer account (not the owner account).
Declaration
public string PayeePayerBankCode { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 30 corresponds to the PayeePayerBankCode property.
Otherwise the PayeePayerBankCode will be The ZKA subfield permits alphanumeric bank codes with a length of up to 12 digits. Thus, this is also what is enforced by this property. SEPA: With SEPA payments this field will hold the BIC of the payee or payer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 12 characters or did contain special characters. |
PayeePayerName
The combined, complete payee payer name.
Declaration
public string PayeePayerName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If SWIFT field :86: (Information to Account Owner) is structured according to ZKA rules, then this property is the concatenation of the ZKA subfields 32 and 33.
PayeePayerName1
The name of the other payee or payer (not the account owner).
Declaration
public string PayeePayerName1 { get; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 32 corresponds to the PayeePayerName1 property.
Otherwise the PayeePayerName1 will be |
PayeePayerName2
Optional second line of payee/payer name.
Declaration
public string PayeePayerName2 { get; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 33 corresponds to the PayeePayerName2 property.
Otherwise the PayeePayerName2 will be |
PaymtPurpose
The raw payment purpose extracted from field 86.
Declaration
public string[] PaymtPurpose { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | When parsing field 86 specially tagged SEPA fields are removed from the data. The PaymtPurpose property instead contains all payment purpose lines without any SEPA tag processing, i.e. all SEPA tags and values are still contained. |
PrimaNotaNo
The optional prima nota number (Primanota-Nummer) of this transaction.
Declaration
public string PrimaNotaNo { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 10 corresponds to the PrimaNotaNo property.
Otherwise the PrimaNotaNo will be The ZKA subfield permits any text with up to 10 characters. Thus, this is also what is enforced by this property. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was longer than 10 characters or did contain invalid characters. |
PurposeCode
SEPA purpose code from SEPA tag PURP.
Declaration
public string PurposeCode { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SepaPaymtPurpose
Provides the processed SEPA payment purpose.
Declaration
public string SepaPaymtPurpose { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Any SEPA fields that are not returned through any other property of this class are appended at the end of this string, separated by a Environment.NewLine sequence. The actual SEPA purpose is always in the first line of the returned string, even if it is empty.
SupplementaryDetails
The optional Supplementary Details (Weitere Informationen) of this transaction.
Declaration
public string SupplementaryDetails { get; set; }
Property Value
Type | Description |
---|---|
System.String | The SupplementaryDetails property corresponds with subfield 9 (Supplementary Details) of SWIFT field :61: (Statement Line). The value stored in this property excludes the leading CRLF sequence that separate this subfield from the preceeding subfield. The value is optional and almost always will be |
Remarks
The SupplementaryDetails may contain the special text sequences
/OCMT/3a..15d/
and/or /CHGS/3a..15d/
. When parsing the SWIFT field
:61:, then the values from these text sequences are copied into the properties
OriginalAmount, OriginalAmountCurrency,
ChargesAmount, and ChargesAmountCurrency. However,
the value of this SupplementaryDetails property will still contain
these sequences.
When generating the SWIFT field :61:, and this property is non-empty, then only the
content of this property will be written. The property values for the
OriginalAmount and the ChargesAmount are ignored. Only
if this property is null
or an empty string, then a supplementary details
sub-field will be generated from the value of the properties
OriginalAmount, OriginalAmountCurrency,
ChargesAmount, and ChargesAmountCurrency.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not match the requirements for this field. |
TextKeyExt
Three digit text key extension of this transaction.
Declaration
public string TextKeyExt { get; set; }
Property Value
Type | Description |
---|---|
System.String | If SWIFT field :86: (Information to Account Owner) is structured according to
ZKA rules, then the ZKA subfield 34 corresponds to the TextKeyExt. Otherwise the
TextKeyExt will be The text key extension is defined by the DTAUS specification. It consists of three digits. The text key extension is optional and may be null. Logically a null value is equivalent to three zeroes (000). The text key extension cannot be set to anything but null or a string with exactly three digits. SEPA: With SEPA payments this field will hold a SEPA-Code. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not consist of exactly three digits. |
TranTypeIdCode
The Transaction Type Identification Code (Buchungsschlüssel) of this transaction.
Declaration
public string TranTypeIdCode { get; set; }
Property Value
Type | Description | ||||||
---|---|---|---|---|---|---|---|
System.String | The TranTypeIdCode property corresponds with subfield 6 (Transaction Type Identification Code) of SWIFT field :61: (Statement Line). The stored property value contains the complete four character code from this subfield, including the obligatory leading 'N' character. The Transaction Type Identification Code is a required subfield and therefore is never null after parsing. Similar information, but derived from other SWIFT fields, is available through the ZkaTranCode, and EntryText properties. The following table shows some of the more common transaction type ID codes, that have be seen to be actually used. For a complete list of codes, please refer to the SWIFT specification.
Many other undefined codes have been seen in actual MT-940 samples. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not match the requirements for this field. |
UltimateOriginatorName
The ultimate originator of this transaction (ABWA+)
Declaration
public string UltimateOriginatorName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This may be the UltimateCreditor or the UltimateDebtor from the PaymentInformation of the original SEPA payment.
UltimatePayeePayerName
The ultimate payee or payer of this transaction (ABWE+)
Declaration
public string UltimatePayeePayerName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This may be the UltimateCreditor or the UltimateDebtor from TransactionInformation of the original SEPA payment.
Value
The absolute decimal value of this transaction without sign.
Declaration
public decimal Value { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal | Strictly positive or zero value of this transaction. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | An attempt was made to set a negative value. |
ValueDate
The Value Date (Wertstellungstag) of this transaction.
Declaration
public SwiftDate ValueDate { get; set; }
Property Value
Type | Description |
---|---|
SwiftDate | The ValueDate property corresponds with subfield 1 (Value Date) of SWIFT field :61: (Statement Line). The Value Date is a required subfield and therefore is never null after parsing. The ValueDate may contain any virtual date that can be represented by the SwiftDate type! |
ZkaTranCode
The ZKA defined numeric transaction code (Geschäftsvorfall-Code) of this transaction.
Declaration
public string ZkaTranCode { get; set; }
Property Value
Type | Description |
---|---|
System.String | Whenever SWIFT field :86: begins with three digits, they are assumed to
contain the ZKA transaction code and thus will correspond with the ZkaTranCode
property. If the SWIFT field :86: does not begin with three digits, then this
will be If the first digit is zero, the other two digits actually correspond with the text key of a remittance. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that did not consist of exactly three digits. |
Methods
AugmentInfoToAcctOwner(SwiftField)
Augment this statement line with the information from SWIFT field 86 (Information to Account Owner).
Declaration
public void AugmentInfoToAcctOwner(SwiftField aField86)
Parameters
Type | Name | Description |
---|---|---|
SwiftField | aField86 | Instance of SwiftField that carries a SWIFT field 86 with information to be added to this statement line. If this field is structured according to the ZKA, then all its subfields are properly extracted. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Parameter aField86 was |
System.ArgumentOutOfRangeException | The given SWIFT field was not a non-generic field with tag 86 or its content was
|
SwiftException | The content of the SWIFT field is malformed. The SwiftExceptionCode will be MalformedFieldContent. |
BuildField61()
Builds a SWIFT field 61 (Statement Line).
Declaration
public SwiftField BuildField61()
Returns
Type | Description |
---|---|
SwiftField | New instance of SwiftField that contains the data from this SwiftStatementLine instance. |
Remarks
At least the following properties must be set before a valid SWIFT field 61 can be generated: ValueDate, Value, DebitCreditMark, and TranTypeIdCode. The EntryDate is optional, but should always be provided for MT-940 entries.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Not all required subfields for a valid field 61 have been set. |
BuildField86()
Attempts to build a SWIFT field 86 (Information to Account Owner).
Declaration
public SwiftField BuildField86()
Returns
Type | Description |
---|---|
SwiftField | New instance of SwiftField that contains the data from this SwiftStatementLine instance. If the resulting field 86 would be completely empty, because no suitable
properties of this SwiftStatementLine have been set, then |
Remarks
The presence and value of the ZkaTranCode determines whether
a structured or unstructured field 86 will be generated. Only if
ZkaTranCode is not null
and does not start with the digit '9',
then a structured field 86 is generated. Otherwise an unstructured field 86 is
generated.
TODO: The SEPA properties EndToEndId, MandateId, and CreditorId are currently ignored. This method will never build a SEPA transaction with a structured field 86.
Equals(Object)
Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Another SwiftStatementLine instance to compare this one to. |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Remarks
TODO: The hash code currently only includes the EntryDate and the Amount. Although it should include all fields in order to match the implementation of Equals(Object).