Added messageLog to GetAccountDataResponse and TransferMoneyResponse
This commit is contained in:
parent
0b6490f501
commit
933c761a0d
|
@ -2,13 +2,15 @@ package net.codinux.banking.client.model.response
|
||||||
|
|
||||||
import net.codinux.banking.client.model.AccountTransaction
|
import net.codinux.banking.client.model.AccountTransaction
|
||||||
import net.codinux.banking.client.model.BankAccess
|
import net.codinux.banking.client.model.BankAccess
|
||||||
|
import net.codinux.banking.client.model.MessageLogEntry
|
||||||
import net.codinux.banking.client.model.config.JsonIgnore
|
import net.codinux.banking.client.model.config.JsonIgnore
|
||||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
|
|
||||||
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class GetAccountDataResponse(
|
open class GetAccountDataResponse(
|
||||||
val bank: BankAccess
|
val bank: BankAccess,
|
||||||
|
val messageLog: List<MessageLogEntry>
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package net.codinux.banking.client.model.response
|
package net.codinux.banking.client.model.response
|
||||||
|
|
||||||
|
import net.codinux.banking.client.model.MessageLogEntry
|
||||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer money process does not return any data, only if successful or not (and in latter case an error message).
|
* Transfer money process does not return any data, only if successful or not (and in latter case an error message).
|
||||||
*/
|
*/
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class TransferMoneyResponse
|
open class TransferMoneyResponse(
|
||||||
|
val messageLog: List<MessageLogEntry>
|
||||||
|
)
|
|
@ -36,11 +36,7 @@ open class BridgeFintTsToBankingClientCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun messageLogAdded(messageLogEntry: MessageLogEntry) {
|
override fun messageLogAdded(messageLogEntry: MessageLogEntry) {
|
||||||
val mapped = net.codinux.banking.client.model.MessageLogEntry(
|
val mapped = mapper.mapMessageLogEntry(messageLogEntry)
|
||||||
MessageLogEntryType.valueOf(messageLogEntry.type.name),
|
|
||||||
messageLogEntry.message, messageLogEntry.messageTrace,
|
|
||||||
messageLogEntry.error, messageLogEntry.time
|
|
||||||
)
|
|
||||||
|
|
||||||
bankingClientCallback.messageLogAdded(mapped)
|
bankingClientCallback.messageLogAdded(mapped)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import kotlinx.datetime.toLocalDateTime
|
||||||
import net.codinux.banking.client.model.*
|
import net.codinux.banking.client.model.*
|
||||||
import net.codinux.banking.client.model.AccountTransaction
|
import net.codinux.banking.client.model.AccountTransaction
|
||||||
import net.codinux.banking.client.model.Amount
|
import net.codinux.banking.client.model.Amount
|
||||||
|
import net.codinux.banking.client.model.MessageLogEntryType
|
||||||
import net.codinux.banking.client.model.extensions.EuropeBerlin
|
import net.codinux.banking.client.model.extensions.EuropeBerlin
|
||||||
import net.codinux.banking.client.model.tan.*
|
import net.codinux.banking.client.model.tan.*
|
||||||
import net.codinux.banking.client.model.options.GetAccountDataOptions
|
import net.codinux.banking.client.model.options.GetAccountDataOptions
|
||||||
|
@ -23,6 +24,7 @@ import net.dankito.banking.client.model.BankAccountIdentifierImpl
|
||||||
import net.dankito.banking.client.model.parameter.GetAccountDataParameter
|
import net.dankito.banking.client.model.parameter.GetAccountDataParameter
|
||||||
import net.dankito.banking.client.model.parameter.RetrieveTransactions
|
import net.dankito.banking.client.model.parameter.RetrieveTransactions
|
||||||
import net.dankito.banking.client.model.response.ErrorCode
|
import net.dankito.banking.client.model.response.ErrorCode
|
||||||
|
import net.dankito.banking.client.model.response.FinTsClientResponse
|
||||||
import net.codinux.banking.fints.mapper.FinTsModelMapper
|
import net.codinux.banking.fints.mapper.FinTsModelMapper
|
||||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.*
|
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.*
|
||||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.MobilePhoneTanMedium
|
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.MobilePhoneTanMedium
|
||||||
|
@ -30,6 +32,7 @@ import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanGe
|
||||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMedium
|
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMedium
|
||||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMediumStatus
|
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMediumStatus
|
||||||
import net.codinux.banking.fints.model.*
|
import net.codinux.banking.fints.model.*
|
||||||
|
import net.codinux.banking.fints.model.MessageLogEntry
|
||||||
import net.codinux.banking.fints.serialization.FinTsModelSerializer
|
import net.codinux.banking.fints.serialization.FinTsModelSerializer
|
||||||
import net.codinux.banking.fints.transactions.swift.model.Holding
|
import net.codinux.banking.fints.transactions.swift.model.Holding
|
||||||
import net.dankito.banking.banklistcreator.prettifier.BankingGroupMapper
|
import net.dankito.banking.banklistcreator.prettifier.BankingGroupMapper
|
||||||
|
@ -93,7 +96,7 @@ open class FinTs4kMapper {
|
||||||
|
|
||||||
open fun map(response: net.dankito.banking.client.model.response.GetAccountDataResponse, bank: BankInfo? = null): Response<GetAccountDataResponse> =
|
open fun map(response: net.dankito.banking.client.model.response.GetAccountDataResponse, bank: BankInfo? = null): Response<GetAccountDataResponse> =
|
||||||
if (response.successful && response.customerAccount != null) {
|
if (response.successful && response.customerAccount != null) {
|
||||||
Response.success(GetAccountDataResponse(mapBank(response.customerAccount!!, bank, response.serializedFinTsModel)))
|
Response.success(GetAccountDataResponse(mapBank(response.customerAccount!!, bank, response.serializedFinTsModel), mapMessageLog(response)))
|
||||||
} else {
|
} else {
|
||||||
mapError(response)
|
mapError(response)
|
||||||
}
|
}
|
||||||
|
@ -397,7 +400,7 @@ open class FinTs4kMapper {
|
||||||
|
|
||||||
open fun mapTransferMoneyResponse(response: net.dankito.banking.client.model.response.TransferMoneyResponse): Response<TransferMoneyResponse> =
|
open fun mapTransferMoneyResponse(response: net.dankito.banking.client.model.response.TransferMoneyResponse): Response<TransferMoneyResponse> =
|
||||||
if (response.successful) {
|
if (response.successful) {
|
||||||
Response.success(TransferMoneyResponse())
|
Response.success(TransferMoneyResponse(mapMessageLog(response)))
|
||||||
} else {
|
} else {
|
||||||
mapError(response)
|
mapError(response)
|
||||||
}
|
}
|
||||||
|
@ -405,6 +408,17 @@ open class FinTs4kMapper {
|
||||||
open fun mapToMoney(amount: Amount, currency: String): Money = Money(amount.toString(), currency)
|
open fun mapToMoney(amount: Amount, currency: String): Money = Money(amount.toString(), currency)
|
||||||
|
|
||||||
|
|
||||||
|
open fun mapMessageLog(response: FinTsClientResponse) = mapMessageLog(response.messageLog)
|
||||||
|
|
||||||
|
open fun mapMessageLog(messageLog: List<MessageLogEntry>) = messageLog.map { mapMessageLogEntry(it) }
|
||||||
|
|
||||||
|
open fun mapMessageLogEntry(messageLogEntry: MessageLogEntry) = net.codinux.banking.client.model.MessageLogEntry(
|
||||||
|
MessageLogEntryType.valueOf(messageLogEntry.type.name),
|
||||||
|
messageLogEntry.message, messageLogEntry.messageTrace,
|
||||||
|
messageLogEntry.error, messageLogEntry.time
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
protected open fun <T> mapError(response: net.dankito.banking.client.model.response.FinTsClientResponse): Response<T> {
|
protected open fun <T> mapError(response: net.dankito.banking.client.model.response.FinTsClientResponse): Response<T> {
|
||||||
return if (response.error != null) {
|
return if (response.error != null) {
|
||||||
Response.error(ErrorType.valueOf(response.error!!.name), if (response.error == ErrorCode.BankReturnedError) null else response.errorMessage,
|
Response.error(ErrorType.valueOf(response.error!!.name), if (response.error == ErrorCode.BankReturnedError) null else response.errorMessage,
|
||||||
|
|
Loading…
Reference in New Issue