Class SepaAmount
Inherited Members
Namespace: Subsembly.Sepa
Assembly: Subsembly.Sepa.dll
Syntax
public sealed class SepaAmount : SepaObject
Constructors
SepaAmount()
The default constructor creates an element with
TagName "Amt",
SepaAmountCreditDebitIndicatorConstraint Optional,
and IsMandatory as false
.
Declaration
public SepaAmount()
SepaAmount(String, SepaAmountCreditDebitIndicatorConstraint)
Declaration
public SepaAmount(string sTagName, SepaAmountCreditDebitIndicatorConstraint nCdtDbtIndConstraint)
Parameters
Type | Name | Description |
---|---|---|
System.String | sTagName | |
SepaAmountCreditDebitIndicatorConstraint | nCdtDbtIndConstraint |
SepaAmount(String, SepaAmountCreditDebitIndicatorConstraint, Boolean)
Declaration
public SepaAmount(string sTagName, SepaAmountCreditDebitIndicatorConstraint nCdtDbtIndConstraint, bool fIsMandatory)
Parameters
Type | Name | Description |
---|---|---|
System.String | sTagName | The XML tag that shall be used for writing the amount element. Usually this is "Amt", but can be different. |
SepaAmountCreditDebitIndicatorConstraint | nCdtDbtIndConstraint | Indicates whether the CreditDebitIndicator must be set to either Credit or Debit for a valid amount. |
System.Boolean | fIsMandatory |
Fields
CRDT
The CreditDebitIndicatorCode for credits (positive amounts).
Declaration
public const string CRDT = "CRDT"
Field Value
Type | Description |
---|---|
System.String |
DBIT
The CreditDebitIndicatorCode for debits (negative amounts).
Declaration
public const string DBIT = "DBIT"
Field Value
Type | Description |
---|---|
System.String |
Properties
Amount
The decimal amount.
Declaration
public decimal Amount { get; set; }
Property Value
Type | Description |
---|---|
System.Decimal | The value must be in the range from 0.00 through 999,999,999.99. The initial value is zero. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | An attempt was made to set a negative value. |
System.ArgumentException | An attempt was made to set a decimal value with more than two significant fractional digits. Although the actual XSD type specification allows five fractional digits, we still limit the amount to the more practical two fractional digits. |
CreditDebitIndicator
Credit debit indicator of the amount.
Declaration
public SepaCreditDebitIndicator CreditDebitIndicator { get; set; }
Property Value
Type | Description |
---|---|
SepaCreditDebitIndicator |
Remarks
The value Undefined indicates that no credit
debit indicator was given. The initial value of this property is
Undefined. Whenever this is set to either
Credit or
Debit, then a CdtDbtInd
XML element
will be written.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Is thrown if this method is invoked on an instance that does not support the CreditDebitIndicator. |
See Also
CreditDebitIndicatorCode
Credit debit indicator as a four letter code string.
Declaration
public string CreditDebitIndicatorCode { get; set; }
Property Value
Type | Description |
---|---|
System.String | This is "CRDT" for Credit, "DBIT" for
Debit, or |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a string value that was neither "CRDT" nor "DBIT". |
System.InvalidOperationException | Is thrown if this method is invoked on an instance that does not support the CreditDebitIndicator. |
See Also
Currency
The currency code of the amount. According to the XSD the use of this attribute is required.
Declaration
public string Currency { get; set; }
Property Value
Type | Description |
---|---|
System.String | The initial value of this property is |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An attempt was made to set a value that is not a syntactically valid currency code. |
IsDebit
Convenience property that indicates whether CreditDebitIndicator is Debit.
Declaration
public bool IsDebit { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEmpty
Declaration
public override bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Value
Provides the signed value of the amount.
Declaration
public decimal Value { get; }
Property Value
Type | Description |
---|---|
System.Decimal | If the CreditDebitIndicator is Debit, then minus Amount is provided. In any other case simply the Amount is provided. |
Methods
Clear()
Declaration
public override void Clear()
Overrides
Clone()
Declaration
public SepaAmount Clone()
Returns
Type | Description |
---|---|
SepaAmount |
OnReadXml(XmlReader, SepaMessageInfo)
Declaration
protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo |
Overrides
OnValidate(ICollection<SepaException>, String)
Declaration
protected override void OnValidate(ICollection<SepaException> vErrors, string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<SepaException> | vErrors | |
System.String | sPath |
Overrides
OnWriteXml(XmlWriter, SepaMessageInfo)
Declaration
protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo |
Overrides
ReadXml(XmlReader, SepaMessageInfo)
Declaration
public override void ReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | aXmlReader | |
SepaMessageInfo | aMessageInfo |
Overrides
SetValue(Decimal)
Sets the Amount and CreditDebitIndicator from a signed decimal value.
Declaration
public void SetValue(decimal nValue)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | nValue | Signed decimal value. The Amount will be set to the unsigned absolute amount of this value. |
Remarks
If this instance does support the CreditDebitIndicator, then this method will update it according to the sign of the value. If the value is negative, then the CreditDebitIndicator will be set to Debit. If the value is zero or positive, then then the CreditDebitIndicator will be set to Credit.
See Also
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
WriteXml(XmlWriter, SepaMessageInfo)
Declaration
public override void WriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | aXmlWriter | |
SepaMessageInfo | aMessageInfo |