Class SwiftBalance
Collects all possible information from a SWIFT balance field.
Inheritance
Inherited Members
Namespace: Subsembly.Swift
Assembly: Subsembly.Sepa.dll
Syntax
public class SwiftBalance
Remarks
This class is also suitable for collecting the balance information from a HBCI or FinTS data element group.
Constructors
SwiftBalance()
Creates a null balance.
Declaration
public SwiftBalance()
SwiftBalance(Decimal, String, SwiftDate)
Constructs a SwiftBalance instance with the given properties.
Declaration
public SwiftBalance(decimal dcValue, string sCurrency, SwiftDate tDate)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | dcValue | The decimal balance value, which may be negative. |
System.String | sCurrency | The currency code. |
SwiftDate | tDate | The date of this balance. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An invalid currency code was given. |
Properties
Amount
The absolute amount of this balance.
Declaration
public decimal Amount { get; }
Property Value
Type | Description |
---|---|
System.Decimal | The returned value is the absolute unsigned amount of the DecValue and therefore is always zero or positive. |
Currency
The ISO currency code of the currency of this balance record.
Declaration
public string Currency { get; set; }
Property Value
Type | Description |
---|---|
System.String | An ISO currency code consisting of three upper case letters. If no currency code
was set, or this property was set to |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt to set the currency code to a string that does not contain three upper case letters or digits will cause an ArgumentException to be thrown. |
Date
The date of this balance record.
Declaration
public SwiftDate Date { get; set; }
Property Value
Type | Description |
---|---|
SwiftDate | This may be a null date. |
DebitCreditFlag
The debit or credit flag of this balance.
Declaration
public char DebitCreditFlag { get; }
Property Value
Type | Description |
---|---|
System.Char | The debit/credit flag is an upper case "C" for a credit (positive or zero balance) or an upper case "D" for a debit (negative non-zero balance). |
DecValue
The actual decimal value of this balance.
Declaration
public decimal DecValue { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal | Any positive, negative or zero decimal value is allowed. |
IsDebit
Indicates whether this is a positive or negative balance.
Declaration
public bool IsDebit { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Time
The time of this balance record.
Declaration
public SwiftTime Time { get; set; }
Property Value
Type | Description |
---|---|
SwiftTime |
Remarks
This property does not exist in ordinary SWIFT balance fields. It was added to the SwiftBalance as it does exist as an optional component in HBCI and FinTS balance data element groups.
Whenever the Time is not used or relevant it is set to the time 00:00:00 which also is its default value.
Methods
Add(Decimal)
Add a decimal value to this balance.
Declaration
public void Add(decimal dcValue)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | dcValue | Decimal value to be added to this balance. This may be a negative value. |
Clone()
Creates a copy of this balance.
Declaration
public SwiftBalance Clone()
Returns
Type | Description |
---|---|
SwiftBalance | New instance of SwiftBalance with all properties initialised to the same value as this instance. |
Sub(Decimal)
Subtract a decimal value from this balance.
Declaration
public void Sub(decimal dcValue)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | dcValue | Decimal value to be subtracted to this balance. This may be a negative value. |
ToString()
Converts this balance into a SWIFT field content format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Balance formatted to fit as a SWIFT balance field content. |
Overrides
Remarks
Many SWIFT fields are defined to carry balance information. Most of these fields have all the same structure which is:
1!a6!n3!a15d
(D/C Mark) (Date) (Currency) (Amount)
A Debit/Credit Mark, followed by a date in the format YYMMDD, followed by a three letter currency code and finally the actual decimal amount.
This method generates a string according to this format. Note that any Time component is ignored in this representation.