Renamed checkIfAccountExists() to addAccount()

This commit is contained in:
dankl 2019-10-30 23:02:59 +01:00 committed by dankito
parent c7e71fcc84
commit f5405f8366
4 changed files with 9 additions and 9 deletions

View File

@ -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)

View File

@ -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)
}

View File

@ -111,15 +111,15 @@ open class FinTsClient @JvmOverloads constructor(
}
open fun checkIfAccountExistsAsync(bank: BankData, customer: CustomerData,
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)

View File

@ -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()