From 02731cb286fe2a0dc04c53f34806088666963fd1 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 6 Sep 2023 15:53:11 +0200 Subject: [PATCH] Update Postbank format --- Logic/Financial/ExternalBankData.cs | 14 ++++++++++++ Logic/Financial/ExternalBankDataProfile.cs | 26 +++++++++------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs index d5e1ddee..b6f98060 100644 --- a/Logic/Financial/ExternalBankData.cs +++ b/Logic/Financial/ExternalBankData.cs @@ -86,6 +86,11 @@ namespace Swarmops.Logic.Financial foreach (ExternalBankDataFieldName fieldName in Profile.FieldNames.Keys) { + if (fieldName == ExternalBankDataFieldName.IgnoreLines) + { + continue; // ignore + } + for (int index = 0; index < dataKeyFields.Length; index++) { if (StripQuotes(dataKeyFields[index]).Trim().ToLowerInvariant() == Profile.FieldNames[fieldName].ToLowerInvariant()) @@ -118,6 +123,15 @@ namespace Swarmops.Logic.Financial string[] lineFields = line.Split('\t'); + if (fieldNameLookup.ContainsKey(ExternalBankDataFieldName.IgnoreLines)) + { + if (lineFields[0].ToLowerInvariant() == + Profile.FieldNames[ExternalBankDataFieldName.IgnoreLines].ToLowerInvariant()) + { + continue; + } + } + // If wrong currency, ignore if (fieldNameLookup.ContainsKey(ExternalBankDataFieldName.Currency)) diff --git a/Logic/Financial/ExternalBankDataProfile.cs b/Logic/Financial/ExternalBankDataProfile.cs index abd7394b..52cd099a 100644 --- a/Logic/Financial/ExternalBankDataProfile.cs +++ b/Logic/Financial/ExternalBankDataProfile.cs @@ -108,15 +108,6 @@ namespace Swarmops.Logic.Financial result.Country = Country.FromCode ("SE"); result.Culture = "sv-SE"; - // Old names; changed some time 2023 - /* - result.FieldNames[ExternalBankDataFieldName.Date] = "Bokföringsdatum"; - result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Text/mottagare"; - result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Belopp"; - result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo"; - result.FieldNames[ExternalBankDataFieldName.NotUniqueId] = "Verifikationsnummer"; - */ - // New field names entered 2023-Sep-06 result.FieldNames[ExternalBankDataFieldName.Date] = "Bokförd"; @@ -169,11 +160,15 @@ namespace Swarmops.Logic.Financial result.IgnoreInitialLines = 8; // increased by one in Postbank-DE "new" interface 2019 result.InitialReplacements = ";|\t| €||Referenz NOTPROVIDED Verwendungszweck|"; - result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungsdatum"; - result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Buchungsdetails"; - result.FieldNames[ExternalBankDataFieldName.DescriptionSecondary] = "Umsatzart"; - result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag (€)"; - result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo (€)"; + // Field names updated 2023-Sep-06 + + result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungstag"; + result.FieldNames[ExternalBankDataFieldName.DescriptionPrimary] = "Begünstiger / Auftraggeber"; + result.FieldNames[ExternalBankDataFieldName.DescriptionSecondary] = "Verwendungszweck"; + result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag"; + //result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo (€)"; # this field was removed by the bank + + result.FieldNames[ExternalBankDataFieldName.IgnoreLines] = "Kontostand"; // This is the last line that's out of format because of course it is result.LatestTransactionLocation = LatestTransactionLocation.Top; result.FeeSignage = FeeSignage.Unknown; // no inline fees @@ -243,7 +238,8 @@ namespace Swarmops.Logic.Financial Time, DateTime, TimeZone, - Currency + Currency, + IgnoreLines } public enum LatestTransactionLocation