From bf9d40605334a3b4fc9af432b66e303c2bd15e87 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 24 Sep 2020 02:53:09 +0200 Subject: [PATCH] Renamed usage to reference, remittee to recipient and instant payment to real-time transfer --- README.md | 2 +- .../net/dankito/banking/fints/FinTsClient.kt | 4 +- .../banking/fints/messages/MessageBuilder.kt | 6 +- .../messages/segmente/id/CustomerSegmentId.kt | 2 +- .../sepa/PaymentInformationMessages.kt | 4 +- .../sepa/SepaBankTransferBase.kt | 8 +- .../banking/fints/model/AccountData.kt | 4 +- .../banking/fints/model/AccountFeature.kt | 2 +- .../banking/fints/model/AccountTransaction.kt | 20 +- .../banking/fints/model/BankTransferData.kt | 10 +- .../banking/fints/response/ResponseParser.kt | 2 +- .../segments/SepaAccountInfoParameters.kt | 6 +- .../Mt940AccountTransactionsParser.kt | 6 +- .../fints/transactions/mt940/Mt940Parser.kt | 113 +++++----- .../mt940/model/InformationToAccountOwner.kt | 8 +- .../sepa/SepaBankTransferBaseTest.kt | 20 +- .../fints/response/ResponseParserTest.kt | 4 +- .../fints/transactions/Mt940ParserTest.kt | 4 +- .../banking/fints/FinTsClientTestBase.kt | 4 +- .../net/dankito/banking/LuceneConfig.kt | 2 +- .../persistence/LuceneBankingPersistence.kt | 4 +- ...r.kt => LuceneTransactionPartySearcher.kt} | 16 +- ... => LuceneTransactionPartySearcherTest.kt} | 42 ++-- .../persistence/RoomBankingPersistence.kt | 14 +- .../persistence/dao/AccountTransactionDao.kt | 4 +- .../persistence/model/AccountTransaction.kt | 14 +- .../banking/persistence/model/BankAccount.kt | 2 +- .../persistence/model/RoomModelCreator.kt | 12 +- .../{Remittee.kt => TransactionParty.kt} | 2 +- .../mapper/EntitiesModelCreator.kt | 12 +- .../model/AccountTransactionEntity.kt | 10 +- .../persistence/model/BankAccountEntity.kt | 2 +- .../persistence/BankingPersistenceJsonTest.kt | 4 +- .../adapter/AccountTransactionAdapter.kt | 8 +- .../android/adapter/RecipientListAdapter.kt | 33 +++ .../ui/android/adapter/RemitteeListAdapter.kt | 33 --- .../adapter/presenter/RecipientPresenter.kt | 38 ++++ .../adapter/presenter/RemitteePresenter.kt | 38 ---- .../AccountTransactionViewHolder.kt | 2 +- .../adapter/viewholder/RecipientViewHolder.kt | 19 ++ .../adapter/viewholder/RemitteeViewHolder.kt | 19 -- .../banking/ui/android/di/BankingModule.kt | 9 +- .../ui/android/dialogs/TransferMoneyDialog.kt | 200 +++++++++--------- .../banking/ui/android/home/HomeFragment.kt | 9 +- .../main/res/layout/dialog_transfer_money.xml | 46 ++-- .../layout/list_item_account_transaction.xml | 6 +- ...m_remittee.xml => list_item_recipient.xml} | 14 +- ...o.xml => view_real_time_transfer_info.xml} | 8 +- .../context_menu_account_transactions.xml | 2 +- .../src/main/res/values-de/strings.xml | 12 +- .../src/main/res/values/dimens.xml | 28 +-- .../src/main/res/values/strings.xml | 20 +- .../javafx/dialogs/mainwindow/MainWindow.kt | 6 +- .../src/main/resources/Messages.properties | 16 +- .../src/main/resources/Messages_de.properties | 16 +- .../controls/AccountTransactionsTable.kt | 4 +- .../controls/AccountTransactionsView.kt | 8 +- .../cashtransfer/RecipientListCellFragment.kt | 29 +++ ...tteeViewModel.kt => RecipientViewModel.kt} | 4 +- .../cashtransfer/RemitteeListCellFragment.kt | 29 --- .../cashtransfer/TransferMoneyDialog.kt | 127 +++++------ .../banking/search/IRemitteeSearcher.kt | 8 - .../search/ITransactionPartySearcher.kt | 8 + .../banking/search/NoOpRemitteeSearcher.kt | 10 - .../search/NoOpTransactionPartySearcher.kt | 10 + .../{Remittee.kt => TransactionParty.kt} | 4 +- .../banking/ui/model/AccountTransaction.kt | 14 +- .../dankito/banking/ui/model/BankAccount.kt | 2 +- .../banking/ui/model/IAccountTransaction.kt | 22 +- .../dankito/banking/ui/model/IBankAccount.kt | 2 +- .../ui/model/mapper/DefaultModelCreator.kt | 12 +- .../banking/ui/model/mapper/IModelCreator.kt | 6 +- .../ui/model/parameters/TransferMoneyData.kt | 14 +- .../banking/ui/presenter/BankingPresenter.kt | 24 +-- .../dankito/banking/util/InputValidator.kt | 72 +++---- .../banking/util/InputValidatorTest.kt | 106 +++++----- .../dankito/banking/BankingPresenterSwift.kt | 6 +- .../BankingiOSApp.xcodeproj/project.pbxproj | 16 +- .../BankingiOSApp.xcdatamodel/contents | 8 +- .../Base.lproj/Localizable.strings | 18 +- .../BankingiOSApp/SceneDelegate.swift | 2 +- .../de.lproj/Localizable.strings | 14 +- .../BankingiOSApp/extensions/Extensions.swift | 2 +- .../CoreDataBankingPersistence.swift | 12 +- .../BankingiOSApp/persistence/Mapper.swift | 12 +- .../dialogs/BankAccountSettingsDialog.swift | 2 +- .../ui/dialogs/TransferMoneyDialog.swift | 196 ++++++++--------- ...w.swift => RealTimeTransferInfoView.swift} | 18 +- .../AccountTransactionListItem.swift | 6 +- ...ListItem.swift => RecipientListItem.swift} | 16 +- .../dankito/banking/fints4kBankingClient.kt | 2 +- .../banking/mapper/fints4kModelMapper.kt | 8 +- .../dankito/banking/hbci4jBankingClient.kt | 4 +- .../banking/util/AccountTransactionMapper.kt | 28 +-- .../dankito/banking/util/hbci4jModelMapper.kt | 2 +- 95 files changed, 921 insertions(+), 917 deletions(-) rename persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/{LuceneRemitteeSearcher.kt => LuceneTransactionPartySearcher.kt} (75%) rename persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/{LuceneRemitteeSearcherTest.kt => LuceneTransactionPartySearcherTest.kt} (83%) rename persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/{Remittee.kt => TransactionParty.kt} (90%) create mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RecipientListAdapter.kt delete mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RemitteeListAdapter.kt create mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RecipientPresenter.kt delete mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt create mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RecipientViewHolder.kt delete mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RemitteeViewHolder.kt rename ui/BankingAndroidApp/src/main/res/layout/{list_item_remittee.xml => list_item_recipient.xml} (81%) rename ui/BankingAndroidApp/src/main/res/layout/{view_instant_payment_info.xml => view_real_time_transfer_info.xml} (76%) create mode 100644 ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/RecipientListCellFragment.kt rename ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/{RemitteeViewModel.kt => RecipientViewModel.kt} (73%) delete mode 100644 ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/RemitteeListCellFragment.kt delete mode 100644 ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/search/IRemitteeSearcher.kt create mode 100644 ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/search/ITransactionPartySearcher.kt delete mode 100644 ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/search/NoOpRemitteeSearcher.kt create mode 100644 ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/search/NoOpTransactionPartySearcher.kt rename ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/search/{Remittee.kt => TransactionParty.kt} (90%) rename ui/BankingiOSApp/BankingiOSApp/ui/views/{InstantPaymentInfoView.swift => RealTimeTransferInfoView.swift} (65%) rename ui/BankingiOSApp/BankingiOSApp/ui/views/listitems/{RemitteeListItem.swift => RecipientListItem.swift} (64%) diff --git a/README.md b/README.md index 39044ded..d59de2f3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ However it's not a full implementation of FinTS standard but implements all comm ## Features - Retrieving account information, balances and turnovers (Kontoumsätze und -saldo). -- Transfer money and instant payments (SEPA Überweisungen und Echtzeitüberweisung). +- Transfer money and real-time transfers (SEPA Überweisungen und Echtzeitüberweisung). - Supports TAN methods chipTAN manual, Flickercode, QrCode and Photo (Matrix code), pushTAN, smsTAN and appTAN. ## Setup diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt index 781a1916..c60aef8b 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt @@ -400,7 +400,7 @@ open class FinTsClient( response.getFirstSegmentById(InstituteSegmentId.CreditCardTransactions)?.let { transactionsSegment -> balance = Money(transactionsSegment.balance.amount, transactionsSegment.balance.currency ?: "EUR") - bookedTransactions.addAll(transactionsSegment.transactions.map { AccountTransaction(parameter.account, it.amount, "", it.bookingDate, it.otherPartyName, null, null, "", it.valueDate) }) + bookedTransactions.addAll(transactionsSegment.transactions.map { AccountTransaction(parameter.account, it.amount, it.otherPartyName, it.bookingDate, it.otherPartyName, null, null, "", it.valueDate) }) } } @@ -1138,7 +1138,7 @@ open class FinTsClient( account.setSupportsFeature(AccountFeature.RetrieveAccountTransactions, messageBuilder.supportsGetTransactions(account)) account.setSupportsFeature(AccountFeature.RetrieveBalance, messageBuilder.supportsGetBalance(account)) account.setSupportsFeature(AccountFeature.TransferMoney, messageBuilder.supportsBankTransfer(bank, account)) - account.setSupportsFeature(AccountFeature.InstantPayment, messageBuilder.supportsSepaInstantPaymentBankTransfer(bank, account)) + account.setSupportsFeature(AccountFeature.RealTimeTransfer, messageBuilder.supportsSepaRealTimeTransfer(bank, account)) } protected open fun mapToTanMethods(tanInfo: TanInfo): List { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt index f836b92e..7c22b1d6 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt @@ -289,7 +289,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg open fun createBankTransferMessage(data: BankTransferData, account: AccountData, dialogContext: DialogContext): MessageBuilderResult { - val segmentId = if (data.instantPayment) CustomerSegmentId.SepaInstantPaymentBankTransfer else CustomerSegmentId.SepaBankTransfer + val segmentId = if (data.realTimeTransfer) CustomerSegmentId.SepaRealTimeTransfer else CustomerSegmentId.SepaBankTransfer val (result, urn) = supportsBankTransferAndSepaVersion(dialogContext.bank, account, segmentId) @@ -309,8 +309,8 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg return supportsBankTransferAndSepaVersion(bank, account, CustomerSegmentId.SepaBankTransfer).first.isJobVersionSupported } - open fun supportsSepaInstantPaymentBankTransfer(bank: BankData, account: AccountData): Boolean { - return supportsBankTransferAndSepaVersion(bank, account, CustomerSegmentId.SepaInstantPaymentBankTransfer).first.isJobVersionSupported + open fun supportsSepaRealTimeTransfer(bank: BankData, account: AccountData): Boolean { + return supportsBankTransferAndSepaVersion(bank, account, CustomerSegmentId.SepaRealTimeTransfer).first.isJobVersionSupported } protected open fun supportsBankTransferAndSepaVersion(bank: BankData, account: AccountData, segmentId: CustomerSegmentId): Pair { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/id/CustomerSegmentId.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/id/CustomerSegmentId.kt index 9169332d..216dad72 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/id/CustomerSegmentId.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/id/CustomerSegmentId.kt @@ -25,7 +25,7 @@ enum class CustomerSegmentId(override val id: String) : ISegmentId { SepaBankTransfer("HKCCS"), - SepaInstantPaymentBankTransfer("HKIPZ"), + SepaRealTimeTransfer("HKIPZ"), SepaAccountInfoParameters("HKSPA") // not implemented, retrieved automatically with UPD diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/PaymentInformationMessages.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/PaymentInformationMessages.kt index 8dfdec84..a160d3e3 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/PaymentInformationMessages.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/PaymentInformationMessages.kt @@ -3,8 +3,8 @@ package net.dankito.banking.fints.messages.segmente.implementierte.sepa enum class PaymentInformationMessages(val xmlTemplate: String) { - Pain_001_001_03("\$MessageId\$\$CreationDateTime\$\$NumberOfTransactions\$\$Amount\$\$DebitorName\$\$PaymentInformationId\$TRF\$NumberOfTransactions\$\$Amount\$SEPA\$RequestedExecutionDate\$\$DebitorName\$\$DebitorIban\$\$DebitorBic\$SLEVNOTPROVIDED\$Amount\$\$CreditorBic\$\$CreditorName\$\$CreditorIban\$\$Usage\$"), + Pain_001_001_03("\$MessageId\$\$CreationDateTime\$\$NumberOfTransactions\$\$Amount\$\$DebitorName\$\$PaymentInformationId\$TRF\$NumberOfTransactions\$\$Amount\$SEPA\$RequestedExecutionDate\$\$DebitorName\$\$DebitorIban\$\$DebitorBic\$SLEVNOTPROVIDED\$Amount\$\$RecipientBic\$\$RecipientName\$\$RecipientIban\$\$Reference\$"), - Pain_001_003_03("\$MessageId\$\$CreationDateTime\$\$NumberOfTransactions\$\$DebitorName\$\$PaymentInformationId\$TRFtrue\$NumberOfTransactions\$\$Amount\$SEPA\$RequestedExecutionDate\$\$DebitorName\$\$DebitorIban\$\$DebitorBic\$SLEVNOTPROVIDED\$Amount\$\$CreditorBic\$\$CreditorName\$\$CreditorIban\$\$Usage\$") + Pain_001_003_03("\$MessageId\$\$CreationDateTime\$\$NumberOfTransactions\$\$DebitorName\$\$PaymentInformationId\$TRFtrue\$NumberOfTransactions\$\$Amount\$SEPA\$RequestedExecutionDate\$\$DebitorName\$\$DebitorIban\$\$DebitorBic\$SLEVNOTPROVIDED\$Amount\$\$RecipientBic\$\$RecipientName\$\$RecipientIban\$\$Reference\$") } \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt index 2a9d5068..f03cb61e 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt @@ -28,11 +28,11 @@ open class SepaBankTransferBase( "DebitorName" to messageCreator.convertDiacriticsAndReservedXmlCharacters(debitorName), "DebitorIban" to account.iban!!, "DebitorBic" to debitorBic, - "CreditorName" to messageCreator.convertDiacriticsAndReservedXmlCharacters(data.creditorName), - "CreditorIban" to data.creditorIban.replace(" ", ""), - "CreditorBic" to data.creditorBic.replace(" ", ""), + "RecipientName" to messageCreator.convertDiacriticsAndReservedXmlCharacters(data.recipientName), + "RecipientIban" to data.recipientAccountId.replace(" ", ""), + "RecipientBic" to data.recipientBankCode.replace(" ", ""), "Amount" to data.amount.amount.string.replace(',', '.'), // TODO: check if ',' or '.' should be used as decimal separator - "Usage" to if (data.usage.isEmpty()) " " else messageCreator.convertDiacriticsAndReservedXmlCharacters(data.usage), + "Reference" to if (data.reference.isEmpty()) " " else messageCreator.convertDiacriticsAndReservedXmlCharacters(data.reference), "RequestedExecutionDate" to RequestedExecutionDateValueForNotScheduledTransfers ), messageCreator diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountData.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountData.kt index ea771ce5..2fa9f981 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountData.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountData.kt @@ -44,8 +44,8 @@ open class AccountData( open val supportsTransferringMoney: Boolean get() = supportsFeature(AccountFeature.TransferMoney) - open val supportsInstantPaymentMoneyTransfer: Boolean - get() = supportsFeature(AccountFeature.InstantPayment) + open val supportsRealTimeTransfer: Boolean + get() = supportsFeature(AccountFeature.RealTimeTransfer) open fun supportsFeature(feature: AccountFeature): Boolean { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountFeature.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountFeature.kt index ef00a8ce..fd6d28b9 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountFeature.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountFeature.kt @@ -9,6 +9,6 @@ enum class AccountFeature { TransferMoney, - InstantPayment + RealTimeTransfer } \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountTransaction.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountTransaction.kt index 77984170..a3eae0fc 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountTransaction.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/AccountTransaction.kt @@ -7,7 +7,7 @@ open class AccountTransaction( val account: AccountData, val amount: Money, val isReversal: Boolean, - val unparsedUsage: String, + val unparsedReference: String, val bookingDate: Date, val otherPartyName: String?, val otherPartyBankCode: String?, @@ -26,10 +26,10 @@ open class AccountTransaction( val originatorsIdentificationCode: String?, val compensationAmount: String?, val originalAmount: String?, - val sepaUsage: String?, + val sepaReference: String?, val deviantOriginator: String?, val deviantRecipient: String?, - val usageWithNoSpecialType: String?, + val referenceWithNoSpecialType: String?, val primaNotaNumber: String?, val textKeySupplement: String?, @@ -46,20 +46,24 @@ open class AccountTransaction( // for object deserializers internal constructor() : this(AccountData(), Money(Amount.Zero, ""), "", Date(0), null, null, null, null, Date(0)) - constructor(account: AccountData, amount: Money, unparsedUsage: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, bookingText: String?, valueDate: Date) - : this(account, amount, false, unparsedUsage, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, bookingText, valueDate, + constructor(account: AccountData, amount: Money, unparsedReference: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, bookingText: String?, valueDate: Date) + : this(account, amount, false, unparsedReference, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, bookingText, valueDate, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "", "", null, null, "", null) + val reference: String + get() = sepaReference ?: unparsedReference + + override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is AccountTransaction) return false if (account != other.account) return false if (amount != other.amount) return false - if (unparsedUsage != other.unparsedUsage) return false + if (unparsedReference != other.unparsedReference) return false if (bookingDate != other.bookingDate) return false if (otherPartyName != other.otherPartyName) return false if (otherPartyBankCode != other.otherPartyBankCode) return false @@ -73,7 +77,7 @@ open class AccountTransaction( override fun hashCode(): Int { var result = account.hashCode() result = 31 * result + amount.hashCode() - result = 31 * result + unparsedUsage.hashCode() + result = 31 * result + unparsedReference.hashCode() result = 31 * result + bookingDate.hashCode() result = 31 * result + (otherPartyName?.hashCode() ?: 0) result = 31 * result + (otherPartyBankCode?.hashCode() ?: 0) @@ -85,7 +89,7 @@ open class AccountTransaction( override fun toString(): String { - return "$valueDate $amount $otherPartyName: $unparsedUsage" + return "$valueDate $amount $otherPartyName: $unparsedReference" } } \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankTransferData.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankTransferData.kt index 490c207f..5ed04200 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankTransferData.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankTransferData.kt @@ -2,10 +2,10 @@ package net.dankito.banking.fints.model open class BankTransferData( - val creditorName: String, - val creditorIban: String, - val creditorBic: String, + val recipientName: String, + val recipientAccountId: String, + val recipientBankCode: String, val amount: Money, - val usage: String, - val instantPayment: Boolean = false + val reference: String, + val realTimeTransfer: Boolean = false ) \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt index b039c7b5..275d13cd 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt @@ -306,7 +306,7 @@ open class ResponseParser( parseBoolean(parametersDataElements[1]), parseBoolean(parametersDataElements[2]), if (segmentVersion >= 2) parseBoolean(parametersDataElements[3]) else false, - if (segmentVersion >= 3) parseInt(parametersDataElements[4]) else SepaAccountInfoParameters.CountReservedUsageLengthNotSet, + if (segmentVersion >= 3) parseInt(parametersDataElements[4]) else SepaAccountInfoParameters.CountReservedReferenceLengthNotSet, parametersDataElements.subList(supportedSepaFormatsBeginIndex, parametersDataElements.size) ) } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/SepaAccountInfoParameters.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/SepaAccountInfoParameters.kt index bcf07be2..a149c851 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/SepaAccountInfoParameters.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/SepaAccountInfoParameters.kt @@ -29,7 +29,7 @@ open class SepaAccountInfoParameters( * Über diese Information legt das Kreditinstitut fest, ob bei SEPA-Zahlungsverkehrsinstrumenten die Verwendung * von strukturierten Verwendungszweckinformationen („StructuredRemittanceInformation“) erlaubt ist oder nicht. */ - val structuredUsageAllowed: Boolean, + val structuredReferenceAllowed: Boolean, /** * Kennzeichen dafür, ob die Belegung des Feldes „Maximale Anzahl Einträge“ im Kundenauftrag zugelassen ist. @@ -47,7 +47,7 @@ open class SepaAccountInfoParameters( * reserviert sind. Diese Stellen dürfen vom Kundenprodukt nicht für andere Zwecke verwendet werden. Die Anzahl * wird vom Ende des letzten SEPA-Elementes aus gezählt und darf den Wert 35 nicht überschreiten. */ - val countReservedUsageLength: Int, + val countReservedReferenceLength: Int, /** * Dieses DE beschreibt Ort, Name und Version einer SEPA pain message als URN. Die korrekte Bezeichnung des URN @@ -69,7 +69,7 @@ open class SepaAccountInfoParameters( companion object { - const val CountReservedUsageLengthNotSet = 0 + const val CountReservedReferenceLengthNotSet = 0 } } \ No newline at end of file diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/Mt940AccountTransactionsParser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/Mt940AccountTransactionsParser.kt index 96f30d6c..419fee0b 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/Mt940AccountTransactionsParser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/Mt940AccountTransactionsParser.kt @@ -51,7 +51,7 @@ open class Mt940AccountTransactionsParser( account, Money(mapAmount(transaction.statementLine), currency), transaction.statementLine.isReversal, - transaction.information?.unparsedUsage ?: "", + transaction.information?.unparsedReference ?: "", transaction.statementLine.bookingDate ?: statement.closingBalance.bookingDate, transaction.information?.otherPartyName, transaction.information?.otherPartyBankCode, @@ -70,10 +70,10 @@ open class Mt940AccountTransactionsParser( transaction.information?.originatorsIdentificationCode, transaction.information?.compensationAmount, transaction.information?.originalAmount, - transaction.information?.sepaUsage, + transaction.information?.sepaReference, transaction.information?.deviantOriginator, transaction.information?.deviantRecipient, - transaction.information?.usageWithNoSpecialType, + transaction.information?.referenceWithNoSpecialType, transaction.information?.primaNotaNumber, transaction.information?.textKeySupplement, diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt index f438d219..9a6180aa 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt @@ -56,19 +56,19 @@ open class Mt940Parser : IMt940Parser { val AmountRegex = Regex("\\d+,\\d*") - val UsageTypeRegex = Regex("[A-Z]{4}\\+") + val ReferenceTypeRegex = Regex("[A-Z]{4}\\+") - const val EndToEndReferenceUsageKey = "EREF+" - const val CustomerReferenceUsageKey = "KREF+" - const val MandateReferenceUsageKey = "MREF+" - const val CreditorIdentifierUsageKey = "CRED+" - const val OriginatorsIdentificationCodeUsageKey = "DEBT+" - const val CompensationAmountUsageKey = "COAM+" - const val OriginalAmountUsageKey = "OAMT+" - const val SepaUsageUsageKey = "SVWZ+" - const val DeviantOriginatorUsageKey = "ABWA+" - const val DeviantRecipientUsageKey = "ABWE+" + const val EndToEndReferenceKey = "EREF+" + const val CustomerReferenceKey = "KREF+" + const val MandateReferenceKey = "MREF+" + const val CreditorIdentifierKey = "CRED+" + const val OriginatorsIdentificationCodeKey = "DEBT+" + const val CompensationAmountKey = "COAM+" + const val OriginalAmountKey = "OAMT+" + const val SepaReferenceKey = "SVWZ+" + const val DeviantOriginatorKey = "ABWA+" + const val DeviantRecipientKey = "ABWE+" private val log = LoggerFactory.getLogger(Mt940Parser::class) @@ -295,7 +295,7 @@ open class Mt940Parser : IMt940Parser { try { val information = parseInformationToAccountOwner(informationToAccountOwnerString) - mapUsage(information) + mapReference(information) return information } catch (e: Exception) { @@ -310,7 +310,7 @@ open class Mt940Parser : IMt940Parser { // see Finanzdatenformate p. 209 - 215 val geschaeftsvorfallCode = informationToAccountOwnerString.substring(0, 2) // TODO: may map - val usageParts = mutableListOf() + val referenceParts = mutableListOf() val otherPartyName = StringBuilder() var otherPartyBankCode: String? = null var otherPartyAccountId: String? = null @@ -326,48 +326,48 @@ open class Mt940Parser : IMt940Parser { when (fieldCode) { 0 -> bookingText = fieldValue 10 -> primaNotaNumber = fieldValue - in 20..29 -> usageParts.add(fieldValue) + in 20..29 -> referenceParts.add(fieldValue) 30 -> otherPartyBankCode = fieldValue 31 -> otherPartyAccountId = fieldValue 32, 33 -> otherPartyName.append(fieldValue) 34 -> textKeySupplement = fieldValue - in 60..63 -> usageParts.add(fieldValue) + in 60..63 -> referenceParts.add(fieldValue) } } } - val usage = if (isFormattedUsage(usageParts)) joinUsageParts(usageParts) - else usageParts.joinToString(" ") + val reference = if (isFormattedReference(referenceParts)) joinReferenceParts(referenceParts) + else referenceParts.joinToString(" ") val otherPartyNameString = if (otherPartyName.isEmpty()) null else otherPartyName.toString() return InformationToAccountOwner( - usage, otherPartyNameString, otherPartyBankCode, otherPartyAccountId, + reference, otherPartyNameString, otherPartyBankCode, otherPartyAccountId, bookingText, primaNotaNumber, textKeySupplement ) } - protected open fun joinUsageParts(usageParts: List): String { - val usage = StringBuilder() + protected open fun joinReferenceParts(referenceParts: List): String { + val reference = StringBuilder() - usageParts.firstOrNull()?.let { - usage.append(it) + referenceParts.firstOrNull()?.let { + reference.append(it) } - for (i in 1..usageParts.size - 1) { - val part = usageParts[i] - if (part.isNotEmpty() && part.first().isUpperCase && usageParts[i - 1].last().isUpperCase == false) { - usage.append(" ") + for (i in 1..referenceParts.size - 1) { + val part = referenceParts[i] + if (part.isNotEmpty() && part.first().isUpperCase && referenceParts[i - 1].last().isUpperCase == false) { + reference.append(" ") } - usage.append(part) + reference.append(part) } - return usage.toString() + return reference.toString() } - protected open fun isFormattedUsage(usageParts: List): Boolean { - return usageParts.any { UsageTypeRegex.find(it) != null } + protected open fun isFormattedReference(referenceParts: List): Boolean { + return referenceParts.any { ReferenceTypeRegex.find(it) != null } } /** @@ -392,53 +392,54 @@ open class Mt940Parser : IMt940Parser { * * Weitere 4 Verwendungszwecke können zu den Feldschlüsseln 60 bis 63 eingestellt werden. */ - protected open fun mapUsage(information: InformationToAccountOwner) { - val usageParts = getUsageParts(information.unparsedUsage) + protected open fun mapReference(information: InformationToAccountOwner) { + val referenceParts = getReferenceParts(information.unparsedReference) - usageParts.forEach { entry -> - setUsageLineValue(information, entry.key, entry.value) + referenceParts.forEach { entry -> + setReferenceLineValue(information, entry.key, entry.value) } } - open fun getUsageParts(unparsedUsage: String): Map { + open fun getReferenceParts(unparsedReference: String): Map { var previousMatchType = "" var previousMatchEnd = 0 - val usageParts = mutableMapOf() + val referenceParts = mutableMapOf() - UsageTypeRegex.findAll(unparsedUsage).forEach { matchResult -> + ReferenceTypeRegex.findAll(unparsedReference).forEach { matchResult -> if (previousMatchEnd > 0) { - val typeValue = unparsedUsage.substring(previousMatchEnd, matchResult.range.first) + val typeValue = unparsedReference.substring(previousMatchEnd, matchResult.range.first) - usageParts[previousMatchType] = typeValue + referenceParts[previousMatchType] = typeValue } - previousMatchType = unparsedUsage.substring(matchResult.range) + previousMatchType = unparsedReference.substring(matchResult.range) previousMatchEnd = matchResult.range.last + 1 } if (previousMatchEnd > 0) { - val typeValue = unparsedUsage.substring(previousMatchEnd, unparsedUsage.length) + val typeValue = unparsedReference.substring(previousMatchEnd, unparsedReference.length) - usageParts[previousMatchType] = typeValue + referenceParts[previousMatchType] = typeValue } - return usageParts + return referenceParts } - protected open fun setUsageLineValue(information: InformationToAccountOwner, usageType: String, typeValue: String) { - when (usageType) { - EndToEndReferenceUsageKey -> information.endToEndReference = typeValue - CustomerReferenceUsageKey -> information.customerReference = typeValue - MandateReferenceUsageKey -> information.mandateReference = typeValue - CreditorIdentifierUsageKey -> information.creditorIdentifier = typeValue - OriginatorsIdentificationCodeUsageKey -> information.originatorsIdentificationCode = typeValue - CompensationAmountUsageKey -> information.compensationAmount = typeValue - OriginalAmountUsageKey -> information.originalAmount = typeValue - SepaUsageUsageKey -> information.sepaUsage = typeValue - DeviantOriginatorUsageKey -> information.deviantOriginator = typeValue - DeviantRecipientUsageKey -> information.deviantRecipient = typeValue - else -> information.usageWithNoSpecialType = typeValue + // TODO: there are more. See .pdf from Deutsche Bank + protected open fun setReferenceLineValue(information: InformationToAccountOwner, referenceType: String, typeValue: String) { + when (referenceType) { + EndToEndReferenceKey -> information.endToEndReference = typeValue + CustomerReferenceKey -> information.customerReference = typeValue + MandateReferenceKey -> information.mandateReference = typeValue + CreditorIdentifierKey -> information.creditorIdentifier = typeValue + OriginatorsIdentificationCodeKey -> information.originatorsIdentificationCode = typeValue + CompensationAmountKey -> information.compensationAmount = typeValue + OriginalAmountKey -> information.originalAmount = typeValue + SepaReferenceKey -> information.sepaReference = typeValue + DeviantOriginatorKey -> information.deviantOriginator = typeValue + DeviantRecipientKey -> information.deviantRecipient = typeValue + else -> information.referenceWithNoSpecialType = typeValue } } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/model/InformationToAccountOwner.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/model/InformationToAccountOwner.kt index a30747ce..b8fb3030 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/model/InformationToAccountOwner.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/model/InformationToAccountOwner.kt @@ -2,7 +2,7 @@ package net.dankito.banking.fints.transactions.mt940.model open class InformationToAccountOwner( - val unparsedUsage: String, + val unparsedReference: String, val otherPartyName: String?, val otherPartyBankCode: String?, val otherPartyAccountId: String?, @@ -25,17 +25,17 @@ open class InformationToAccountOwner( var originalAmount: String? = null - var sepaUsage: String? = null + var sepaReference: String? = null var deviantOriginator: String? = null var deviantRecipient: String? = null - var usageWithNoSpecialType: String? = null + var referenceWithNoSpecialType: String? = null override fun toString(): String { - return "$otherPartyName $unparsedUsage" + return "$otherPartyName $unparsedReference" } } \ No newline at end of file diff --git a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBaseTest.kt b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBaseTest.kt index fbcea089..1ffb2bcd 100644 --- a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBaseTest.kt +++ b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/messages/segmente/implementierte/sepa/SepaBankTransferBaseTest.kt @@ -15,11 +15,11 @@ class SepaBankTransferBaseTest { val debitorName = "Nelson Mandela" val debitorIban = "ZA123456780987654321" val debitorBic = "ABCDZAEFXXX" - val creditorName = "Mahatma Gandhi" - val creditorIban = "IN123456780987654321" - val creditorBic = "ABCDINEFXXX" + val recipientName = "Mahatma Gandhi" + val recipientIban = "IN123456780987654321" + val recipientBic = "ABCDINEFXXX" val amount = Amount("1234,56") - val usage = "What should Mahatma Gandhi want with money?" + val reference = "What should Mahatma Gandhi want with money?" } @@ -33,7 +33,7 @@ class SepaBankTransferBaseTest { debitorName, AccountData("", null, 0, "", debitorIban, "", null, null, "", null, null, listOf()), debitorBic, - BankTransferData(creditorName, creditorIban, creditorBic, Money(amount, "EUR"), usage) + BankTransferData(recipientName, recipientIban, recipientBic, Money(amount, "EUR"), reference) ) @@ -42,8 +42,8 @@ class SepaBankTransferBaseTest { // then - expect(result).contains(debitorName, debitorIban, debitorBic, creditorName, creditorIban, creditorBic, - amount.toString().replace(',', '.'), usage, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03") + expect(result).contains(debitorName, debitorIban, debitorBic, recipientName, recipientIban, recipientBic, + amount.toString().replace(',', '.'), reference, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03") } @Test @@ -55,7 +55,7 @@ class SepaBankTransferBaseTest { debitorName, AccountData("", null, 0, "", debitorIban, "", null, null, "", null, null, listOf()), debitorBic, - BankTransferData(creditorName, creditorIban, creditorBic, Money(amount, "EUR"), usage) + BankTransferData(recipientName, recipientIban, recipientBic, Money(amount, "EUR"), reference) ) @@ -64,8 +64,8 @@ class SepaBankTransferBaseTest { // then - expect(result).contains(debitorName, debitorIban, debitorBic, creditorName, creditorIban, creditorBic, - amount.toString().replace(',', '.'), usage, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03") + expect(result).contains(debitorName, debitorIban, debitorBic, recipientName, recipientIban, recipientBic, + amount.toString().replace(',', '.'), reference, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03") } } \ No newline at end of file diff --git a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt index 17eae53b..08719ea7 100644 --- a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt +++ b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt @@ -558,9 +558,9 @@ class ResponseParserTest : FinTsTestBase() { for (segment in sepaAccountInfoParameters) { expect(segment.retrieveSingleAccountAllowed).isTrue() expect(segment.nationalAccountRelationshipAllowed).isFalse() - expect(segment.structuredUsageAllowed).isFalse() + expect(segment.structuredReferenceAllowed).isFalse() expect(segment.settingMaxAllowedEntriesAllowed).isFalse() - expect(segment.countReservedUsageLength).toBe(SepaAccountInfoParameters.CountReservedUsageLengthNotSet) + expect(segment.countReservedReferenceLength).toBe(SepaAccountInfoParameters.CountReservedReferenceLengthNotSet) expect(segment.supportedSepaFormats).containsExactly( "sepade.pain.001.001.02.xsd", "sepade.pain.001.002.02.xsd", diff --git a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/transactions/Mt940ParserTest.kt b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/transactions/Mt940ParserTest.kt index 0f5f87ff..3513b131 100644 --- a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/transactions/Mt940ParserTest.kt +++ b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/transactions/Mt940ParserTest.kt @@ -269,9 +269,9 @@ class Mt940ParserTest : FinTsTestBase() { result.flatMap { it.transactions }.forEach { transaction -> expect(transaction.information).notToBeNull() - expect(transaction.information?.sepaUsage).notToBeNull() + expect(transaction.information?.sepaReference).notToBeNull() - if (transaction.information?.unparsedUsage?.contains("KREF+") == true) { + if (transaction.information?.unparsedReference?.contains("KREF+") == true) { expect(transaction.information?.customerReference).notToBeNull() } } diff --git a/fints4k/src/jvm6Test/kotlin/net/dankito/banking/fints/FinTsClientTestBase.kt b/fints4k/src/jvm6Test/kotlin/net/dankito/banking/fints/FinTsClientTestBase.kt index 02fd2bf7..0b01484d 100644 --- a/fints4k/src/jvm6Test/kotlin/net/dankito/banking/fints/FinTsClientTestBase.kt +++ b/fints4k/src/jvm6Test/kotlin/net/dankito/banking/fints/FinTsClientTestBase.kt @@ -44,7 +44,7 @@ open class FinTsClientTestBase { val Password = "" - val DateTimeFormatForUniqueBankTransferUsage = DateFormatter("yyyy-MM-dd'T'HH:mm:ss.SSS") + val DateTimeFormatForUniqueBankTransferReference = DateFormatter("yyyy-MM-dd'T'HH:mm:ss.SSS") } @@ -234,7 +234,7 @@ open class FinTsClientTestBase { // transfer 1 cent to yourself. Transferring money to oneself also doesn't require to enter a TAN according to PSD2 val BankTransferData = BankTransferData(Bank.customerName, account?.iban!!, Bank.bic, Money(Amount("0,01"), "EUR"), - "${DateTimeFormatForUniqueBankTransferUsage.format(Date())} Test transaction ${UUID.random()}") + "${DateTimeFormatForUniqueBankTransferReference.format(Date())} Test transaction ${UUID.random()}") // when diff --git a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/LuceneConfig.kt b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/LuceneConfig.kt index c57c3af2..d97f0f8f 100644 --- a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/LuceneConfig.kt +++ b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/LuceneConfig.kt @@ -19,7 +19,7 @@ class LuceneConfig { const val BookingDateFieldName = "booking_date" const val DateSortFieldName = "value_date_sort" - const val UsageFieldName = "usage" + const val ReferenceFieldName = "reference" const val BookingTextFieldName = "booking_text" diff --git a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/persistence/LuceneBankingPersistence.kt b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/persistence/LuceneBankingPersistence.kt index 5908fc8d..b9189937 100644 --- a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/persistence/LuceneBankingPersistence.kt +++ b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/persistence/LuceneBankingPersistence.kt @@ -13,7 +13,7 @@ import net.dankito.banking.LuceneConfig.Companion.IdFieldName import net.dankito.banking.LuceneConfig.Companion.OtherPartyAccountIdFieldName import net.dankito.banking.LuceneConfig.Companion.OtherPartyBankCodeFieldName import net.dankito.banking.LuceneConfig.Companion.OtherPartyNameFieldName -import net.dankito.banking.LuceneConfig.Companion.UsageFieldName +import net.dankito.banking.LuceneConfig.Companion.ReferenceFieldName import net.dankito.banking.ui.model.* import net.dankito.banking.util.ISerializer import net.dankito.banking.util.JacksonJsonSerializer @@ -62,7 +62,7 @@ open class LuceneBankingPersistence( return listOf( fields.keywordField(BankAccountIdFieldName, account.technicalId), fields.nullableFullTextSearchField(OtherPartyNameFieldName, transaction.otherPartyName, true), - fields.fullTextSearchField(UsageFieldName, transaction.usage, true), + fields.fullTextSearchField(ReferenceFieldName, transaction.reference, true), fields.nullableFullTextSearchField(BookingTextFieldName, transaction.bookingText, true), fields.nullableStoredField(OtherPartyBankCodeFieldName, transaction.otherPartyBankCode), diff --git a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneRemitteeSearcher.kt b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcher.kt similarity index 75% rename from persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneRemitteeSearcher.kt rename to persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcher.kt index a52d6a14..6b5105a1 100644 --- a/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneRemitteeSearcher.kt +++ b/persistence/LuceneBankingPersistence/src/main/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcher.kt @@ -12,14 +12,14 @@ import net.dankito.utils.lucene.search.Searcher import java.io.File -open class LuceneRemitteeSearcher(indexFolder: File) : IRemitteeSearcher { +open class LuceneTransactionPartySearcher(indexFolder: File) : ITransactionPartySearcher { companion object { private val properties = listOf( - PropertyDescription(PropertyType.NullableString, OtherPartyNameFieldName, Remittee::name), - PropertyDescription(PropertyType.NullableString, OtherPartyBankCodeFieldName, Remittee::bic), - PropertyDescription(PropertyType.NullableString, OtherPartyAccountIdFieldName, Remittee::iban) + PropertyDescription(PropertyType.NullableString, OtherPartyNameFieldName, TransactionParty::name), + PropertyDescription(PropertyType.NullableString, OtherPartyBankCodeFieldName, TransactionParty::bic), + PropertyDescription(PropertyType.NullableString, OtherPartyAccountIdFieldName, TransactionParty::iban) ) } @@ -30,16 +30,16 @@ open class LuceneRemitteeSearcher(indexFolder: File) : IRemitteeSearcher { protected val searcher = Searcher(LuceneConfig.getAccountTransactionsIndexFolder(indexFolder)) - override fun findRemittees(query: String): List { + override fun findTransactionParty(query: String): List { val luceneQuery = queries.createQueriesForSingleTerms(query.toLowerCase()) { singleTerm -> listOf( queries.fulltextQuery(OtherPartyNameFieldName, singleTerm) ) } - return searcher.searchAndMap(MappedSearchConfig(luceneQuery, Remittee::class.java, properties)) - .toSet() // don't display same Remittee multiple times - .filterNot { it.iban.isNullOrBlank() || it.bic.isNullOrBlank() } // e.g. comdirect doesn't supply other party's IBAN and BIC -> filter these as they have no value for auto-entering a remittee's IBAN and BIC + return searcher.searchAndMap(MappedSearchConfig(luceneQuery, TransactionParty::class.java, properties)) + .toSet() // don't display same transaction party multiple times + .filterNot { it.iban.isNullOrBlank() || it.bic.isNullOrBlank() } // e.g. comdirect doesn't supply other party's IBAN and BIC -> filter these as they have no value for auto-entering a transaction party's IBAN and BIC } } \ No newline at end of file diff --git a/persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneRemitteeSearcherTest.kt b/persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcherTest.kt similarity index 83% rename from persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneRemitteeSearcherTest.kt rename to persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcherTest.kt index fd0b5791..1c714b98 100644 --- a/persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneRemitteeSearcherTest.kt +++ b/persistence/LuceneBankingPersistence/src/test/kotlin/net/dankito/banking/search/LuceneTransactionPartySearcherTest.kt @@ -19,7 +19,7 @@ import java.util.* import java.util.concurrent.ThreadLocalRandom -class LuceneRemitteeSearcherTest { +class LuceneTransactionPartySearcherTest { companion object { @@ -49,7 +49,7 @@ class LuceneRemitteeSearcherTest { private val bankingPersistence = LuceneBankingPersistence(indexFolder, databaseFolder) - private val underTest = LuceneRemitteeSearcher(indexFolder) + private val underTest = LuceneTransactionPartySearcher(indexFolder) @Before @@ -68,12 +68,12 @@ class LuceneRemitteeSearcherTest { @Test - fun findRemittees_ByFullName() { + fun findTransactionParty_ByFullName() { // given val query = OtherPartyName - val before = underTest.findRemittees(query) + val before = underTest.findTransactionParty(query) assertThat(before).isEmpty() bankingPersistence.saveOrUpdateAccountTransactions(bankAccountMock, listOf( @@ -84,7 +84,7 @@ class LuceneRemitteeSearcherTest { // when - val result = underTest.findRemittees(query) + val result = underTest.findTransactionParty(query) // then @@ -95,12 +95,12 @@ class LuceneRemitteeSearcherTest { } @Test - fun findRemittees_ByPartialName() { + fun findTransactionParty_ByPartialName() { // given val query = "gand" - val before = underTest.findRemittees(query) + val before = underTest.findTransactionParty(query) assertThat(before).isEmpty() bankingPersistence.saveOrUpdateAccountTransactions(bankAccountMock, listOf( @@ -111,7 +111,7 @@ class LuceneRemitteeSearcherTest { // when - val result = underTest.findRemittees(query) + val result = underTest.findTransactionParty(query) // then @@ -122,13 +122,13 @@ class LuceneRemitteeSearcherTest { } @Test - fun findRemittees_SimilarNames() { + fun findTransactionParty_SimilarNames() { // given val query = "gand" val secondOtherPartyName = "Gandalf" - val before = underTest.findRemittees(query) + val before = underTest.findTransactionParty(query) assertThat(before).isEmpty() bankingPersistence.saveOrUpdateAccountTransactions(bankAccountMock, listOf( @@ -139,7 +139,7 @@ class LuceneRemitteeSearcherTest { // when - val result = underTest.findRemittees(query) + val result = underTest.findTransactionParty(query) // then @@ -148,12 +148,12 @@ class LuceneRemitteeSearcherTest { } @Test - fun findRemittees_DuplicateEntries() { + fun findTransactionParty_DuplicateEntries() { // given val query = OtherPartyName - val before = underTest.findRemittees(query) + val before = underTest.findTransactionParty(query) assertThat(before).isEmpty() bankingPersistence.saveOrUpdateAccountTransactions(bankAccountMock, listOf( @@ -166,7 +166,7 @@ class LuceneRemitteeSearcherTest { // when - val result = underTest.findRemittees(query) + val result = underTest.findTransactionParty(query) // then @@ -177,12 +177,12 @@ class LuceneRemitteeSearcherTest { } @Test - fun findRemittees_OtherName() { + fun findTransactionParty_OtherName() { // given val query = "Mandela" - val before = underTest.findRemittees(query) + val before = underTest.findTransactionParty(query) assertThat(before).isEmpty() bankingPersistence.saveOrUpdateAccountTransactions(bankAccountMock, listOf( @@ -193,7 +193,7 @@ class LuceneRemitteeSearcherTest { // when - val result = underTest.findRemittees(query) + val result = underTest.findTransactionParty(query) // then @@ -203,17 +203,17 @@ class LuceneRemitteeSearcherTest { private fun createTransaction(bankAccount: BankAccount = bankAccountMock, bookingDate: String, amount: BigDecimal = randomBigDecimal(), otherPartyName: String = randomString(), otherPartyBankCode: String = randomString(), - otherPartyAccountId: String = randomString(), usage: String = randomString()): AccountTransaction { + otherPartyAccountId: String = randomString(), reference: String = randomString()): AccountTransaction { return createTransaction(bankAccount, dateFormat.parse(bookingDate), amount, otherPartyName, - otherPartyBankCode, otherPartyAccountId, usage) + otherPartyBankCode, otherPartyAccountId, reference) } private fun createTransaction(bankAccount: BankAccount = bankAccountMock, bookingDate: Date = randomDate(), amount: BigDecimal = randomBigDecimal(), otherPartyName: String = randomString(), otherPartyBankCode: String = randomString(), - otherPartyAccountId: String = randomString(), usage: String = randomString()): AccountTransaction { + otherPartyAccountId: String = randomString(), reference: String = randomString()): AccountTransaction { - return AccountTransaction(bankAccount, amount.toBigDecimal(), "EUR", usage, bookingDate.toDate(), otherPartyName, otherPartyBankCode, otherPartyAccountId, null, bookingDate.toDate()) + return AccountTransaction(bankAccount, amount.toBigDecimal(), "EUR", reference, bookingDate.toDate(), otherPartyName, otherPartyBankCode, otherPartyAccountId, null, bookingDate.toDate()) } private fun randomString(): String { diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt index 6ba49f67..0a4229ac 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt @@ -5,8 +5,8 @@ import androidx.room.Room import net.dankito.banking.persistence.dao.BaseDao import net.dankito.banking.persistence.dao.saveOrUpdate import net.dankito.banking.persistence.model.* -import net.dankito.banking.search.IRemitteeSearcher -import net.dankito.banking.search.Remittee +import net.dankito.banking.search.ITransactionPartySearcher +import net.dankito.banking.search.TransactionParty import net.dankito.banking.ui.model.IAccountTransaction import net.dankito.banking.ui.model.TypedBankAccount import net.dankito.banking.ui.model.TypedBankData @@ -18,7 +18,7 @@ import net.sqlcipher.database.SQLiteDatabase import net.sqlcipher.database.SupportFactory -open class RoomBankingPersistence(applicationContext: Context, password: String? = null) : IBankingPersistence, IRemitteeSearcher { +open class RoomBankingPersistence(applicationContext: Context, password: String? = null) : IBankingPersistence, ITransactionPartySearcher { protected val db: BankingDatabase @@ -154,11 +154,11 @@ open class RoomBankingPersistence(applicationContext: Context, password: String? } - override fun findRemittees(query: String): List { - return db.accountTransactionDao().findRemittees(query) - .toSet() // don't display same Remittee multiple times + override fun findTransactionParty(query: String): List { + return db.accountTransactionDao().findTransactionParty(query) + .toSet() // don't display same transaction party multiple times .filterNot { it.bankCode.isNullOrBlank() || it.accountId.isNullOrBlank() } - .map { Remittee(it.name, it.accountId, it.bankCode) } + .map { TransactionParty(it.name, it.accountId, it.bankCode) } } } \ No newline at end of file diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/dao/AccountTransactionDao.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/dao/AccountTransactionDao.kt index bce96118..bbb39265 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/dao/AccountTransactionDao.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/dao/AccountTransactionDao.kt @@ -3,7 +3,7 @@ package net.dankito.banking.persistence.dao import androidx.room.Dao import androidx.room.Query import net.dankito.banking.persistence.model.AccountTransaction -import net.dankito.banking.persistence.model.Remittee +import net.dankito.banking.persistence.model.TransactionParty @Dao @@ -13,6 +13,6 @@ interface AccountTransactionDao : BaseDao { fun getAll(): List @Query("SELECT otherPartyName, otherPartyBankCode, otherPartyAccountId FROM AccountTransaction WHERE otherPartyName LIKE '%' || :query || '%'") - fun findRemittees(query: String): List + fun findTransactionParty(query: String): List } \ No newline at end of file diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AccountTransaction.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AccountTransaction.kt index 13674479..261df062 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AccountTransaction.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AccountTransaction.kt @@ -15,7 +15,7 @@ open class AccountTransaction( override var amount: BigDecimal, override var currency: String, - override var unparsedUsage: String, + override var unparsedReference: String, override var bookingDate: Date, override var otherPartyName: String?, override var otherPartyBankCode: String?, @@ -34,10 +34,10 @@ open class AccountTransaction( override var originatorsIdentificationCode: String?, override var compensationAmount: String?, override var originalAmount: String?, - override var sepaUsage: String?, + override var sepaReference: String?, override var deviantOriginator: String?, override var deviantRecipient: String?, - override var usageWithNoSpecialType: String?, + override var referenceWithNoSpecialType: String?, override var primaNotaNumber: String?, override var textKeySupplement: String?, @@ -56,15 +56,15 @@ open class AccountTransaction( /* convenience constructors for languages not supporting default values */ - constructor(account: BankAccount, otherPartyName: String?, unparsedUsage: String, amount: BigDecimal, valueDate: Date, bookingText: String?) - : this(account, amount, "EUR", unparsedUsage, valueDate, + constructor(account: BankAccount, otherPartyName: String?, unparsedReference: String, amount: BigDecimal, valueDate: Date, bookingText: String?) + : this(account, amount, "EUR", unparsedReference, valueDate, otherPartyName, null, null, bookingText, valueDate) - constructor(account: BankAccount, amount: BigDecimal, currency: String, unparsedUsage: String, bookingDate: Date, + constructor(account: BankAccount, amount: BigDecimal, currency: String, unparsedReference: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, bookingText: String?, valueDate: Date) - : this(account, amount, currency, unparsedUsage, bookingDate, + : this(account, amount, currency, unparsedReference, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, bookingText, valueDate, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "", "", null, null, "", null) diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt index 10c18dc9..a65e71a8 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt @@ -30,7 +30,7 @@ open class BankAccount( override var supportsRetrievingAccountTransactions: Boolean = false, override var supportsRetrievingBalance: Boolean = false, override var supportsTransferringMoney: Boolean = false, - override var supportsInstantPaymentMoneyTransfer: Boolean = false, + override var supportsRealTimeTransfer: Boolean = false, @Ignore override var bookedTransactions: List = listOf(), diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/RoomModelCreator.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/RoomModelCreator.kt index 79975929..d74e1999 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/RoomModelCreator.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/RoomModelCreator.kt @@ -26,7 +26,7 @@ open class RoomModelCreator : IModelCreator { account: TypedBankAccount, amount: BigDecimal, currency: String, - unparsedUsage: String, + unparsedReference: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, @@ -44,10 +44,10 @@ open class RoomModelCreator : IModelCreator { originatorsIdentificationCode: String?, compensationAmount: String?, originalAmount: String?, - sepaUsage: String?, + sepaReference: String?, deviantOriginator: String?, deviantRecipient: String?, - usageWithNoSpecialType: String?, + referenceWithNoSpecialType: String?, primaNotaNumber: String?, textKeySupplement: String?, currencyType: String?, @@ -58,10 +58,10 @@ open class RoomModelCreator : IModelCreator { transactionReferenceNumber: String, relatedReferenceNumber: String? ): IAccountTransaction { - return AccountTransaction(account as BankAccount, amount, currency, unparsedUsage, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, + return AccountTransaction(account as BankAccount, amount, currency, unparsedReference, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, bookingText, valueDate, statementNumber, sequenceNumber, openingBalance, closingBalance, endToEndReference, customerReference, mandateReference, - creditorIdentifier, originatorsIdentificationCode, compensationAmount, originalAmount, sepaUsage, deviantOriginator, deviantRecipient, - usageWithNoSpecialType, primaNotaNumber, textKeySupplement, currencyType, bookingKey, referenceForTheAccountOwner, + creditorIdentifier, originatorsIdentificationCode, compensationAmount, originalAmount, sepaReference, deviantOriginator, deviantRecipient, + referenceWithNoSpecialType, primaNotaNumber, textKeySupplement, currencyType, bookingKey, referenceForTheAccountOwner, referenceOfTheAccountServicingInstitution, supplementaryDetails, transactionReferenceNumber, relatedReferenceNumber) } diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/Remittee.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/TransactionParty.kt similarity index 90% rename from persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/Remittee.kt rename to persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/TransactionParty.kt index f3944942..7d346bbc 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/Remittee.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/TransactionParty.kt @@ -3,7 +3,7 @@ package net.dankito.banking.persistence.model import androidx.room.ColumnInfo -data class Remittee( +data class TransactionParty( @ColumnInfo(name = "otherPartyName") val name: String, @ColumnInfo(name = "otherPartyBankCode") val bankCode: String?, diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/mapper/EntitiesModelCreator.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/mapper/EntitiesModelCreator.kt index 40ea6a65..ad2f5e0a 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/mapper/EntitiesModelCreator.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/mapper/EntitiesModelCreator.kt @@ -28,7 +28,7 @@ open class EntitiesModelCreator : IModelCreator { account: TypedBankAccount, amount: BigDecimal, currency: String, - unparsedUsage: String, + unparsedReference: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, @@ -46,10 +46,10 @@ open class EntitiesModelCreator : IModelCreator { originatorsIdentificationCode: String?, compensationAmount: String?, originalAmount: String?, - sepaUsage: String?, + sepaReference: String?, deviantOriginator: String?, deviantRecipient: String?, - usageWithNoSpecialType: String?, + referenceWithNoSpecialType: String?, primaNotaNumber: String?, textKeySupplement: String?, currencyType: String?, @@ -61,11 +61,11 @@ open class EntitiesModelCreator : IModelCreator { relatedReferenceNumber: String? ) : IAccountTransaction { - return AccountTransactionEntity(account as BankAccountEntity, amount, currency, unparsedUsage, bookingDate, + return AccountTransactionEntity(account as BankAccountEntity, amount, currency, unparsedReference, bookingDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, bookingText, valueDate, statementNumber, sequenceNumber, openingBalance, closingBalance, endToEndReference, customerReference, mandateReference, creditorIdentifier, - originatorsIdentificationCode, compensationAmount, originalAmount, sepaUsage, deviantOriginator, deviantRecipient, - usageWithNoSpecialType, primaNotaNumber, textKeySupplement, currencyType, bookingKey, referenceForTheAccountOwner, + originatorsIdentificationCode, compensationAmount, originalAmount, sepaReference, deviantOriginator, deviantRecipient, + referenceWithNoSpecialType, primaNotaNumber, textKeySupplement, currencyType, bookingKey, referenceForTheAccountOwner, referenceOfTheAccountServicingInstitution, supplementaryDetails, transactionReferenceNumber, relatedReferenceNumber) } diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/AccountTransactionEntity.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/AccountTransactionEntity.kt index bb4269e2..f51ca477 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/AccountTransactionEntity.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/AccountTransactionEntity.kt @@ -14,7 +14,7 @@ open class AccountTransactionEntity( override var account: BankAccountEntity, override var amount: BigDecimal, override var currency: String, - override var unparsedUsage: String, + override var unparsedReference: String, override var bookingDate: Date, override var otherPartyName: String?, override var otherPartyBankCode: String?, @@ -33,10 +33,10 @@ open class AccountTransactionEntity( override var originatorsIdentificationCode: String?, override var compensationAmount: String?, override var originalAmount: String?, - override var sepaUsage: String?, + override var sepaReference: String?, override var deviantOriginator: String?, override var deviantRecipient: String?, - override var usageWithNoSpecialType: String?, + override var referenceWithNoSpecialType: String?, override var primaNotaNumber: String?, override var textKeySupplement: String?, @@ -56,8 +56,8 @@ open class AccountTransactionEntity( -1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "", "", null, null, "", null) - constructor(account: BankAccountEntity, otherPartyName: String?, unparsedUsage: String, amount: BigDecimal, valueDate: Date, bookingText: String?) - : this(account, amount, "EUR", unparsedUsage, valueDate, otherPartyName, null, null, bookingText, valueDate, 0, null, null, null, + constructor(account: BankAccountEntity, otherPartyName: String?, unparsedReference: String, amount: BigDecimal, valueDate: Date, bookingText: String?) + : this(account, amount, "EUR", unparsedReference, valueDate, otherPartyName, null, null, bookingText, valueDate, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "", "", null, null, "", null) diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt index 016c5b72..d275d6a5 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt @@ -27,7 +27,7 @@ open class BankAccountEntity( override var supportsRetrievingAccountTransactions: Boolean = false, override var supportsRetrievingBalance: Boolean = false, override var supportsTransferringMoney: Boolean = false, - override var supportsInstantPaymentMoneyTransfer: Boolean = false, + override var supportsRealTimeTransfer: Boolean = false, override var bookedTransactions: List = listOf(), override var unbookedTransactions: List = listOf(), override var technicalId: String = UUID.random(), diff --git a/persistence/json/BankingPersistenceJson/src/test/kotlin/net/dankito/banking/persistence/BankingPersistenceJsonTest.kt b/persistence/json/BankingPersistenceJson/src/test/kotlin/net/dankito/banking/persistence/BankingPersistenceJsonTest.kt index 564c742c..609a5daf 100644 --- a/persistence/json/BankingPersistenceJson/src/test/kotlin/net/dankito/banking/persistence/BankingPersistenceJsonTest.kt +++ b/persistence/json/BankingPersistenceJson/src/test/kotlin/net/dankito/banking/persistence/BankingPersistenceJsonTest.kt @@ -147,7 +147,7 @@ class BankingPersistenceJsonTest { } private fun createTransaction(transactionIndex: Int, account: BankAccountEntity): AccountTransactionEntity { - return AccountTransactionEntity(account, "OtherParty_$transactionIndex", "Usage_$transactionIndex", BigDecimal(transactionIndex.toDouble()), createDate(), null) + return AccountTransactionEntity(account, "OtherParty_$transactionIndex", "Reference_$transactionIndex", BigDecimal(transactionIndex.toDouble()), createDate(), null) } private fun createDate(): Date { @@ -233,7 +233,7 @@ class BankingPersistenceJsonTest { assertThat(deserializedTransaction.account.technicalId).isEqualTo(transaction.account.technicalId) assertThat(deserializedTransaction.otherPartyName).isEqualTo(transaction.otherPartyName) - assertThat(deserializedTransaction.unparsedUsage).isEqualTo(transaction.unparsedUsage) + assertThat(deserializedTransaction.unparsedReference).isEqualTo(transaction.unparsedReference) assertThat(deserializedTransaction.amount).isEqualTo(transaction.amount) assertThat(deserializedTransaction.valueDate).isEqualTo(transaction.valueDate) } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt index 9961575f..c2e0bd99 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt @@ -40,7 +40,7 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter) val label = if (item.showOtherPartyName) item.otherPartyName else item.bookingText viewHolder.txtvwTransactionLabel.text = label ?: item.bookingText ?: "" - viewHolder.txtvwUsage.text = item.usage + viewHolder.txtvwReference.text = item.reference viewHolder.txtvwAmount.showAmount(presenter, item.amount) @@ -66,12 +66,12 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter) menu.findItem(R.id.mnitmNewTransferWithSameData)?.isVisible = canCreateMoneyTransferFrom - menu.findItem(R.id.mnitmNewTransferToSameRemittee)?.let { mnitmShowTransferMoneyDialog -> + menu.findItem(R.id.mnitmNewTransferToSameTransactionParty)?.let { mnitmShowTransferMoneyDialog -> mnitmShowTransferMoneyDialog.isVisible = canCreateMoneyTransferFrom - val remitteeName = selectedTransaction?.otherPartyName ?: "" + val recipientName = selectedTransaction?.otherPartyName ?: "" - mnitmShowTransferMoneyDialog.title = view.context.getString(R.string.fragment_home_transfer_money_to, remitteeName) + mnitmShowTransferMoneyDialog.title = view.context.getString(R.string.fragment_home_transfer_money_to, recipientName) } } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RecipientListAdapter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RecipientListAdapter.kt new file mode 100644 index 00000000..ca38ab0d --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RecipientListAdapter.kt @@ -0,0 +1,33 @@ +package net.dankito.banking.ui.android.adapter + +import android.view.View +import net.dankito.banking.ui.android.R +import net.dankito.banking.ui.android.adapter.viewholder.RecipientViewHolder +import net.dankito.banking.search.TransactionParty +import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter + + +open class RecipientListAdapter(protected val itemClicked: ((TransactionParty) -> Unit)? = null) : ListRecyclerAdapter() { + + override fun getListItemLayoutId() = R.layout.list_item_recipient + + override fun createViewHolder(itemView: View): RecipientViewHolder { + return RecipientViewHolder(itemView) + } + + override fun bindItemToView(viewHolder: RecipientViewHolder, item: TransactionParty) { + viewHolder.txtvwRecipientName.text = item.name + + viewHolder.txtvwRecipientBankName.text = item.bankName + viewHolder.txtvwRecipientBankName.visibility = if (item.bankName.isNullOrBlank()) View.GONE else View.VISIBLE + + viewHolder.txtvwRecipientAccountId.text = item.iban + + viewHolder.txtvwRecipientBankCode.text = item.bic + + viewHolder.itemView.setOnClickListener { + itemClicked?.invoke(item) + } + } + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RemitteeListAdapter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RemitteeListAdapter.kt deleted file mode 100644 index abf00415..00000000 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/RemitteeListAdapter.kt +++ /dev/null @@ -1,33 +0,0 @@ -package net.dankito.banking.ui.android.adapter - -import android.view.View -import net.dankito.banking.ui.android.R -import net.dankito.banking.ui.android.adapter.viewholder.RemitteeViewHolder -import net.dankito.banking.search.Remittee -import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter - - -open class RemitteeListAdapter(protected val itemClicked: ((Remittee) -> Unit)? = null) : ListRecyclerAdapter() { - - override fun getListItemLayoutId() = R.layout.list_item_remittee - - override fun createViewHolder(itemView: View): RemitteeViewHolder { - return RemitteeViewHolder(itemView) - } - - override fun bindItemToView(viewHolder: RemitteeViewHolder, item: Remittee) { - viewHolder.txtvwRemitteeName.text = item.name - - viewHolder.txtvwRemitteeBankName.text = item.bankName - viewHolder.txtvwRemitteeBankName.visibility = if (item.bankName.isNullOrBlank()) View.GONE else View.VISIBLE - - viewHolder.txtvwRemitteeAccountId.text = item.iban - - viewHolder.txtvwRemitteeBankCode.text = item.bic - - viewHolder.itemView.setOnClickListener { - itemClicked?.invoke(item) - } - } - -} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RecipientPresenter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RecipientPresenter.kt new file mode 100644 index 00000000..cc71845c --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RecipientPresenter.kt @@ -0,0 +1,38 @@ +package net.dankito.banking.ui.android.adapter.presenter + +import android.content.Context +import androidx.recyclerview.widget.RecyclerView +import com.otaliastudios.autocomplete.RecyclerViewPresenter +import kotlinx.coroutines.* +import net.dankito.banking.ui.android.adapter.RecipientListAdapter +import net.dankito.banking.search.TransactionParty +import net.dankito.banking.ui.android.extensions.addHorizontalItemDivider +import net.dankito.banking.ui.presenter.BankingPresenter + + +open class RecipientPresenter(protected val bankingPresenter: BankingPresenter, context: Context) : RecyclerViewPresenter(context) { + + protected val adapter = RecipientListAdapter { dispatchClick(it) } + + protected var lastSearchRecipientJob: Job? = null + + + override fun instantiateAdapter(): RecyclerView.Adapter<*> { + recyclerView?.addHorizontalItemDivider() + + return adapter + } + + override fun onQuery(query: CharSequence?) { + lastSearchRecipientJob?.cancel() + + lastSearchRecipientJob = GlobalScope.launch(Dispatchers.IO) { + val potentialRecipients = bankingPresenter.findRecipientsForName(query?.toString() ?: "") + + withContext(Dispatchers.Main) { + adapter.items = potentialRecipients + } + } + } + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt deleted file mode 100644 index 8ce877f7..00000000 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt +++ /dev/null @@ -1,38 +0,0 @@ -package net.dankito.banking.ui.android.adapter.presenter - -import android.content.Context -import androidx.recyclerview.widget.RecyclerView -import com.otaliastudios.autocomplete.RecyclerViewPresenter -import kotlinx.coroutines.* -import net.dankito.banking.ui.android.adapter.RemitteeListAdapter -import net.dankito.banking.search.Remittee -import net.dankito.banking.ui.android.extensions.addHorizontalItemDivider -import net.dankito.banking.ui.presenter.BankingPresenter - - -open class RemitteePresenter(protected val bankingPresenter: BankingPresenter, context: Context) : RecyclerViewPresenter(context) { - - protected val adapter = RemitteeListAdapter { dispatchClick(it) } - - protected var lastSearchRemitteeJob: Job? = null - - - override fun instantiateAdapter(): RecyclerView.Adapter<*> { - recyclerView?.addHorizontalItemDivider() - - return adapter - } - - override fun onQuery(query: CharSequence?) { - lastSearchRemitteeJob?.cancel() - - lastSearchRemitteeJob = GlobalScope.launch(Dispatchers.IO) { - val potentialRemittees = bankingPresenter.findRemitteesForName(query?.toString() ?: "") - - withContext(Dispatchers.Main) { - adapter.items = potentialRemittees - } - } - } - -} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt index d72ffc02..d05eb757 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt @@ -13,7 +13,7 @@ open class AccountTransactionViewHolder(itemView: View) : RecyclerView.ViewHolde val txtvwTransactionLabel: TextView = itemView.txtvwTransactionLabel - val txtvwUsage: TextView = itemView.txtvwUsage + val txtvwReference: TextView = itemView.txtvwReference val txtvwAmount: TextView = itemView.txtvwAmount diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RecipientViewHolder.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RecipientViewHolder.kt new file mode 100644 index 00000000..80ad493f --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RecipientViewHolder.kt @@ -0,0 +1,19 @@ +package net.dankito.banking.ui.android.adapter.viewholder + +import android.view.View +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import kotlinx.android.synthetic.main.list_item_recipient.view.* + + +open class RecipientViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + + val txtvwRecipientName: TextView = itemView.txtvwRecipientName + + val txtvwRecipientBankName: TextView = itemView.txtvwRecipientBankName + + val txtvwRecipientAccountId: TextView = itemView.txtvwRecipientAccountId + + val txtvwRecipientBankCode: TextView = itemView.txtvwRecipientBankCode + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RemitteeViewHolder.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RemitteeViewHolder.kt deleted file mode 100644 index 6d445cfe..00000000 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/RemitteeViewHolder.kt +++ /dev/null @@ -1,19 +0,0 @@ -package net.dankito.banking.ui.android.adapter.viewholder - -import android.view.View -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import kotlinx.android.synthetic.main.list_item_remittee.view.* - - -open class RemitteeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - - val txtvwRemitteeName: TextView = itemView.txtvwRemitteeName - - val txtvwRemitteeBankName: TextView = itemView.txtvwRemitteeBankName - - val txtvwRemitteeAccountId: TextView = itemView.txtvwRemitteeAccountId - - val txtvwRemitteeBankCode: TextView = itemView.txtvwRemitteeBankCode - -} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/di/BankingModule.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/di/BankingModule.kt index 439e26e0..45a7da7d 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/di/BankingModule.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/di/BankingModule.kt @@ -9,8 +9,7 @@ import net.dankito.banking.ui.android.RouterAndroid import net.dankito.banking.ui.android.util.CurrentActivityTracker import net.dankito.banking.fints4kBankingClientCreator import net.dankito.banking.persistence.IBankingPersistence -import net.dankito.banking.search.IRemitteeSearcher -import net.dankito.banking.search.LuceneRemitteeSearcher +import net.dankito.banking.search.ITransactionPartySearcher import net.dankito.banking.ui.IBankingClientCreator import net.dankito.banking.ui.IRouter import net.dankito.banking.ui.presenter.BankingPresenter @@ -88,11 +87,11 @@ class BankingModule(private val applicationContext: Context) { @Singleton fun provideBankingPresenter(bankingClientCreator: IBankingClientCreator, bankFinder: IBankFinder, @Named(DataFolderKey) dataFolder: File, - persister: IBankingPersistence, remitteeSearcher: IRemitteeSearcher, bankIconFinder: IBankIconFinder, + persister: IBankingPersistence, transactionPartySearcher: ITransactionPartySearcher, bankIconFinder: IBankIconFinder, textExtractorRegistry: ITextExtractorRegistry, router: IRouter, invoiceDataExtractor: IInvoiceDataExtractor, modelCreator: IModelCreator, serializer: ISerializer, asyncRunner: IAsyncRunner) : BankingPresenter { return BankingPresenter(bankingClientCreator, bankFinder, dataFolder, persister, router, modelCreator, - remitteeSearcher, bankIconFinder, textExtractorRegistry, invoiceDataExtractor, serializer, asyncRunner) + transactionPartySearcher, bankIconFinder, textExtractorRegistry, invoiceDataExtractor, serializer, asyncRunner) } @Provides @@ -121,7 +120,7 @@ class BankingModule(private val applicationContext: Context) { @Provides @Singleton - fun provideRemitteeSearcher(bankingPersistence: IBankingPersistence) : IRemitteeSearcher { + fun provideTransactionPartySearcher(bankingPersistence: IBankingPersistence) : ITransactionPartySearcher { return bankingPersistence as RoomBankingPersistence } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt index 6d8e1e81..35d4abfd 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt @@ -20,13 +20,13 @@ import kotlinx.android.synthetic.main.dialog_transfer_money.view.* import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.di.BankingComponent import net.dankito.banking.ui.android.adapter.BankAccountsAdapter -import net.dankito.banking.ui.android.adapter.presenter.RemitteePresenter +import net.dankito.banking.ui.android.adapter.presenter.RecipientPresenter import net.dankito.banking.ui.android.extensions.addEnterPressedListener import net.dankito.banking.ui.android.extensions.closePopupOnBackButtonPress import net.dankito.banking.ui.android.listener.ListItemSelectedListener import net.dankito.banking.ui.android.util.StandardAutocompleteCallback import net.dankito.banking.ui.android.util.StandardTextWatcher -import net.dankito.banking.search.Remittee +import net.dankito.banking.search.TransactionParty import net.dankito.banking.ui.model.TypedBankAccount import net.dankito.banking.ui.model.parameters.TransferMoneyData import net.dankito.banking.ui.model.responses.BankingClientResponse @@ -60,16 +60,16 @@ open class TransferMoneyDialog : DialogFragment() { protected val inputValidator = InputValidator() // TODO: move to presenter - protected var remitteeBic: String? = null + protected var recipientBic: String? = null - protected var validRemitteeNameEntered = false + protected var validRecipientNameEntered = false - protected var validRemitteeIbanEntered = false + protected var validRecipientIbanEntered = false - protected var validRemitteeBicEntered = false + protected var validRecipientBicEntered = false - protected var validUsageEntered = true + protected var validReferenceEntered = true protected var validAmountEntered = false @@ -118,73 +118,73 @@ open class TransferMoneyDialog : DialogFragment() { rootView.spnBankAccounts.adapter = adapter rootView.spnBankAccounts.onItemSelectedListener = ListItemSelectedListener(adapter) { selectedBankAccount -> this.account = selectedBankAccount - setInstantPaymentControlsVisibility(rootView) + setRealTimeTransferControlsVisibility(rootView) } preselectedValues?.account?.let { rootView.spnBankAccounts.setSelection(adapter.getItems().indexOf(it)) } } - initRemitteeAutocompletion(rootView.edtxtRemitteeName) + initRecipientAutocompletion(rootView.edtxtRecipientName) - rootView.edtxtRemitteeName.addTextChangedListener(checkRequiredDataWatcher { - checkIfEnteredRemitteeNameIsValidWhileUserIsTyping() + rootView.edtxtRecipientName.addTextChangedListener(checkRequiredDataWatcher { + checkIfEnteredRecipientNameIsValidWhileUserIsTyping() }) - rootView.edtxtRemitteeIban.addTextChangedListener(StandardTextWatcher { - checkIfEnteredRemitteeIbanIsValidWhileUserIsTyping() + rootView.edtxtRecipientIban.addTextChangedListener(StandardTextWatcher { + checkIfEnteredRecipientIbanIsValidWhileUserIsTyping() tryToGetBicFromIban(it) }) rootView.edtxtAmount.addTextChangedListener(checkRequiredDataWatcher { checkIfEnteredAmountIsValid() }) - rootView.edtxtUsage.addTextChangedListener(checkRequiredDataWatcher { - checkIfEnteredUsageTextIsValid() + rootView.edtxtReference.addTextChangedListener(checkRequiredDataWatcher { + checkIfEnteredReferenceTextIsValid() }) - rootView.edtxtRemitteeName.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredRemitteeNameIsValidAfterFocusLost() } - rootView.edtxtRemitteeIban.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredRemitteeIbanIsValidAfterFocusLost() } + rootView.edtxtRecipientName.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredRecipientNameIsValidAfterFocusLost() } + rootView.edtxtRecipientIban.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredRecipientIbanIsValidAfterFocusLost() } rootView.edtxtAmount.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredAmountIsValid() } - rootView.edtxtUsage.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredUsageTextIsValid() } + rootView.edtxtReference.setOnFocusChangeListener { _, hasFocus -> if (hasFocus == false) checkIfEnteredReferenceTextIsValid() } - transferMoneyIfEnterPressed(rootView.edtxtRemitteeName) - transferMoneyIfEnterPressed(rootView.edtxtRemitteeIban) + transferMoneyIfEnterPressed(rootView.edtxtRecipientName) + transferMoneyIfEnterPressed(rootView.edtxtRecipientIban) transferMoneyIfEnterPressed(rootView.edtxtAmount) - transferMoneyIfEnterPressed(rootView.edtxtUsage) + transferMoneyIfEnterPressed(rootView.edtxtReference) // fix that even in Locales using ',' as decimal separator entering ',' is not allowed (thanks dstibbe! https://stackoverflow.com/a/34256139) val decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator() rootView.edtxtAmount.keyListener = DigitsKeyListener.getInstance("0123456789$decimalSeparator") - rootView.btnShowInstantPaymentInfo.setOnClickListener { showInstantPaymentInfo(rootView.btnShowInstantPaymentInfo, rootView) } + rootView.btnShowRealTimeTransferInfo.setOnClickListener { showRealTimeTransferInfo(rootView.btnShowRealTimeTransferInfo, rootView) } - setInstantPaymentControlsVisibility(rootView) + setRealTimeTransferControlsVisibility(rootView) rootView.btnCancel.setOnClickListener { dismiss() } rootView.btnTransferMoney.setOnClickListener { transferMoney() } - adjustCheckBoxInstantPaymentWidth() + adjustCheckBoxRealTimeTransferWidth() } - protected open fun adjustCheckBoxInstantPaymentWidth() { + protected open fun adjustCheckBoxRealTimeTransferWidth() { // wait some time till CheckBox is layout and lineCount is set val timer = Timer() - timer.schedule(10) { requireActivity().runOnUiThread { adjustCheckBoxInstantPaymentWidthOnUiThread() }} - timer.schedule(2500) { requireActivity().runOnUiThread { adjustCheckBoxInstantPaymentWidthOnUiThread() }} + timer.schedule(10) { requireActivity().runOnUiThread { adjustCheckBoxRealTimeTransferWidthOnUiThread() }} + timer.schedule(2500) { requireActivity().runOnUiThread { adjustCheckBoxRealTimeTransferWidthOnUiThread() }} } - protected open fun adjustCheckBoxInstantPaymentWidthOnUiThread() { - if (chkbxInstantPayment.isEllipsized == false) { - // by default chkbxInstantPayment uses full width, even though if its text doesn't need this space -> there - chkbxInstantPayment.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0f) - chkbxInstantPayment.requestLayout() + protected open fun adjustCheckBoxRealTimeTransferWidthOnUiThread() { + if (chkbxRealTimeTransfer.isEllipsized == false) { + // by default chkbxRealTimeTransfer uses full width, even though if its text doesn't need this space -> there + chkbxRealTimeTransfer.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0f) + chkbxRealTimeTransfer.requestLayout() } } - protected open fun setInstantPaymentControlsVisibility(rootView: View) { - rootView.lytInstantPayment.visibility = - if (account.supportsInstantPaymentMoneyTransfer) { + protected open fun setRealTimeTransferControlsVisibility(rootView: View) { + rootView.lytRealTimeTransfer.visibility = + if (account.supportsRealTimeTransfer) { View.VISIBLE } else { @@ -192,9 +192,9 @@ open class TransferMoneyDialog : DialogFragment() { } } - protected open fun showInstantPaymentInfo(btnShowInstantPaymentInfo: ImageButton, rootView: View) { - requireActivity().layoutInflater.inflate(R.layout.view_instant_payment_info, null)?.let { contentView -> - requireContext().hideKeyboard(lytInstantPayment) + protected open fun showRealTimeTransferInfo(btnShowRealTimeTransferInfo: ImageButton, rootView: View) { + requireActivity().layoutInflater.inflate(R.layout.view_real_time_transfer_info, null)?.let { contentView -> + requireContext().hideKeyboard(lytRealTimeTransfer) val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) @@ -203,9 +203,9 @@ open class TransferMoneyDialog : DialogFragment() { contentView.findViewById