diff --git a/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/BankInfo.kt b/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/BankInfo.kt index fe140e46..34553865 100644 --- a/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/BankInfo.kt +++ b/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/BankInfo.kt @@ -1,30 +1,25 @@ package net.dankito.banking.bankfinder -open class BankInfo( - val name: String, - val bankCode: String, - val bic: String, - val postalCode: String, - val city: String, - val checksumMethod: String, - val pinTanAddress: String?, - val pinTanVersion: String?, - val oldBankCode: String? +open class BankInfo constructor( + open val name: String, + open val bankCode: String, + open val bic: String, + open val postalCode: String, + open val city: String, + open val pinTanAddress: String?, + open val pinTanVersion: String? ) { + protected constructor() : this("", "", "", "", "", null, "") // for object deserializers - protected constructor() : this("", "", "", "", "", "", null, null, null) // for object deserializers - val supportsPinTan: Boolean + open val supportsPinTan: Boolean get() = pinTanAddress.isNullOrEmpty() == false - val supportsFinTs3_0: Boolean + open val supportsFinTs3_0: Boolean get() = pinTanVersion == "FinTS V3.0" - val isBankCodeDeleted: Boolean - get() = oldBankCode != null // TODO: this is not in all cases true, there are banks with new bank code which haven't been deleted - override fun toString(): String { return "$bankCode $name $city" diff --git a/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/DetailedBankInfo.kt b/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/DetailedBankInfo.kt new file mode 100644 index 00000000..613cb8b4 --- /dev/null +++ b/tools/BankFinder/src/commonMain/kotlin/net/dankito/banking/bankfinder/DetailedBankInfo.kt @@ -0,0 +1,22 @@ +package net.dankito.banking.bankfinder + + +open class DetailedBankInfo( + name: String, + bankCode: String, + bic: String, + postalCode: String, + city: String, + pinTanAddress: String?, + pinTanVersion: String?, + open val checksumMethod: String, + open val oldBankCode: String? +) : BankInfo(name, bankCode, bic, postalCode, city, pinTanAddress, pinTanVersion) { + + protected constructor() : this("", "", "", "", "", null, "", "", null) // for object deserializers + + + open val isBankCodeDeleted: Boolean + get() = oldBankCode != null // TODO: this is not in all cases true, there are banks with new bank code which haven't been deleted + +} \ No newline at end of file diff --git a/tools/BankFinder/src/iosMain/kotlin/net/dankito/banking/bankfinder/BankListDeserializer.kt b/tools/BankFinder/src/iosMain/kotlin/net/dankito/banking/bankfinder/BankListDeserializer.kt index 8a1f1daf..06c2bbbf 100644 --- a/tools/BankFinder/src/iosMain/kotlin/net/dankito/banking/bankfinder/BankListDeserializer.kt +++ b/tools/BankFinder/src/iosMain/kotlin/net/dankito/banking/bankfinder/BankListDeserializer.kt @@ -34,10 +34,8 @@ actual class BankListDeserializer { bankInfoDict.getStringOrEmpty("bic"), bankInfoDict.getStringOrEmpty("postalCode"), bankInfoDict.getStringOrEmpty("city"), - bankInfoDict.getStringOrEmpty("checksumMethod"), bankInfoDict.getString("pinTanAddress"), - bankInfoDict.getString("pinTanVersion"), - bankInfoDict.getString("oldBankCode") + bankInfoDict.getString("pinTanVersion") ) } diff --git a/tools/BankListCreator/src/main/kotlin/net/dankito/banking/banklistcreator/parser/DeutscheKreditwirtschaftBankListParser.kt b/tools/BankListCreator/src/main/kotlin/net/dankito/banking/banklistcreator/parser/DeutscheKreditwirtschaftBankListParser.kt index a1703e14..c620d3b7 100644 --- a/tools/BankListCreator/src/main/kotlin/net/dankito/banking/banklistcreator/parser/DeutscheKreditwirtschaftBankListParser.kt +++ b/tools/BankListCreator/src/main/kotlin/net/dankito/banking/banklistcreator/parser/DeutscheKreditwirtschaftBankListParser.kt @@ -1,8 +1,8 @@ package net.dankito.banking.banklistcreator.parser +import net.dankito.banking.bankfinder.DetailedBankInfo import net.dankito.banking.banklistcreator.parser.model.BankCodeListEntry import net.dankito.banking.banklistcreator.parser.model.ServerAddressesListEntry -import net.dankito.fints.model.BankInfo import org.docx4j.openpackaging.packages.SpreadsheetMLPackage import org.slf4j.LoggerFactory import org.xlsx4j.org.apache.poi.ss.usermodel.DataFormatter @@ -23,7 +23,7 @@ open class DeutscheKreditwirtschaftBankListParser { } - fun parse(bankListFile: File): List { + fun parse(bankListFile: File): List { val xlsxPkg = SpreadsheetMLPackage.load(bankListFile) val workbookPart = xlsxPkg.getWorkbookPart() @@ -50,7 +50,7 @@ open class DeutscheKreditwirtschaftBankListParser { } private fun mapBankCodeAndServerAddressesList(banks: List, - serverAddresses: List): List { + serverAddresses: List): List { val serverAddressesByBankCode = mutableMapOf>() serverAddresses.forEach { serverAddress -> @@ -66,19 +66,19 @@ open class DeutscheKreditwirtschaftBankListParser { } private fun mapToBankInfo(bank: BankCodeListEntry, - serverAddressesByBankCode: Map>): BankInfo { + serverAddressesByBankCode: Map>): DetailedBankInfo { val serverAddress = findServerAddress(bank, serverAddressesByBankCode) - return BankInfo( + return DetailedBankInfo( bank.bankName, bank.bankCode, bank.bic, bank.postalCode, bank.city, - bank.checksumMethod, serverAddress?.pinTanAddress, serverAddress?.pinTanVersion, + bank.checksumMethod, bank.oldBankCode ) } diff --git a/tools/LuceneBankFinder/src/main/kotlin/net/dankito/banking/bankfinder/LuceneBankFinder.kt b/tools/LuceneBankFinder/src/main/kotlin/net/dankito/banking/bankfinder/LuceneBankFinder.kt index 6b8fae1a..2737ac73 100644 --- a/tools/LuceneBankFinder/src/main/kotlin/net/dankito/banking/bankfinder/LuceneBankFinder.kt +++ b/tools/LuceneBankFinder/src/main/kotlin/net/dankito/banking/bankfinder/LuceneBankFinder.kt @@ -31,10 +31,8 @@ open class LuceneBankFinder(indexFolder: File) : BankFinderBase(), IBankFinder { const val BankInfoCityIndexedFieldName = "city_indexed" const val BankInfoCityStoredFieldName = "city_stored" const val BankInfoPostalCodeFieldName = "postal_code" - const val BankInfoChecksumMethodFieldName = "checksum_method" const val BankInfoPinTanServerAddressFieldName = "pin_tan_server_address" const val BankInfoPinTanVersionFieldName = "pin_tan_version" - const val BankInfoOldBankCodeFieldName = "old_bank_code" val bankInfoProperties = listOf( PropertyDescription(PropertyType.String, BankInfoNameFieldName, BankInfo::name), @@ -42,10 +40,8 @@ open class LuceneBankFinder(indexFolder: File) : BankFinderBase(), IBankFinder { PropertyDescription(PropertyType.String, BankInfoBicFieldName, BankInfo::bic), PropertyDescription(PropertyType.String, BankInfoPostalCodeFieldName, BankInfo::postalCode), PropertyDescription(PropertyType.String, BankInfoCityStoredFieldName, BankInfo::city), - PropertyDescription(PropertyType.String, BankInfoChecksumMethodFieldName, BankInfo::checksumMethod), PropertyDescription(PropertyType.NullableString, BankInfoPinTanServerAddressFieldName, BankInfo::pinTanAddress), - PropertyDescription(PropertyType.NullableString, BankInfoPinTanVersionFieldName, BankInfo::pinTanVersion), - PropertyDescription(PropertyType.NullableString, BankInfoOldBankCodeFieldName, BankInfo::oldBankCode) + PropertyDescription(PropertyType.NullableString, BankInfoPinTanVersionFieldName, BankInfo::pinTanVersion) ) @@ -192,10 +188,8 @@ open class LuceneBankFinder(indexFolder: File) : BankFinderBase(), IBankFinder { fields.storedField(BankInfoCityStoredFieldName, bank.city), fields.storedField(BankInfoPostalCodeFieldName, bank.postalCode), - fields.storedField(BankInfoChecksumMethodFieldName, bank.checksumMethod), fields.nullableStoredField(BankInfoPinTanServerAddressFieldName, bank.pinTanAddress), - fields.nullableStoredField(BankInfoPinTanVersionFieldName, bank.pinTanVersion), - fields.nullableStoredField(BankInfoOldBankCodeFieldName, bank.oldBankCode) + fields.nullableStoredField(BankInfoPinTanVersionFieldName, bank.pinTanVersion) ) }