diff --git a/Sources/SwiftBeanCountWealthsimpleMapper/LedgerLookup.swift b/Sources/SwiftBeanCountWealthsimpleMapper/LedgerLookup.swift index fb7be60..7fadcc1 100644 --- a/Sources/SwiftBeanCountWealthsimpleMapper/LedgerLookup.swift +++ b/Sources/SwiftBeanCountWealthsimpleMapper/LedgerLookup.swift @@ -99,8 +99,13 @@ struct LedgerLookup { key = MetaDataKeys.rounding } guard let name = ledger.accounts.first(where: { accountTypes.contains($0.name.accountType) && $0.metaData[key]?.contains(account.number) ?? false })?.name else { - if case .transactionType(.paymentSpend) = type { - return WealthsimpleLedgerMapper.fallbackExpenseAccountName + if case let .transactionType(transactionType) = type { + switch transactionType { + case .onlineBillPayment, .deposit, .paymentSpend, .transferIn, .transferOut, .paymentTransferIn, .paymentTransferOut, .withdrawal: + return WealthsimpleLedgerMapper.fallbackExpenseAccountName + default: + throw WealthsimpleConversionError.missingAccount(key, account.number, accountTypes.map { $0.rawValue }.joined(separator: ", or ")) + } } throw WealthsimpleConversionError.missingAccount(key, account.number, accountTypes.map { $0.rawValue }.joined(separator: ", or ")) } diff --git a/Sources/SwiftBeanCountWealthsimpleMapper/WealthsimpleLedgerMapper.swift b/Sources/SwiftBeanCountWealthsimpleMapper/WealthsimpleLedgerMapper.swift index 865ca43..c54b958 100644 --- a/Sources/SwiftBeanCountWealthsimpleMapper/WealthsimpleLedgerMapper.swift +++ b/Sources/SwiftBeanCountWealthsimpleMapper/WealthsimpleLedgerMapper.swift @@ -19,7 +19,7 @@ public struct WealthsimpleLedgerMapper { // swiftlint:disable:this type_body_len /// Fallback account for payments if not account with the correct meta data could be found /// - /// Only used for transaction type payment spend + /// Only used for certain transaction types public static let fallbackExpenseAccountName = try! AccountName("Expenses:TODO") // swiftlint:disable:this force_try /// Payee used for fee transactions