From f5405f8366a4415b958d934f6f5aeb93293fb4f3 Mon Sep 17 00:00:00 2001 From: dankl Date: Wed, 30 Oct 2019 23:02:59 +0100 Subject: [PATCH] Renamed checkIfAccountExists() to addAccount() --- .../banking/fints4java/android/ui/MainWindowPresenter.kt | 2 +- .../fints4java/android/ui/dialogs/AddAccountDialog.kt | 2 +- .../src/main/kotlin/net/dankito/fints/FinTsClient.kt | 8 ++++---- .../src/test/kotlin/net/dankito/fints/FinTsClientTest.kt | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt index 2311d331..27485108 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt @@ -40,7 +40,7 @@ open class MainWindowPresenter(callback: FinTsClientCallback) { val bank = bankDataMapper.mapFromBankInfo(bankInfo) val customer = CustomerData(customerId, pin) - finTsClient.checkIfAccountExistsAsync(bank, customer) { response -> + finTsClient.addAccountAsync(bank, customer) { response -> if (response.isSuccessful) { accounts.put(customer, bank) diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt index 3ff0e06a..08b380b9 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt @@ -71,7 +71,7 @@ open class AddAccountDialog : DialogFragment() { val customerId = edtxtCustomerId.text.toString() val pin = edtxtPin.text.toString() - presenter.checkIfAccountExists(selectedBank, customerId, pin) { response -> + presenter.addAccountAsync(selectedBank, customerId, pin) { response -> context?.asActivity()?.runOnUiThread { handleAccountCheckResponseOnUiThread(response) } diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt index 97ffbf71..80e21ab1 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt @@ -111,15 +111,15 @@ open class FinTsClient @JvmOverloads constructor( } - open fun checkIfAccountExistsAsync(bank: BankData, customer: CustomerData, - callback: (FinTsClientResponse) -> Unit) { + open fun addAccountAsync(bank: BankData, customer: CustomerData, + callback: (FinTsClientResponse) -> Unit) { threadPool.runAsync { - callback(checkIfAccountExists(bank, customer)) + callback(addAccount(bank, customer)) } } - open fun checkIfAccountExists(bank: BankData, customer: CustomerData): FinTsClientResponse { + open fun addAccount(bank: BankData, customer: CustomerData): FinTsClientResponse { val newUserInfoResponse = getBankAndCustomerInfoForNewUser(bank, customer) diff --git a/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt b/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt index d2517bef..4b0d19ee 100644 --- a/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt +++ b/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt @@ -76,10 +76,10 @@ class FinTsClientTest { @Test - fun checkIfAccountExists() { + fun addAccount() { // when - val result = underTest.checkIfAccountExists(Bank, Customer) + val result = underTest.addAccount(Bank, Customer) // then assertThat(result.isSuccessful).isTrue() @@ -136,7 +136,7 @@ class FinTsClientTest { fun testBankTransfer() { // given - underTest.checkIfAccountExists(Bank, Customer) + underTest.addAccount(Bank, Customer) // now IBAN should be set assertThat(Customer.iban).describedAs("Customer's IBAN should now be set").isNotNull()