Added more fields for Fio; custom date format

This commit is contained in:
Rick Falkvinge
2018-04-28 17:08:22 +02:00
parent 0db94b5848
commit f76d9dce61
3 changed files with 55 additions and 1 deletions
+51 -1
View File
@@ -155,6 +155,48 @@ namespace Swarmops.Logic.Financial
}
}
// Check if there's counterparty information
if (fieldNameLookup.ContainsKey(ExternalBankDataFieldName.CounterpartyName))
{
string counterpartyName =
StripQuotes(lineFields[fieldNameLookup[ExternalBankDataFieldName.CounterpartyName]]);
if (newRecord.Description != counterpartyName)
{
newRecord.CounterpartyName = counterpartyName;
}
}
if (fieldNameLookup.ContainsKey(ExternalBankDataFieldName.CounterpartyBank))
{
string counterpartyBank =
StripQuotes(lineFields[fieldNameLookup[ExternalBankDataFieldName.CounterpartyBank]]);
if (!string.IsNullOrEmpty(counterpartyBank))
{
newRecord.CounterpartyBankAccount = counterpartyBank;
}
}
if (fieldNameLookup.ContainsKey(ExternalBankDataFieldName.CounterpartyAccount))
{
string counterpartyAccount =
StripQuotes(lineFields[fieldNameLookup[ExternalBankDataFieldName.CounterpartyAccount]]);
if (!string.IsNullOrEmpty(counterpartyAccount))
{
if (!string.IsNullOrEmpty(newRecord.CounterpartyBankAccount))
{
newRecord.CounterpartyBankAccount += "|";
}
newRecord.CounterpartyBankAccount += counterpartyAccount;
}
}
if (fieldNameLookup.ContainsKey (ExternalBankDataFieldName.AccountBalance))
{
// Dividing up to step-by-step statements instead of one long statement assists debugging
@@ -184,7 +226,15 @@ namespace Swarmops.Logic.Financial
if (fieldNameLookup.ContainsKey (ExternalBankDataFieldName.Date))
{
string dateString = StripQuotes (lineFields[fieldNameLookup[ExternalBankDataFieldName.Date]]);
dateTime = DateTime.Parse (dateString, new CultureInfo (Profile.Culture));
if (!String.IsNullOrEmpty(Profile.DateTimeCustomFormatString))
{
dateTime = DateTime.ParseExact(dateString, Profile.DateTimeCustomFormatString, new CultureInfo(Profile.Culture));
}
else
{
dateTime = DateTime.Parse(dateString, new CultureInfo(Profile.Culture));
}
if (fieldNameLookup.ContainsKey (ExternalBankDataFieldName.Time))
{
@@ -90,6 +90,7 @@ namespace Swarmops.Logic.Financial
public string InitialReplacements { get; set; }
public int ExternalBankDataProfileId { get; set; }
public char FieldDelimiter { get; set; }
public string DateTimeCustomFormatString { get; set; }
public int Identity { get { return ExternalBankDataProfileId; } }
public Dictionary<ExternalBankDataFieldName, string> FieldNames { get; private set; }
@@ -199,6 +200,7 @@ namespace Swarmops.Logic.Financial
result.LatestTransactionLocation = LatestTransactionLocation.Bottom;
result.FeeSignage = FeeSignage.Unknown; // no inline fees
result.Precision = ExternalBankDateTimePrecision.Day;
result.DateTimeFormatString = "dd.MM.yyyy";
result.BankDataAccountReader = StockBankDataReaders.CommaSeparatedValuesAccountReader;
result.BankDataPaymentsReader = null; // No aggregated payments with Postbank
@@ -10,6 +10,8 @@ namespace Swarmops.Logic.Financial
public long AccountBalanceCents;
public DateTime DateTime; // UTC!
public string Description;
public string CounterpartyName;
public string CounterpartyBankAccount;
public long FeeCents;
public string NotUniqueId;