From 1c049b4bf32ef694f2c88001195937b1af0cb857 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 14 Jun 2020 15:10:14 +0200 Subject: [PATCH] Added example code to get it at least working in browser --- fints4k/src/jsMain/resources/index.html | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fints4k/src/jsMain/resources/index.html b/fints4k/src/jsMain/resources/index.html index 2a9152e2..656773e0 100644 --- a/fints4k/src/jsMain/resources/index.html +++ b/fints4k/src/jsMain/resources/index.html @@ -7,6 +7,34 @@ +

Usage

+

+ You can now access fints4k via JavaScript, e.g.: +

+

+ + var webClient = {
+ post_w74nik$: function(url, body, contentType, userAgent) {
+ var xmlHttp = new XMLHttpRequest()
+ xmlHttp.open( "POST", "https://cors-anywhere.herokuapp.com/" + url, false )
+ xmlHttp.setRequestHeader("Content-Type", contentType)
+ xmlHttp.send( body )
+ return { successful: xmlHttp.status == 200, responseCode: xmlHttp.status, error: null, body: xmlHttp.responseText }
+ }
+ }

+ var fints = this.fints4k.net.dankito.banking.fints

+ + var bank = new fints.model.BankData("[Bank code (Bankleitzahl)>", 280, "[FinTS Server Address]", "[BIC]")
+ var customer = new fints.model.CustomerData("[Your customer id (Online Banking login name)]", "[Password]")

+ + var client = new fints.FinTsClientForCustomer(bank, customer, null, webClient) // TODO: add callback

+ + setTimeout(function() {
+ var addAccountResponse = client.addAccount()
+ console.log(addAccountResponse)
+ }, 1) +
+

\ No newline at end of file