Fixed displaying from and to

This commit is contained in:
dankito 2022-02-25 21:08:13 +01:00
parent b8c11376ed
commit 8aaf1b0962
1 changed files with 20 additions and 5 deletions

View File

@ -33,11 +33,7 @@ class NativeApp {
}
fun getAccountData(param: GetAccountDataParameter, outputFilePath: String? = null, outputFormat: OutputFormat = OutputFormat.Json) {
if (param.retrieveTransactions != RetrieveTransactions.No) {
println("Getting balance and account transactions from ${param.retrieveTransactionsFrom ?: "ab urbe condita"} to ${param.retrieveTransactionsTo ?: LocalDate.todayAtEuropeBerlin()}")
} else {
println("Retrieving account info ${if (param.retrieveBalance) "and balance" else ""} for ${param.bankCode} ...")
}
displayTypeOfDataWeAreGoingToRetrieve(param)
val response = client.getAccountData(param)
@ -56,6 +52,25 @@ class NativeApp {
}
}
private fun displayTypeOfDataWeAreGoingToRetrieve(param: GetAccountDataParameter) {
if (param.retrieveTransactions != RetrieveTransactions.No) {
val from = when {
param.retrieveTransactions == RetrieveTransactions.OfLast90Days -> "of last 90 days"
param.retrieveTransactionsFrom != null -> "from ${param.retrieveTransactionsFrom}"
else -> "since the beginning of time"
}
val to = when {
param.retrieveTransactions == RetrieveTransactions.OfLast90Days -> ""
param.retrieveTransactionsTo != null -> "to ${param.retrieveTransactionsTo}"
else -> "till today"
}
println("Getting ${if (param.retrieveBalance) "balance and" else ""} account transactions $from $to")
} else {
println("Retrieving account info ${if (param.retrieveBalance) "and balance" else ""} for ${param.bankCode} ...")
}
}
fun transferMoney(param: TransferMoneyParameter) {
val response = client.transferMoney(param)