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.RequestParameters
|
||||||
import net.dankito.utils.web.client.WebClientResponse
|
import net.dankito.utils.web.client.WebClientResponse
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
|
||||||
open class FinTsClient(
|
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) {
|
val balanceResponse = getAndHandleResponseForMessage(balanceRequest, bank)
|
||||||
return balanceResponse
|
|
||||||
|
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(
|
open class GetTransactionsParameter(
|
||||||
|
val alsoRetrieveBalance: Boolean = true,
|
||||||
val fromDate: Date? = null,
|
val fromDate: Date? = null,
|
||||||
val toDate: Date? = null,
|
val toDate: Date? = null,
|
||||||
val maxAmount: Int? = null,
|
val maxAmount: Int? = null,
|
||||||
|
|
|
@ -65,7 +65,7 @@ class FinTsClientTest {
|
||||||
val ninetyDaysAgo = Date(Date().time - ninetyDaysAgoMilliseconds)
|
val ninetyDaysAgo = Date(Date().time - ninetyDaysAgoMilliseconds)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val result = underTest.getTransactions(GetTransactionsParameter(ninetyDaysAgo), Bank, Customer)
|
val result = underTest.getTransactions(GetTransactionsParameter(fromDate = ninetyDaysAgo), Bank, Customer)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertThat(result.successful).isTrue()
|
assertThat(result.successful).isTrue()
|
||||||
|
|
Loading…
Reference in New Issue