diff --git a/Logic/Financial/ExternalBankDataRecord.cs b/Logic/Financial/ExternalBankDataRecord.cs index 1585d30b..30cf4238 100644 --- a/Logic/Financial/ExternalBankDataRecord.cs +++ b/Logic/Financial/ExternalBankDataRecord.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; +using Swarmops.Logic.Security; namespace Swarmops.Logic.Financial { @@ -26,5 +28,37 @@ namespace Swarmops.Logic.Financial } #endregion + + public string ImportHash + { + get + { + string importKey = string.Empty; + + if (!string.IsNullOrEmpty(UniqueId)) + { + importKey = UniqueId; + } + else if (!string.IsNullOrEmpty(NotUniqueId)) + { + string commentKey = Description.ToLowerInvariant(); + + string hashKey = NotUniqueId + commentKey + (TransactionNetCents / 100.0).ToString(CultureInfo.InvariantCulture) + (AccountBalanceCents / 100.0).ToString(CultureInfo.InvariantCulture) + + DateTime.ToString("yyyy-MM-dd-00-00-00"); + + // the 00-00-00 used to be hh-mm-ss but is replaced this way for backward hash compatibility + // maybe replace cleanly at a certain year to include seconds in hash or so + + importKey = SHA1.Hash(hashKey).Replace(" ", ""); + } + + if (importKey.Length > 30) + { + importKey = importKey.Substring(0, 30); + } + + return importKey; + } + } } } diff --git a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs index e57360bc..9599e69f 100644 --- a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs +++ b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs @@ -245,6 +245,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers newMismatch.MasterTransactionCount = masterTransactionCount; newMismatch.SwarmopsDeltaCents = swarmopsDeltaCents; newMismatch.SwarmopsTransactionCount = 0; // TODO + + // Load transactions from both sources + + // Analyze actions + mismatchList.Add(newMismatch); }