Added SampleApp to show usage
This commit is contained in:
parent
9a292a0e6c
commit
c5abc20506
|
@ -0,0 +1,16 @@
|
|||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
setUrl("https://maven.dankito.net/api/packages/codinux/maven")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation("net.codinux.banking.client:fints4k-banking-client:0.5.0")
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package net.codinux.banking.client.fints4k.example
|
||||
|
||||
import net.codinux.banking.client.SimpleBankingClientCallback
|
||||
import net.codinux.banking.client.fints4k.FinTs4kBankingClientForCustomer
|
||||
import net.codinux.banking.client.getAccountData
|
||||
import net.codinux.banking.client.model.tan.EnterTanResult
|
||||
|
||||
fun main() {
|
||||
ShowUsage().getAccountData()
|
||||
}
|
||||
|
||||
class ShowUsage {
|
||||
|
||||
private val bankCode = "" // Bankleitzahl deiner Bank
|
||||
|
||||
private val loginName = "" // Online-Banking Login Name mit dem du dich beim Online-Banking deiner Bank anmeldest
|
||||
|
||||
private val password = "" // Online-Banking Password mit dem du dich beim Online-Banking deiner Bank anmeldest
|
||||
|
||||
|
||||
fun getAccountData() {
|
||||
val client = FinTs4kBankingClientForCustomer(bankCode, loginName, password, SimpleBankingClientCallback { tanChallenge, callback ->
|
||||
val tan: String? = null // if a TAN is required, add a UI or ...
|
||||
callback.invoke(EnterTanResult(tan)) // ... set a break point here, get TAN e.g. from your TAN app, set tan variable in debugger view and resume debugger
|
||||
})
|
||||
|
||||
val response = client.getAccountData()
|
||||
|
||||
response.error?.let{ error ->
|
||||
println("Could not fetch account data: ${error.internalError ?: error.errorMessagesFromBank.joinToString()}")
|
||||
}
|
||||
|
||||
response.data?.let { data ->
|
||||
val customer = data.customer
|
||||
println("Kunde: ${customer.customerName} ${customer.accounts.size} Konten @ ${customer.bic} ${customer.bankName}")
|
||||
|
||||
println()
|
||||
println("Konten:")
|
||||
customer.accounts.sortedBy { it.type }.forEach { account ->
|
||||
println("${account.identifier} ${account.productName} ${account.balance} ${account.currency}")
|
||||
}
|
||||
|
||||
println()
|
||||
println("Umsätze:")
|
||||
data.bookedTransactions.forEach { transaction ->
|
||||
println("${transaction.valueDate} ${transaction.amount} ${transaction.currency} ${transaction.otherPartyName ?: ""} - ${transaction.reference}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,3 +31,5 @@ include("FinTs4jBankingClient")
|
|||
project(":FinTs4jBankingClient").apply {
|
||||
name = "fints4k-banking-client"
|
||||
}
|
||||
|
||||
include("SampleApp")
|
||||
|
|
Loading…
Reference in New Issue