Class SupaConverter

Namespace
Subsembly.Supa
Assembly
Subsembly.Sepa.dll

Methods for conversion between SEPA objects and SUPA records.

public static class SupaConverter
Inheritance
SupaConverter
Inherited Members

Remarks

The field names of the JSON objects are based on the XML tag names defined in the Subsembly SUPA specification based on ISO 20022. Hence, it should be straightforward to understand and apply.

Methods

ConvertToSupa(SepaAccount, SepaBalance, SepaBalance, ISupaRecord)

Fills ISupaRecord with account and balance information according to the SUPA specification for an object of type AcctBal.

public static void ConvertToSupa(SepaAccount aAccount, SepaBalance aBookedBalance, SepaBalance aExpectedBalance, ISupaRecord aSupaRecord)

Parameters

aAccount SepaAccount

Provides the account information for the Acct fields. Must be fully valid and not be null.

aBookedBalance SepaBalance

Provides the booked balance information for the fields BalAmt, BalCdtDbtInd, and BalDt. May also include credit line information which will be set as CdtLineAmt. Must be fully valid and not be null.

aExpectedBalance SepaBalance

Provides optional current balance information for the fields CurBalAmt, CurBalCdtDbtInd, and CurBalDt. May also include credit line information which will be set as CdtLineAmt. May be null if no current balance is provided. Must be fully valid, if provided.

aSupaRecord ISupaRecord

The ISupaRecord where the fields shall be set. Must not be null.

Remarks

If both balances include a CreditLineAmount, then both must have the same value, otherwise an exception will be thrown.

ConvertToSupa(SepaAccount, ISupaRecord)

public static void ConvertToSupa(SepaAccount aAccount, ISupaRecord aSupaRecord)

Parameters

aAccount SepaAccount

The SepaAccount to convert from. Must not be null.

aSupaRecord ISupaRecord

The target record that shall receive the SUPA data fields for the given account. Must not be null.

Exceptions

ArgumentNullException

ConvertToSupa(SepaBalance, ISupaRecord)

Fills ISupaRecord with balance information according to the SUPA specification for an object of type Bal.

public static void ConvertToSupa(SepaBalance aBalance, ISupaRecord aSupaRecord)

Parameters

aBalance SepaBalance

The SepaBalance to be converted to SUPA fields. This must be a fully valid balance object and must not be null.

aSupaRecord ISupaRecord

The ISupaRecord where the balance fields shall be set. Must not be null.

Remarks

This will set the SUPA balance fields BalTpCd, BalAmt, BalCdtDbtInd, and BalDt from the given aBalance. The SepaBalanceType will be copied to the BalTpCd field without any validation.

The Currency from the balance will be set to the SUPA field AcctCcy.

If the given balance includes a non-empty CreditLineAmount, then the SUPA field CdtLineAmt is set with that amount.

ConvertToSupa(SepaStatementEntry, SepaTransactionDetails, ISupaRecord)

public static void ConvertToSupa(SepaStatementEntry aEntry, SepaTransactionDetails aTxn, ISupaRecord aSupaRecord)

Parameters

aEntry SepaStatementEntry
aTxn SepaTransactionDetails

optional

aSupaRecord ISupaRecord

ProduceAccount(JsonObject)

public static SepaAccount ProduceAccount(JsonObject jsAcct)

Parameters

jsAcct JsonObject

Returns

SepaAccount

ProduceAccount(ISupaRecord)

public static SepaAccount ProduceAccount(ISupaRecord aSupaRecord)

Parameters

aSupaRecord ISupaRecord

Returns

SepaAccount

ProduceAccountBalance(JsonObject, out SepaAccount, out SepaBalance, out SepaBalance)

Produce a SepaAccount and SepaBalance objects from a single SUPA AcctBal JSON object.

public static void ProduceAccountBalance(JsonObject jsAcctBal, out SepaAccount aAccount, out SepaBalance aBookedBalance, out SepaBalance aExpectedBalance)

Parameters

jsAcctBal JsonObject

The SUPA JSON AcctBal object to convert. This must not be null.

aAccount SepaAccount
aBookedBalance SepaBalance
aExpectedBalance SepaBalance
See Also

ProduceAccountBalance(ISupaRecord, out SepaAccount, out SepaBalance, out SepaBalance)

Produce a SepaAccount and SepaBalance objects from a single SUPA AcctBal record.

public static void ProduceAccountBalance(ISupaRecord aSupaRecord, out SepaAccount aAccount, out SepaBalance aBookedBalance, out SepaBalance aExpectedBalance)

Parameters

aSupaRecord ISupaRecord
aAccount SepaAccount

Will receive the result from ProduceAccount(ISupaRecord).

aBookedBalance SepaBalance

The booked balance will be created from the SUPA fields BalAmt, BalCdtDbtInd, BalDt, AcctCcy, and optional CdtLineAmt. The balance type will always be set to ClosingBooked.

aExpectedBalance SepaBalance

If the SUPA record contains a field CurBalAmt, then this balance will be created from the fields CurBalAmt, CurBalCdtDbtInd, CurBalDt, and AcctCcy. The balance type will always be set to Expected. The CreditLineAmount will not be set. If no CurBalAmt is present, then this will be set to null.

ProduceBalance(JsonObject)

Produce a SepaBalance from SUPA JSON object.

public static SepaBalance ProduceBalance(JsonObject jsBal)

Parameters

jsBal JsonObject

The SUPA JSON balance object to convert. This must not be null.

Returns

SepaBalance
See Also

ProduceBalance(ISupaRecord)

Produce a SepaBalance from SUPA data.

public static SepaBalance ProduceBalance(ISupaRecord aSupaRecord)

Parameters

aSupaRecord ISupaRecord

Returns

SepaBalance

Remarks

This will create a SepaBalance from the SUPA fields BalTpCd, BalAmt, BalCdtDbtInd, BalDt, AcctCcy, and optional CdtLineAmt.

ProduceBatchEntry(ISupaRecord, IList<ISupaRecord>)

Produces a SepaStatementEntry containing multiple SepaTransactionDetails from the given list of SUPA statement entries.

public static SepaStatementEntry ProduceBatchEntry(ISupaRecord aSupaEntryRecord, IList<ISupaRecord> vSupaTransactionRecords)

Parameters

aSupaEntryRecord ISupaRecord
vSupaTransactionRecords IList<ISupaRecord>

Returns

SepaStatementEntry

ProduceEntry(JsonObject)

public static SepaStatementEntry ProduceEntry(JsonObject jsEntry)

Parameters

jsEntry JsonObject

Returns

SepaStatementEntry

ProduceEntry(ISupaRecord)

Produces a SepaStatementEntry containing a single SepaTransactionDetails from the given SUPA statement entry.

public static SepaStatementEntry ProduceEntry(ISupaRecord aSupaRecord)

Parameters

aSupaRecord ISupaRecord

Returns

SepaStatementEntry

ProduceJson(SepaAccount)

public static JsonObject ProduceJson(SepaAccount aAccount)

Parameters

aAccount SepaAccount

Returns

JsonObject

ProduceJson(SepaAccount, SepaBalance, SepaBalance)

Creates a SUPA JSON object with account and balance information according to the SUPA specification for an object of type AcctBal.

public static JsonObject ProduceJson(SepaAccount aAccount, SepaBalance aBookedBalance, SepaBalance aExpectedBalance)

Parameters

aAccount SepaAccount

Provides the account information for the Acct fields. Must be fully valid and not be null.

aBookedBalance SepaBalance

Provides the booked balance information for the fields BalAmt, BalCdtDbtInd, and BalDt. May also include credit line information which will be set as CdtLineAmt. Must be fully valid and not be null.

aExpectedBalance SepaBalance

Provides optional current balance information for the fields CurBalAmt, CurBalCdtDbtInd, and CurBalDt. May also include credit line information which will be set as CdtLineAmt. May be null if no current balance is provided. Must be fully valid, if provided.

Returns

JsonObject
See Also

ProduceJson(SepaBalance)

Creates a SUPA JSON object with balance information according to the SUPA specification for an object of type Bal.

public static JsonObject ProduceJson(SepaBalance aBalance)

Parameters

aBalance SepaBalance

The SepaBalance to be converted to SUPA. This must be a fully valid balance object and must not be null.

Returns

JsonObject
See Also

ProduceJson(SepaDocument)

Converts a CAMT document into JSON representation.

public static JsonObject ProduceJson(SepaDocument aDoc)

Parameters

aDoc SepaDocument

Returns

JsonObject

Exceptions

ArgumentNullException

The parameter was null.

ArgumentException

The given document was not CAMT document.

NotSupportedException

The CAMT document contains no stmt at all.

ProduceJson(SepaStatement)

Converts a SepaStatement instance into JSON representation.

public static JsonObject ProduceJson(SepaStatement aStmt)

Parameters

aStmt SepaStatement

Returns

JsonObject

ProduceJson(SepaStatementEntry)

public static JsonObject ProduceJson(SepaStatementEntry aEntry)

Parameters

aEntry SepaStatementEntry

Returns

JsonObject

ProduceJson(SepaStatementEntry, SepaTransactionDetails)

public static JsonObject ProduceJson(SepaStatementEntry aEntry, SepaTransactionDetails aTxn)

Parameters

aEntry SepaStatementEntry
aTxn SepaTransactionDetails

optional

Returns

JsonObject

ProduceJson(IEnumerable<SepaStatementEntry>)

public static JsonArray ProduceJson(IEnumerable<SepaStatementEntry> vEntries)

Parameters

vEntries IEnumerable<SepaStatementEntry>

Returns

JsonArray

ProducePaymentInitiation(JsonObject)

public static SepaPaymentInitiation ProducePaymentInitiation(JsonObject jsRemitt)

Parameters

jsRemitt JsonObject

Returns

SepaPaymentInitiation

ProducePaymentInitiation(ISupaRecord)

public static SepaPaymentInitiation ProducePaymentInitiation(ISupaRecord aSupaRecord)

Parameters

aSupaRecord ISupaRecord

Returns

SepaPaymentInitiation

ProduceTransactionInformation(SepaPaymentInformation, JsonObject, bool)

public static SepaTransactionInformation ProduceTransactionInformation(SepaPaymentInformation aPmtInf, JsonObject jsRemitt, bool fSetPmtTpInf)

Parameters

aPmtInf SepaPaymentInformation
jsRemitt JsonObject
fSetPmtTpInf bool

Returns

SepaTransactionInformation

ProduceTransactionInformation(SepaPaymentInformation, ISupaRecord, bool)

public static SepaTransactionInformation ProduceTransactionInformation(SepaPaymentInformation aPmtInf, ISupaRecord aSupaRecord, bool fSetPmtTpInf)

Parameters

aPmtInf SepaPaymentInformation
aSupaRecord ISupaRecord
fSetPmtTpInf bool

If true, then the Payment Type Information element will be initialized in the returned SepaTransactionInformation. Otherwise the element is forced to be excluded.

Returns

SepaTransactionInformation