Пример #1
0
 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");
         }
     });
 }
Пример #2
0
        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));
        }
Пример #3
0
        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;
                    }
                }
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
 public void OnTaskStatusUpdated(ImportTaskStatus status)
 {
     TransactionImportTracer.Trace(importTask.Settings.PayerId, $"Task status was updated to {status.GetStringRepresentation()}");
 }
Пример #6
0
 public void OnTaskFinished()
 {
     TransactionImportTracer.Trace(importTask.Settings.PayerId, "Import task has been finished");
 }
Пример #7
0
 public void OnTaskFailed()
 {
     TransactionImportTracer.Trace(importTask.Settings.PayerId, "Task has been failed.");
 }
Пример #8
0
 public void OnRebuildStart()
 {
     TransactionImportTracer.Trace(importTask.Settings.PayerId, "Cleaning up old data...");
 }
Пример #9
0
 public void OnImportStart()
 {
     TransactionImportTracer.Trace(importTask.Settings.PayerId, "Import task has been started.");
 }