Renamed checkIfAccountExists() to addAccount()
This commit is contained in:
parent
c7e71fcc84
commit
f5405f8366
|
@ -40,7 +40,7 @@ open class MainWindowPresenter(callback: FinTsClientCallback) {
|
||||||
val bank = bankDataMapper.mapFromBankInfo(bankInfo)
|
val bank = bankDataMapper.mapFromBankInfo(bankInfo)
|
||||||
val customer = CustomerData(customerId, pin)
|
val customer = CustomerData(customerId, pin)
|
||||||
|
|
||||||
finTsClient.checkIfAccountExistsAsync(bank, customer) { response ->
|
finTsClient.addAccountAsync(bank, customer) { response ->
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
accounts.put(customer, bank)
|
accounts.put(customer, bank)
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ open class AddAccountDialog : DialogFragment() {
|
||||||
val customerId = edtxtCustomerId.text.toString()
|
val customerId = edtxtCustomerId.text.toString()
|
||||||
val pin = edtxtPin.text.toString()
|
val pin = edtxtPin.text.toString()
|
||||||
|
|
||||||
presenter.checkIfAccountExists(selectedBank, customerId, pin) { response ->
|
presenter.addAccountAsync(selectedBank, customerId, pin) { response ->
|
||||||
context?.asActivity()?.runOnUiThread {
|
context?.asActivity()?.runOnUiThread {
|
||||||
handleAccountCheckResponseOnUiThread(response)
|
handleAccountCheckResponseOnUiThread(response)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
callback: (FinTsClientResponse) -> Unit) {
|
||||||
|
|
||||||
threadPool.runAsync {
|
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)
|
val newUserInfoResponse = getBankAndCustomerInfoForNewUser(bank, customer)
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,10 @@ class FinTsClientTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun checkIfAccountExists() {
|
fun addAccount() {
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val result = underTest.checkIfAccountExists(Bank, Customer)
|
val result = underTest.addAccount(Bank, Customer)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertThat(result.isSuccessful).isTrue()
|
assertThat(result.isSuccessful).isTrue()
|
||||||
|
@ -136,7 +136,7 @@ class FinTsClientTest {
|
||||||
fun testBankTransfer() {
|
fun testBankTransfer() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
underTest.checkIfAccountExists(Bank, Customer)
|
underTest.addAccount(Bank, Customer)
|
||||||
|
|
||||||
// now IBAN should be set
|
// now IBAN should be set
|
||||||
assertThat(Customer.iban).describedAs("Customer's IBAN should now be set").isNotNull()
|
assertThat(Customer.iban).describedAs("Customer's IBAN should now be set").isNotNull()
|
||||||
|
|
Loading…
Reference in New Issue