Added parameter alsoRetrieveBalance
This commit is contained in:
parent
5ebbf0d383
commit
362b09a246
|
@ -14,6 +14,7 @@ import net.dankito.utils.web.client.OkHttpWebClient
|
|||
import net.dankito.utils.web.client.RequestParameters
|
||||
import net.dankito.utils.web.client.WebClientResponse
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.math.BigDecimal
|
||||
|
||||
|
||||
open class FinTsClient(
|
||||
|
@ -99,14 +100,22 @@ open class FinTsClient(
|
|||
}
|
||||
|
||||
|
||||
dialogData.increaseMessageNumber()
|
||||
var balance: BigDecimal? = null
|
||||
|
||||
val balanceRequest = messageBuilder.createGetBalanceMessage(bank, customer, product, dialogData)
|
||||
if (parameter.alsoRetrieveBalance) {
|
||||
dialogData.increaseMessageNumber()
|
||||
|
||||
val balanceResponse = getAndHandleResponseForMessage(balanceRequest, bank)
|
||||
val balanceRequest = messageBuilder.createGetBalanceMessage(bank, customer, product, dialogData)
|
||||
|
||||
if (balanceResponse.successful == false) {
|
||||
return balanceResponse
|
||||
val balanceResponse = getAndHandleResponseForMessage(balanceRequest, bank)
|
||||
|
||||
if (balanceResponse.successful == false) {
|
||||
return balanceResponse
|
||||
}
|
||||
|
||||
balanceResponse.getFirstSegmentById<BalanceSegment>(InstituteSegmentId.Balance)?.let {
|
||||
balance = it.balance
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.*
|
|||
|
||||
|
||||
open class GetTransactionsParameter(
|
||||
val alsoRetrieveBalance: Boolean = true,
|
||||
val fromDate: Date? = null,
|
||||
val toDate: Date? = null,
|
||||
val maxAmount: Int? = null,
|
||||
|
|
|
@ -65,7 +65,7 @@ class FinTsClientTest {
|
|||
val ninetyDaysAgo = Date(Date().time - ninetyDaysAgoMilliseconds)
|
||||
|
||||
// when
|
||||
val result = underTest.getTransactions(GetTransactionsParameter(ninetyDaysAgo), Bank, Customer)
|
||||
val result = underTest.getTransactions(GetTransactionsParameter(fromDate = ninetyDaysAgo), Bank, Customer)
|
||||
|
||||
// then
|
||||
assertThat(result.successful).isTrue()
|
||||
|
|
Loading…
Reference in New Issue