Go to file
dankito 9aa2b54c56 Implemented BanksFinTsDetailsRetriever to retrieve banks FinTS information from all banks in bank list from Deutsche Kreditwirtschaft 2022-02-07 00:17:52 +01:00
BankListCreator Added description to @Ignore 2019-10-13 01:14:01 +02:00
BankingJavaFxApp Fixed that AccountsChangedListener may gets called off UI thread 2022-02-07 00:17:52 +01:00
BankingJavaFxControls Fixed that AccountsChangedListener may gets called off UI thread 2022-02-07 00:17:52 +01:00
BankingUiCommon Added logging to LuceneBankingPersistence tests 2020-04-28 16:51:26 +02:00
docs Implemented BanksFinTsDetailsRetriever to retrieve banks FinTS information from all banks in bank list from Deutsche Kreditwirtschaft 2022-02-07 00:17:52 +01:00
fints4javaAndroidApp Fixed that AccountsChangedListener may gets called off UI thread 2022-02-07 00:17:52 +01:00
fints4javaBankingClient Moved FinTsClientCallback to sub package callback 2020-04-28 18:34:11 +02:00
fints4javaLib Implemented BanksFinTsDetailsRetriever to retrieve banks FinTS information from all banks in bank list from Deutsche Kreditwirtschaft 2022-02-07 00:17:52 +01:00
gradle/wrapper Bumped Gradle version to 6.2.1 2020-04-22 12:57:54 +02:00
hbci4jBankingClient Fixed that least a bit creating passport.dat file to make it multi account capable, but still doesn't work if same account gets added twice 2020-01-26 12:57:20 +01:00
persistence Hopefully now really fixed app crashes when restoring Android app due to previous DocumentsWriter / IndexWriter instance is still not destroyed and still holds write lock 2020-04-28 18:16:16 +02:00
.gitignore Added docs/received_messages to .gitignore 2019-10-12 21:15:46 +02:00
OpenPoints.md Added ToDo list (mostly questions concerning design / UX) 2020-04-28 18:09:53 +02:00
README.md Updated version and added example code 2020-04-22 11:50:51 +02:00
build.gradle Added logging to LuceneBankingPersistence tests 2020-04-28 16:51:26 +02:00
gradle.properties Upgraded to AndroidX AppCompat 2020-04-22 17:40:12 +02:00
gradlew Initial commit 2019-10-02 19:54:11 +02:00
gradlew.bat Initial commit 2019-10-02 19:54:11 +02:00
settings.gradle Implemented displaying remittees from all account transactions so that user can choose between them and get bank transfer done faster 2020-04-25 02:45:37 +02:00

README.md

fints4java

fints4java is an implementation of the FinTS 3.0 online banking protocol used by most German banks.

There's already a full functional FinTS/HBCI library for Java: hbci4java. So why did I take the trouble to write a new one?

  • hbci4java does not run on Android.
  • It's hard to configure (e.g. to get the account transactions from a particular day onwards you have to browse the source to find out that you have to add the key "startdate" to a Map and as value the date as a string with format "yyyy-MM-dd").
  • It's hard to extend. I wanted to implement SEPA instant payments, but you would have to dive deep into the source and implement it there. There's absolutely no way to (quickly) add it from your source by extending the library.

Features / Limitations

  • Supports only FinTS 3.0 which is used by most banks (HBCI 2.x is obsolete, FinTS 4.x is only used by one bank according to offical bank list).
  • Supports only PIN/TAN (used by most users), no signature cards.
  • Supports only chipTAN.
  • Supported operations:
    • Get account info
    • Get account transactions
    • Normal, scheduled and instant payment (SEPA) cash transfer

Setup

Not uploaded to Maven Central yet, will do this the next few days!

Gradle:

dependencies {
  compile 'net.dankito.banking:fints4java:0.1.0'
}

Maven:

<dependency>
   <groupId>net.dankito.banking</groupId>
   <artifactId>fints4java</artifactId>
   <version>0.1.0</version>
</dependency>

Usage

See e.g. JavaShowcase or FinTsClientTest.

    public static void main(String[] args) {
        BankFinder bankFinder = new BankFinder();

        // set your bank code (Bankleitzahl) here. Or create BankData manually. Required fields are:
        // bankCode, bankCountryCode (Germany = 280), finTs3ServerAddress and for bank transfers bic
        List<BankInfo> foundBanks = bankFinder.findBankByBankCode("10070000");

        if (foundBanks.isEmpty() == false) {
            BankData bank = new BankDataMapper().mapFromBankInfo(foundBanks.get(0));
            // set your customer data (customerId = Kontonummer in most cases, pin = online banking pin)
            CustomerData customer = new CustomerData("<customer_id>", "<pin>");
            customer.setSelectedTanProcedure(new TanProcedure("", Sicherheitsfunktion.PIN_TAN_911, TanProcedureType.ChipTan));

            FinTsClient finTsClient = new FinTsClient(new Java8Base64Service());

            // some banks support retrieving account transactions of last 90 days without TAN
            long ninetyDaysAgoMilliseconds = 90 * 24 * 60 * 60 * 1000L;
            Date ninetyDaysAgo = new Date(new Date().getTime() - ninetyDaysAgoMilliseconds);

            GetTransactionsResponse response = finTsClient.getTransactions(
                    new GetTransactionsParameter(true, ninetyDaysAgo), bank, customer);

            showResponse(response);
        }
    }

    private static void showResponse(GetTransactionsResponse response) {
        if (response.isSuccessful()) {
            System.out.println("Balance (Saldo) = " + response.getBalance());

            System.out.println("Account transactions (Umsätze):");
            for (AccountTransaction transaction : response.getBookedTransactions()) {
                System.out.println(transaction.toString());
            }
        }
        else {
            if (response.isStrongAuthenticationRequired()) {
                System.out.println("Sorry, your bank doesn't support retrieving account " +
                        "transactions of last 90 days without TAN");
            }
            else {
                System.out.println("An error occurred:");
                if (response.getException() != null) { // something severe occurred
                    System.out.println(response.getException().getMessage());
                }

                // error messages retrieved from bank (e.g. PIN is wrong, message contains errors, ...)
                for (String retrievedErrorMessage : response.getErrorsToShowToUser()) {
                    System.out.println(retrievedErrorMessage);
                }
            }
        }
    }

Logging

fints4java uses slf4j as logging facade.

So you can use any logger that supports slf4j, like Logback and log4j, to configure and get fints4java's log output.

License

tbd.

In short: Non commercial projects can use it absolutely for free, commercial projects have to pay.