Class SupaConverter
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
aAccountSepaAccountProvides the account information for the
Acctfields. Must be fully valid and not benull.aBookedBalanceSepaBalanceProvides the booked balance information for the fields
BalAmt,BalCdtDbtInd, andBalDt. May also include credit line information which will be set asCdtLineAmt. Must be fully valid and not benull.aExpectedBalanceSepaBalanceProvides optional current balance information for the fields
CurBalAmt,CurBalCdtDbtInd, andCurBalDt. May also include credit line information which will be set asCdtLineAmt. May benullif no current balance is provided. Must be fully valid, if provided.aSupaRecordISupaRecordThe 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
aAccountSepaAccountThe SepaAccount to convert from. Must not be
null.aSupaRecordISupaRecordThe target record that shall receive the SUPA data fields for the given account. Must not be
null.
Exceptions
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
aBalanceSepaBalanceThe SepaBalance to be converted to SUPA fields. This must be a fully valid balance object and must not be
null.aSupaRecordISupaRecordThe 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
aEntrySepaStatementEntryaTxnSepaTransactionDetailsoptional
aSupaRecordISupaRecord
ProduceAccount(JsonObject)
public static SepaAccount ProduceAccount(JsonObject jsAcct)
Parameters
jsAcctJsonObject
Returns
ProduceAccount(ISupaRecord)
public static SepaAccount ProduceAccount(ISupaRecord aSupaRecord)
Parameters
aSupaRecordISupaRecord
Returns
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
jsAcctBalJsonObjectThe SUPA JSON
AcctBalobject to convert. This must not benull.aAccountSepaAccountaBookedBalanceSepaBalanceaExpectedBalanceSepaBalance
- 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
aSupaRecordISupaRecordaAccountSepaAccountWill receive the result from ProduceAccount(ISupaRecord).
aBookedBalanceSepaBalanceThe booked balance will be created from the SUPA fields
BalAmt,BalCdtDbtInd,BalDt,AcctCcy, and optionalCdtLineAmt. The balance type will always be set to ClosingBooked.aExpectedBalanceSepaBalanceIf the SUPA record contains a field
CurBalAmt, then this balance will be created from the fieldsCurBalAmt,CurBalCdtDbtInd,CurBalDt, andAcctCcy. The balance type will always be set to Expected. The CreditLineAmount will not be set. If noCurBalAmtis present, then this will be set tonull.
ProduceBalance(JsonObject)
Produce a SepaBalance from SUPA JSON object.
public static SepaBalance ProduceBalance(JsonObject jsBal)
Parameters
jsBalJsonObjectThe SUPA JSON balance object to convert. This must not be
null.
Returns
- See Also
ProduceBalance(ISupaRecord)
Produce a SepaBalance from SUPA data.
public static SepaBalance ProduceBalance(ISupaRecord aSupaRecord)
Parameters
aSupaRecordISupaRecord
Returns
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
aSupaEntryRecordISupaRecordvSupaTransactionRecordsIList<ISupaRecord>
Returns
ProduceEntry(JsonObject)
public static SepaStatementEntry ProduceEntry(JsonObject jsEntry)
Parameters
jsEntryJsonObject
Returns
ProduceEntry(ISupaRecord)
Produces a SepaStatementEntry containing a single SepaTransactionDetails from the given SUPA statement entry.
public static SepaStatementEntry ProduceEntry(ISupaRecord aSupaRecord)
Parameters
aSupaRecordISupaRecord
Returns
ProduceJson(SepaAccount)
public static JsonObject ProduceJson(SepaAccount aAccount)
Parameters
aAccountSepaAccount
Returns
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
aAccountSepaAccountProvides the account information for the
Acctfields. Must be fully valid and not benull.aBookedBalanceSepaBalanceProvides the booked balance information for the fields
BalAmt,BalCdtDbtInd, andBalDt. May also include credit line information which will be set asCdtLineAmt. Must be fully valid and not benull.aExpectedBalanceSepaBalanceProvides optional current balance information for the fields
CurBalAmt,CurBalCdtDbtInd, andCurBalDt. May also include credit line information which will be set asCdtLineAmt. May benullif no current balance is provided. Must be fully valid, if provided.
Returns
- 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
aBalanceSepaBalanceThe SepaBalance to be converted to SUPA. This must be a fully valid balance object and must not be
null.
Returns
- See Also
ProduceJson(SepaDocument)
Converts a CAMT document into JSON representation.
public static JsonObject ProduceJson(SepaDocument aDoc)
Parameters
aDocSepaDocument
Returns
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
aStmtSepaStatement
Returns
ProduceJson(SepaStatementEntry)
public static JsonObject ProduceJson(SepaStatementEntry aEntry)
Parameters
aEntrySepaStatementEntry
Returns
ProduceJson(SepaStatementEntry, SepaTransactionDetails)
public static JsonObject ProduceJson(SepaStatementEntry aEntry, SepaTransactionDetails aTxn)
Parameters
aEntrySepaStatementEntryaTxnSepaTransactionDetailsoptional
Returns
ProduceJson(IEnumerable<SepaStatementEntry>)
public static JsonArray ProduceJson(IEnumerable<SepaStatementEntry> vEntries)
Parameters
vEntriesIEnumerable<SepaStatementEntry>
Returns
ProducePaymentInitiation(JsonObject)
public static SepaPaymentInitiation ProducePaymentInitiation(JsonObject jsRemitt)
Parameters
jsRemittJsonObject
Returns
ProducePaymentInitiation(ISupaRecord)
public static SepaPaymentInitiation ProducePaymentInitiation(ISupaRecord aSupaRecord)
Parameters
aSupaRecordISupaRecord
Returns
ProduceTransactionInformation(SepaPaymentInformation, JsonObject, bool)
public static SepaTransactionInformation ProduceTransactionInformation(SepaPaymentInformation aPmtInf, JsonObject jsRemitt, bool fSetPmtTpInf)
Parameters
aPmtInfSepaPaymentInformationjsRemittJsonObjectfSetPmtTpInfbool
Returns
ProduceTransactionInformation(SepaPaymentInformation, ISupaRecord, bool)
public static SepaTransactionInformation ProduceTransactionInformation(SepaPaymentInformation aPmtInf, ISupaRecord aSupaRecord, bool fSetPmtTpInf)
Parameters
aPmtInfSepaPaymentInformationaSupaRecordISupaRecordfSetPmtTpInfboolIf
true, then the Payment Type Information element will be initialized in the returned SepaTransactionInformation. Otherwise the element is forced to be excluded.