Fixed Postbank DE import 2023

This commit is contained in:
Rick Falkvinge
2023-09-06 19:22:41 +02:00
parent f1c5a9eea2
commit d73cc256c7
3 changed files with 27 additions and 6 deletions
+24 -4
View File
@@ -1,12 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Swarmops.Common.Enums; using Swarmops.Common.Enums;
using Swarmops.Logic.Cache;
using Swarmops.Logic.Financial; using Swarmops.Logic.Financial;
using Swarmops.Logic.Swarm; using Swarmops.Logic.Swarm;
using Swarmops.Logic.Structure; using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Support.BackendServices; using Swarmops.Logic.Support.BackendServices;
@@ -25,10 +28,27 @@ namespace Swarmops.DebugConsole
Person testPerson = Person.FromIdentity(1); Person testPerson = Person.FromIdentity(1);
testPerson.GetSecureAvatarLink(64); // suppress "is never used" warning testPerson.GetSecureAvatarLink(64); // suppress "is never used" warning
Organization organization = Organization.FromIdentity(7); Organization organization = Organization.FromIdentity(8);
// Debug debug: Try to load a CSV file for import
Person currentUser = testPerson;
FinancialAccount account = FinancialAccount.FromIdentity(150);
Currency accountCurrency = account.ForeignCurrency;
Currency presentationCurrency = organization.Currency;
ExternalBankData externalData = new ExternalBankData();
externalData.Profile = account.ExternalBankDataProfile;
using (StreamReader reader = new StreamReader(@"E:\Bank Files\debug.csv", externalData.Profile.Encoding == "UTF8" ? Encoding.UTF8 : Encoding.GetEncoding(1252)))
{
externalData.LoadData(reader, organization, accountCurrency);
}
// TODO: // TODO:
/*
// 0) Check ForeignCurrency of hotwallet account // 0) Check ForeignCurrency of hotwallet account
FinancialAccount hotWallet = organization.FinancialAccounts.AssetsBitcoinHot; FinancialAccount hotWallet = organization.FinancialAccounts.AssetsBitcoinHot;
@@ -57,7 +77,7 @@ namespace Swarmops.DebugConsole
// 0.5) Re-register the initial Sandbox Echo address // 0.5) Re-register the initial Sandbox Echo address
/*
HotBitcoinAddress.Create(organization, BitcoinChain.Cash, HotBitcoinAddress.Create(organization, BitcoinChain.Cash,
BitcoinUtility.BitcoinEchoTestIndex, 1);*/ BitcoinUtility.BitcoinEchoTestIndex, 1);*/
@@ -173,7 +193,7 @@ namespace Swarmops.DebugConsole
} }
} }
} }
}*/ }
// 2½ - TODO) Shapeshift all Core into Cash // 2½ - TODO) Shapeshift all Core into Cash
@@ -184,7 +204,7 @@ namespace Swarmops.DebugConsole
// 3) Adjust balances of foreign cents on hotwallet // 3) Adjust balances of foreign cents on hotwallet
// 4) Adjust value of hotwallet // 4) Adjust value of hotwallet
*/
} }
} }
} }
+2 -1
View File
@@ -88,6 +88,7 @@ namespace Swarmops.Logic.Financial
{ {
if (fieldName == ExternalBankDataFieldName.IgnoreLines) if (fieldName == ExternalBankDataFieldName.IgnoreLines)
{ {
fieldNameLookup[ExternalBankDataFieldName.IgnoreLines] = -1;
continue; // ignore continue; // ignore
} }
@@ -103,7 +104,7 @@ namespace Swarmops.Logic.Financial
if (!fieldNameLookup.ContainsKey(fieldName)) // wasn't found if (!fieldNameLookup.ContainsKey(fieldName)) // wasn't found
{ {
throw new InvalidOperationException("Field key \"" + fieldName + throw new InvalidOperationException("Field key \"" + fieldName +
"\" was not supplied or found in data file"); "\" was not supplied or found in data file: line was " + fieldKeyLine);
} }
} }
+1 -1
View File
@@ -157,7 +157,7 @@ namespace Swarmops.Logic.Financial
result.Name = "DE Postbank"; result.Name = "DE Postbank";
result.Country = Country.FromCode("DE"); result.Country = Country.FromCode("DE");
result.Culture = "de-DE"; result.Culture = "de-DE";
result.IgnoreInitialLines = 7; result.IgnoreInitialLines = 6;
result.InitialReplacements = ";|\t| €||Referenz NOTPROVIDED Verwendungszweck|"; result.InitialReplacements = ";|\t| €||Referenz NOTPROVIDED Verwendungszweck|";
// Field names updated 2023-Sep-06 // Field names updated 2023-Sep-06