Renamed isSuccessful to successful
This commit is contained in:
parent
6ed4acd8f2
commit
d8739cf193
|
@ -160,7 +160,7 @@ open class FinTsClient(
|
|||
// TODO: this is only a quick fix. Find a better and general solution
|
||||
protected open fun getBankAndCustomerInfoForNewUserViaAnonymousDialog(bank: BankData, callback: (AddAccountResponse) -> Unit) {
|
||||
getAnonymousBankInfo(bank) { anonymousBankInfoResponse ->
|
||||
if (anonymousBankInfoResponse.isSuccessful == false) {
|
||||
if (anonymousBankInfoResponse.successful == false) {
|
||||
callback(AddAccountResponse(anonymousBankInfoResponse.toResponse(), bank))
|
||||
}
|
||||
else if (bank.tanProceduresSupportedByBank.isEmpty()) { // should only be a theoretical error
|
||||
|
@ -238,7 +238,7 @@ open class FinTsClient(
|
|||
|
||||
getUsersTanProcedures(bank) { newUserInfoResponse ->
|
||||
|
||||
if (newUserInfoResponse.isSuccessful == false) { // bank parameter (FinTS server address, ...) already seem to be wrong
|
||||
if (newUserInfoResponse.successful == false) { // bank parameter (FinTS server address, ...) already seem to be wrong
|
||||
callback(newUserInfoResponse)
|
||||
return@getUsersTanProcedures
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ open class FinTsClient(
|
|||
|
||||
getAccounts(bank) { getAccountsResponse ->
|
||||
|
||||
if (getAccountsResponse.isSuccessful == false) {
|
||||
if (getAccountsResponse.successful == false) {
|
||||
callback(getAccountsResponse)
|
||||
return@getAccounts
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ open class FinTsClient(
|
|||
protected open fun ensureBasicBankDataRetrieved(bank: BankData, callback: (Response) -> Unit) {
|
||||
if (bank.tanProceduresSupportedByBank.isEmpty() || bank.supportedJobs.isEmpty()) {
|
||||
getUsersTanProcedures(bank) { getBankInfoResponse ->
|
||||
if (getBankInfoResponse.isSuccessful == false || bank.tanProceduresSupportedByBank.isEmpty()
|
||||
if (getBankInfoResponse.successful == false || bank.tanProceduresSupportedByBank.isEmpty()
|
||||
|| bank.supportedJobs.isEmpty()) {
|
||||
|
||||
callback(Response(false, errorMessage =
|
||||
|
@ -910,7 +910,7 @@ open class FinTsClient(
|
|||
changeTanMedium(changeTanMediumTo, dialogContext.bank) { changeTanMediumResponse ->
|
||||
changeTanMediumResultCallback?.invoke(changeTanMediumResponse)
|
||||
|
||||
if (changeTanMediumResponse.isSuccessful == false || lastCreatedMessage == null) {
|
||||
if (changeTanMediumResponse.successful == false || lastCreatedMessage == null) {
|
||||
callback(changeTanMediumResponse.toResponse())
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -10,7 +10,7 @@ open class AddAccountResponse(
|
|||
retrievedData: List<RetrievedAccountData> = listOf()
|
||||
) : GetTransactionsResponse(response, retrievedData) {
|
||||
|
||||
override val isSuccessful: Boolean
|
||||
get() = super.isSuccessful && bank.accounts.isNotEmpty()
|
||||
override val successful: Boolean
|
||||
get() = super.successful && bank.accounts.isNotEmpty()
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@ import net.dankito.banking.fints.response.segments.TanResponse
|
|||
|
||||
open class FinTsClientResponse(
|
||||
|
||||
open val isSuccessful: Boolean, // TODO: rename to successful
|
||||
open val successful: Boolean,
|
||||
|
||||
open val noTanProcedureSelected: Boolean,
|
||||
|
||||
|
@ -41,7 +41,7 @@ open class FinTsClientResponse(
|
|||
|
||||
|
||||
open fun toResponse(): Response {
|
||||
return Response(this.isSuccessful)
|
||||
return Response(this.successful)
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ open class FinTsClientResponse(
|
|||
return "Error: Job version is not supported. Supported versions are $supportedVersions"
|
||||
}
|
||||
|
||||
return "isSuccessful = $isSuccessful"
|
||||
return "successful = $successful"
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@ open class GetTransactionsResponse(
|
|||
open var isSettingMaxCountEntriesAllowedByBank: Boolean? = null
|
||||
) : FinTsClientResponse(response) {
|
||||
|
||||
override val isSuccessful: Boolean
|
||||
get() = super.isSuccessful && retrievedData.isNotEmpty() && retrievedData.none { it.successfullyRetrievedData == false }
|
||||
override val successful: Boolean
|
||||
get() = super.successful && retrievedData.isNotEmpty() && retrievedData.none { it.successfullyRetrievedData == false }
|
||||
|
||||
}
|
|
@ -133,7 +133,7 @@ open class AddAccountDialog : DialogFragment() {
|
|||
|
||||
protected open fun handleAccountCheckResponseOnUiThread(response: AddAccountResponse) {
|
||||
context?.let { context ->
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
this.dismiss()
|
||||
|
||||
showMessageForSuccessfullyAddedAccount(context, response)
|
||||
|
|
|
@ -230,7 +230,7 @@ open class EnterTanDialog : DialogFragment() {
|
|||
}
|
||||
|
||||
protected open fun handleChangeTanMediumResponseOnUiThread(context: Context, newUsedTanMedium: TanMedium, response: BankingClientResponse) {
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
AlertDialog.Builder(context)
|
||||
.setMessage(context.getString(R.string.dialog_enter_tan_tan_medium_successfully_changed, newUsedTanMedium.displayName))
|
||||
.setPositiveButton(android.R.string.ok) { dialog, _ ->
|
||||
|
|
|
@ -41,7 +41,6 @@ import net.dankito.utils.android.extensions.asActivity
|
|||
import net.dankito.utils.android.extensions.getDimension
|
||||
import java.math.BigDecimal
|
||||
import java.text.DecimalFormatSymbols
|
||||
import java.text.NumberFormat
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.concurrent.schedule
|
||||
|
@ -316,7 +315,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
|||
protected open fun handleTransferMoneyResultOnUiThread(transferData: TransferMoneyData, response: BankingClientResponse) {
|
||||
context?.let { context ->
|
||||
if (response.userCancelledAction == false) {
|
||||
val message = if (response.isSuccessful) {
|
||||
val message = if (response.successful) {
|
||||
context.getString(R.string.dialog_transfer_money_message_transfer_successful,
|
||||
String.format("%.02f", transferData.amount), "€", transferData.creditorName) // TODO: where to get currency from?
|
||||
}
|
||||
|
@ -333,7 +332,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
|||
.show()
|
||||
}
|
||||
|
||||
if (response.isSuccessful || response.userCancelledAction) { // do not close dialog if an error occurred
|
||||
if (response.successful || response.userCancelledAction) { // do not close dialog if an error occurred
|
||||
this.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window(
|
|||
protected open fun handleAddAccountResultOnUiThread(response: AddAccountResponse) {
|
||||
checkCredentialsButton.resetIsProcessing()
|
||||
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
handleSuccessfullyAddedAccountResultOnUiThread(response)
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -369,7 +369,7 @@ open class TransferMoneyDialog @JvmOverloads constructor(
|
|||
protected open fun handleTransferMoneyResultOnUiThread(bankAccount: TypedBankAccount, transferData: TransferMoneyData, response: BankingClientResponse) {
|
||||
val currency = bankAccount.currency
|
||||
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
dialogService.showInfoMessage(String.format(messages["transfer.money.dialog.message.transfer.cash.success"],
|
||||
transferData.amount, currency, transferData.creditorName), null, currentStage)
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ open class TransferMoneyDialog @JvmOverloads constructor(
|
|||
transferData.amount, currency, transferData.creditorName, response.errorToShowToUser), null, null, currentStage)
|
||||
}
|
||||
|
||||
if (response.isSuccessful || response.userCancelledAction) { // do not close dialog if an error occurred
|
||||
if (response.successful || response.userCancelledAction) { // do not close dialog if an error occurred
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ open class EnterTanDialog(
|
|||
}
|
||||
|
||||
protected open fun handleChangeTanMediumResponseOnUiThread(newUsedTanMedium: TanMedium, response: BankingClientResponse) {
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
dialogService.showInfoMessageOnUiThread(String.format(messages["enter.tan.dialog.tan.medium.successfully.changed"],
|
||||
newUsedTanMedium.displayName), null, currentStage)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.dankito.banking.ui.model.responses
|
||||
|
||||
import net.dankito.banking.ui.model.*
|
||||
import net.dankito.utils.multiplatform.BigDecimal
|
||||
|
||||
|
||||
open class AddAccountResponse(
|
||||
|
@ -14,8 +13,8 @@ open class AddAccountResponse(
|
|||
constructor(customer: TypedCustomer, errorToShowToUser: String?) : this(customer, listOf(), errorToShowToUser)
|
||||
|
||||
|
||||
override val isSuccessful: Boolean
|
||||
get() = super.isSuccessful && customer.accounts.isNotEmpty()
|
||||
override val successful: Boolean
|
||||
get() = super.successful && customer.accounts.isNotEmpty()
|
||||
|
||||
open val supportsRetrievingTransactionsOfLast90DaysWithoutTan: Boolean
|
||||
get() = retrievedData.isNotEmpty() && retrievedData.any { it.successfullyRetrievedData }
|
||||
|
|
|
@ -2,14 +2,14 @@ package net.dankito.banking.ui.model.responses
|
|||
|
||||
|
||||
open class BankingClientResponse(
|
||||
open val isSuccessful: Boolean,
|
||||
open val successful: Boolean,
|
||||
open val errorToShowToUser: String?,
|
||||
open val userCancelledAction: Boolean = false // TODO: not implemented in hbci4jBankingClient yet
|
||||
) {
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return if (isSuccessful) {
|
||||
return if (successful) {
|
||||
"Successful"
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -18,7 +18,7 @@ open class GetTransactionsResponse(
|
|||
constructor(retrievedData: List<RetrievedAccountData>) : this(retrievedData, null)
|
||||
|
||||
|
||||
override val isSuccessful: Boolean
|
||||
override val successful: Boolean
|
||||
get() = errorToShowToUser == null && retrievedData.isNotEmpty() && retrievedData.none { it.successfullyRetrievedData == false }
|
||||
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ open class BankingPresenter(
|
|||
val account = response.customer
|
||||
account.displayIndex = customers.size
|
||||
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
addClientForAccount(account, newClient)
|
||||
|
||||
selectedAccount(account)
|
||||
|
@ -333,7 +333,7 @@ open class BankingPresenter(
|
|||
}
|
||||
|
||||
protected open fun retrievedAccountTransactions(response: GetTransactionsResponse, startDate: Date, didFetchAllTransactions: Boolean) {
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
response.retrievedData.forEach { retrievedData ->
|
||||
retrievedData.account.lastRetrievedTransactionsTimestamp = startDate
|
||||
|
||||
|
@ -443,7 +443,7 @@ open class BankingPresenter(
|
|||
|
||||
getBankingClientForAccount(account.customer)?.let { client ->
|
||||
client.transferMoneyAsync(data) { response ->
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
updateBankAccountTransactionsAsync(account, true) { }
|
||||
}
|
||||
|
||||
|
|
|
@ -164,11 +164,13 @@ struct AccountTransactionsDialog: View {
|
|||
presenter.updateSelectedBankAccountTransactionsAsync { response in
|
||||
executingDone()
|
||||
|
||||
if response.isSuccessful {
|
||||
if response.successful {
|
||||
self.filterTransactions(self.searchText)
|
||||
}
|
||||
else if response.userCancelledAction == false {
|
||||
self.errorMessage = Message(title: Text("Could not fetch latest transactions"), message: Text("Could not fetch latest transactions for \(response.bankAccount.displayName). Error message from your bank: \(response.errorToShowToUser ?? "")."))
|
||||
if let failedAccount = getAccountThatFailed(response) {
|
||||
self.errorMessage = Message(title: Text("Could not fetch latest transactions"), message: Text("Could not fetch latest transactions for \(failedAccount.displayName). Error message from your bank: \(response.errorToShowToUser ?? "")."))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,11 +186,13 @@ struct AccountTransactionsDialog: View {
|
|||
self.haveAllTransactionsBeenFetched = self.accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty
|
||||
self.showFetchAllTransactionsOverlay = shouldShowFetchAllTransactionsOverlay
|
||||
|
||||
if response.isSuccessful {
|
||||
if response.successful {
|
||||
self.filterTransactions(self.searchText)
|
||||
}
|
||||
else if response.userCancelledAction == false {
|
||||
self.errorMessage = Message(title: Text("Could not fetch all transactions"), message: Text("Could not fetch all transactions for \(response.bankAccount.displayName). Error message from your bank: \(response.errorToShowToUser ?? "")."))
|
||||
if let failedAccount = getAccountThatFailed(response) {
|
||||
self.errorMessage = Message(title: Text("Could not fetch all transactions"), message: Text("Could not fetch all transactions for \(failedAccount.displayName). Error message from your bank: \(response.errorToShowToUser ?? "")."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +202,10 @@ struct AccountTransactionsDialog: View {
|
|||
self.balanceOfFilteredTransactions = query.isBlank ? balanceOfAllTransactions : filteredTransactions.sumAmounts()
|
||||
}
|
||||
|
||||
private func getAccountThatFailed(_ response: GetTransactionsResponse) -> IBankAccount? {
|
||||
return response.retrievedData.first { $0.successfullyRetrievedData == false }?.account
|
||||
}
|
||||
|
||||
|
||||
private func doNotShowFetchAllTransactionsOverlayAnymore() {
|
||||
for account in accountsForWhichNotAllTransactionsHaveBeenFetched {
|
||||
|
|
|
@ -94,7 +94,7 @@ struct AddAccountDialog: View {
|
|||
func handleAddAccountResponse(_ response: AddAccountResponse) {
|
||||
isTryingToAddAccount = false
|
||||
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
DispatchQueue.main.async { // dispatch async as may EnterTanDialog is still displayed so dismiss() won't dismiss this view
|
||||
self.closeDialog()
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ struct EnterTanDialog: View {
|
|||
}
|
||||
|
||||
private func handleChangeTanMediumResponse(_ newTanMedium: TanMedium, _ changeTanMediumResponse: BankingClientResponse) {
|
||||
if (changeTanMediumResponse.isSuccessful) {
|
||||
if (changeTanMediumResponse.successful) {
|
||||
self.errorMessage = Message(title: Text("TAN medium change"), message: Text("TAN medium successfully changed to \(newTanMedium.displayName)."))
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -402,7 +402,7 @@ struct TransferMoneyDialog: View {
|
|||
private func handleTransferMoneyResponse(_ data: TransferMoneyData, _ response: BankingClientResponse) {
|
||||
isTransferringMoney = false
|
||||
|
||||
if (response.isSuccessful) {
|
||||
if (response.successful) {
|
||||
self.transferMoneyResponseMessage = Message(message: Text("Successfully transferred \(data.amount) \("€") to \(data.creditorName)."), primaryButton: .ok {
|
||||
self.presentation.wrappedValue.dismiss()
|
||||
})
|
||||
|
|
|
@ -153,7 +153,7 @@ open class fints4kBankingClient(
|
|||
}
|
||||
else if (didTryToGetAccountDataFromBank == false) { // then try to get account data by fetching data from bank
|
||||
addAccountAsync { response ->
|
||||
didTryToGetAccountDataFromBank = !!! response.isSuccessful
|
||||
didTryToGetAccountDataFromBank = !!! response.successful
|
||||
|
||||
findAccountResult(mapper.findAccountForBankAccount(bank, bankAccount),
|
||||
response.errorToShowToUser)
|
||||
|
|
|
@ -25,7 +25,7 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
|
|||
|
||||
|
||||
open fun mapResponse(response: FinTsClientResponse): BankingClientResponse {
|
||||
return BankingClientResponse(response.isSuccessful, mapErrorToShowToUser(response), response.userCancelledAction)
|
||||
return BankingClientResponse(response.successful, mapErrorToShowToUser(response), response.userCancelledAction)
|
||||
}
|
||||
|
||||
open fun mapResponse(customer: TypedCustomer, response: net.dankito.banking.fints.response.client.AddAccountResponse): AddAccountResponse {
|
||||
|
|
Loading…
Reference in New Issue