public void Execute(TransactionImportContext context) { context.Transactions.ForEach(transaction => { var result = analysisManager.TryAttachToCategory(transaction); if (result) { TransactionImportTracer.Trace(context.Request.PayerId, $"Transaction with id {transaction.Id} will be automaticaly assigned to category"); } }); }
public void Execute(TransactionImportContext context) { var notValidTransaction = context.Transactions.Where(i => !i.PayerId.Equals(context.Request.PayerId)).ToList(); if (notValidTransaction.Count() > 0) { TransactionImportTracer.Trace(context.Request.PayerId, $"There are {notValidTransaction.Count()} invalid transactions:"); notValidTransaction.ForEach(transaction => { TransactionImportTracer.Trace(context.Request.PayerId, $"PayerId: {transaction.PayerId} | Price: {transaction.Price} | 007.org Id: {transaction.ExternalId}"); }); } context.Transactions.RemoveAll(t => notValidTransaction.Select(tr => tr.Id).Contains(t.Id)); }
public void Execute(TransactionImportContext context) { var groupedTransactions = context.Transactions.GroupBy(item => item.Keywords); foreach (var group in groupedTransactions) { if (group.Count() > 1) { TransactionImportTracer.Trace(context.Request.PayerId, $"{group.Count()} transactions will be grouped by the following keywords {group.Key}"); var groupId = Guid.NewGuid().ToString(); foreach (var transaction in group) { transaction.GroupId = groupId; } } } }
public void Execute(TransactionImportContext context) { var transactionRetreivingTask = Task.Run(async() => { var transactions = await transactionSource.GetAsync(new TransactionRequest() { PayerId = context.Request.PayerId, From = context.Request.StartDate, To = context.Request.EndDate, OffsetNumber = context.Request.OffsetNumber }); TransactionImportTracer.Trace(context.Request.PayerId, $"Parsed transaction count: {transactions.Count()}"); context.Transactions = transactions.ToList(); }); Task.WaitAll(transactionRetreivingTask); }
public void OnTaskStatusUpdated(ImportTaskStatus status) { TransactionImportTracer.Trace(importTask.Settings.PayerId, $"Task status was updated to {status.GetStringRepresentation()}"); }
public void OnTaskFinished() { TransactionImportTracer.Trace(importTask.Settings.PayerId, "Import task has been finished"); }
public void OnTaskFailed() { TransactionImportTracer.Trace(importTask.Settings.PayerId, "Task has been failed."); }
public void OnRebuildStart() { TransactionImportTracer.Trace(importTask.Settings.PayerId, "Cleaning up old data..."); }
public void OnImportStart() { TransactionImportTracer.Trace(importTask.Settings.PayerId, "Import task has been started."); }