diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/AccountTransaction.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/AccountTransaction.kt index 555e25de..9182dac1 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/AccountTransaction.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/AccountTransaction.kt @@ -54,17 +54,24 @@ open class AccountTransaction( } + // for object deserializers + internal constructor() : this(BankAccount(), null, "", BigDecimal.Zero, Date(), null) + + /* convenience constructors for languages not supporting default values */ + + constructor(bankAccount: BankAccount, otherPartyName: String?, unparsedUsage: String, amount: BigDecimal, valueDate: Date, bookingText: String?) + : this(bankAccount, amount, "EUR", unparsedUsage, valueDate, + otherPartyName, null, null, bookingText, valueDate) + + constructor(bankAccount: BankAccount, amount: BigDecimal, currency: String, unparsedUsage: String, bookingDate: Date, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, bookingText: String?, valueDate: Date) : this(bankAccount, amount, currency, unparsedUsage, 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) + 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) + - // for object deserializers - internal constructor() : this(BankAccount(), BigDecimal.Zero, "","", Date(), null, null, null, null, Date(), 0, null, BigDecimal.Zero, BigDecimal.Zero, - null, null, null, null, null, null, null, null, null, null, null, null, null, - null, "", "", null, null, "", null) open var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId" diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt index 560065ac..1c0c31a0 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt @@ -29,7 +29,14 @@ open class BankAccount @JvmOverloads constructor( bookedAccountTransactions: List = listOf() ) { - internal constructor() : this(Customer(), "", "", null, null, "") // for object deserializers + internal constructor() : this(Customer(), null, "") // for object deserializers + + /* convenience constructors for languages not supporting default values */ + + constructor(customer: Customer, productName: String?, identifier: String) : this(customer, productName, identifier, BankAccountType.Girokonto) + + constructor(customer: Customer, productName: String?, identifier: String, type: BankAccountType = BankAccountType.Girokonto, balance: BigDecimal = BigDecimal.Zero) + : this(customer, identifier, "", null, null, "", balance, "EUR", type, productName) open var id: String = UUID.random() diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt index d77a96fb..1302007b 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt @@ -27,6 +27,11 @@ open class Customer( internal constructor() : this("", "", "", "", "", "", "") // for object deserializers + /* convenience constructors for languages not supporting default values */ + + constructor(bankCode: String, customerId: String, password: String, finTsServerAddress: String) + : this(bankCode, customerId, password, finTsServerAddress, "", "", "") + var id: String = UUID.random() diff --git a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift index ae211619..f43d8ef6 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift @@ -5,19 +5,20 @@ import BankingUiSwift let previewBanks = createPreviewBanks() func createPreviewBanks() -> [BUCCustomer] { - let bank1 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "", userId: "", iconUrl: "", accounts: []) + let bank1 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) bank1.accounts = [ - BUCBankAccount(customer: bank1, identifier: "id", accountHolderName: "Marieke Musterfrau", iban: nil, subAccountNumber: nil, customerId: "", balance: CommonBigDecimal(double: 17.0), currency: "EUR", type: .girokonto, productName: "Girokonto", accountLimit: nil, lastRetrievedTransactionsTimestamp: nil, supportsRetrievingAccountTransactions: true, supportsRetrievingBalance: true, supportsTransferringMoney: true, supportsInstantPaymentMoneyTransfer: true, bookedAccountTransactions: []), + BUCBankAccount(customer: bank1, productName: "Girokonto", identifier: "1234567890"), - BUCBankAccount(customer: bank1, identifier: "id", accountHolderName: "Marieke Musterfrau", iban: nil, subAccountNumber: nil, customerId: "", balance: CommonBigDecimal(double: 17.0), currency: "EUR", type: .festgeldkonto, productName: "Tagesgeld Minus", accountLimit: nil, lastRetrievedTransactionsTimestamp: nil, supportsRetrievingAccountTransactions: true, supportsRetrievingBalance: true, supportsTransferringMoney: true, supportsInstantPaymentMoneyTransfer: true, bookedAccountTransactions: []) + BUCBankAccount(customer: bank1, productName: "Tagesgeld Minus", identifier: "0987654321") ] - let bank2 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Kundenverarschebank", bic: "", customerName: "", userId: "", iconUrl: "", accounts: []) + + let bank2 = BUCCustomer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Kundenverarschebank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) bank2.accounts = [ - BUCBankAccount(customer: bank1, identifier: "id", accountHolderName: "Marieke Musterfrau", iban: nil, subAccountNumber: nil, customerId: "", balance: CommonBigDecimal(double: 17.0), currency: "EUR", type: .girokonto, productName: "Girokonto", accountLimit: nil, lastRetrievedTransactionsTimestamp: nil, supportsRetrievingAccountTransactions: true, supportsRetrievingBalance: true, supportsTransferringMoney: true, supportsInstantPaymentMoneyTransfer: true, bookedAccountTransactions: []) + BUCBankAccount(customer: bank2, productName: "Girokonto", identifier: "1234567890") ] return [ bank1, bank2 ] -} \ No newline at end of file +}