diff --git a/SampleApp/build.gradle.kts b/SampleApp/build.gradle.kts new file mode 100644 index 00000000..1f8b9c5b --- /dev/null +++ b/SampleApp/build.gradle.kts @@ -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") +} \ No newline at end of file diff --git a/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt b/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt new file mode 100644 index 00000000..869a3a3c --- /dev/null +++ b/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt @@ -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}") + } + } + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 741c8aa6..8fc48156 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,3 +31,5 @@ include("FinTs4jBankingClient") project(":FinTs4jBankingClient").apply { name = "fints4k-banking-client" } + +include("SampleApp")