Exemplo n.º 1
0
        public string GetTransactionsFromApi(string fromDate, string toDate)
        {
            TransactionFilter transactionFilter = new TransactionFilter()
            {
                FromServiceDate = fromDate, ToServiceDate = toDate
            };
            TransactionFieldsToReturn transactionFieldsToReturn = new TransactionFieldsToReturn();
            GetTransactionsResp       response = null;

            GetTransactionsReq request = new GetTransactionsReq()
            {
                RequestHeader = _requestHeader,
                Filter        = transactionFilter,
                Fields        = transactionFieldsToReturn
            };

            response = _kareoServices.GetTransactions(request);
            if (response.ErrorResponse.IsError)
            {
                return(response.ErrorResponse.ErrorMessage);
            }
            if (response.Transactions == null || response.Transactions.Length == 0)
            {
                return("No results.  Check Customer Key is valid in .config file.");
            }

            List <TransactionData> responseData = response.Transactions.ToList();

            string fileName = @"\Transactions_" + fromDate + "_" + toDate + ".xls";

            return(ExportTransactions(responseData, fileName));
        }
Exemplo n.º 2
0
        public void QueryTransaction_Rapidv40_Test()
        {
            if (GetVersion() > 31)
            {
                var client = CreateRapidApiClient();
                //Arrange
                var transaction = TestUtil.CreateTransaction();

                //Act
                var response = client.Create(PaymentMethod.Direct, transaction);
                var filter   = new TransactionFilter()
                {
                    TransactionID = response.TransactionStatus.TransactionID
                };
                var queryResponse  = client.QueryTransaction(filter);
                var queryResponse2 = client.QueryTransaction(response.TransactionStatus.TransactionID);
                //Assert
                Assert.IsNotNull(queryResponse);
                Assert.IsNotNull(queryResponse2);
                Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse.TransactionStatus.TransactionID);
                Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse2.TransactionStatus.TransactionID);
                Assert.AreEqual(response.TransactionStatus.Total, queryResponse2.TransactionStatus.Total);

                Assert.AreEqual("036", queryResponse2.Transaction.CurrencyCode);
                Assert.AreEqual(response.TransactionStatus.Total, queryResponse2.Transaction.MaxRefund);
            }
            else
            {
                Assert.Inconclusive();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the filtered transactions ssynchronously.
 /// <remarks>If this method is consumed, make sure to hook to the <seealso cref="ITransactionRepository.GetTransactionsCompleted"/> event of this instance of <see cref="ITransactionRepository"/>.</remarks>
 /// <param name="filter">The instance of <see cref="TransactionFilter"/> that wraps all filter values.</param>
 /// </summary>
 void ITransactionRepository.GetTransactionsAsync(TransactionFilter filter)
 {
     QueueAsyncTask(() =>
     {
         Exception exception           = null;
         string message                = null;
         IList <Transaction> transList = null;
         try
         {
             //This treachery is for faking a web service call.
             Thread.Sleep(2000);
             transList = GetTransactions(filter);
             LogUtil.LogInfo("TransactionRepository", "ITransactionRepository.GetTransactionsAsync", "Successfully acquired the list.");
         }
         catch (Exception ex)
         {
             LogUtil.LogError("TransactionRepository", "ITransactionRepository.GetTransactionsAsync", ex);
             exception = ex;
             message   = ErrorMessages.ERR_FAILED_TO_LOAD_TRNS;
         }
         finally
         {
             if (null != _getTransactionsCompleted)
             {
                 _getTransactionsCompleted(this, new GetTransactionFinishedEventArg(exception, message, transList));
             }
         }
     });
 }
Exemplo n.º 4
0
        public void OnResourceExecuted_WithExceptionRollsback()
        {
            ActionContext           action  = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor());
            ResourceExecutedContext context = new ResourceExecutedContext(action, Array.Empty <IFilterMetadata>());
            DbContext currentContext        = TestingContext.Create();
            DbContext testingContext        = TestingContext.Create();
            Role      role = ObjectsFactory.CreateRole(0);

            context.Exception = new Exception();

            testingContext.Drop();

            TransactionFilter filter = new TransactionFilter(testingContext);

            testingContext.Add(role);
            testingContext.SaveChanges();

            Assert.Empty(currentContext.Set <Role>());
            Assert.Single(testingContext.Set <Role>());

            filter.OnResourceExecuted(context);

            Assert.Empty(currentContext.Set <Role>());
            Assert.Empty(testingContext.Set <Role>());
        }
Exemplo n.º 5
0
        /// <summary>
        /// query all nep transactions(on chain)
        /// </summary>
        /// <returns></returns>
        public async Task <object> QueryNep5Transactions(int pageIndex = 1, int limit = 100, UInt160 address = null, UInt160 asset = null, uint?blockHeight = null)
        {
            using var db = new TrackDB();
            var filter = new TransactionFilter()
            {
                BlockHeight = blockHeight,
                PageIndex   = pageIndex,
                PageSize    = limit
            };

            if (address != null)
            {
                filter.FromOrTo = new List <UInt160>()
                {
                    address
                };
            }
            if (asset != null)
            {
                filter.Contracts = new List <UInt160>()
                {
                    asset
                };
            }
            var trans  = db.QueryTransactions(filter, true);
            var result = new PageList <TransactionPreviewModel>
            {
                TotalCount = trans.TotalCount,
                PageSize   = trans.PageSize,
                PageIndex  = pageIndex,
                List       = ConvertToTransactionPreviewModel(trans.List),
            };

            return(result);
        }
Exemplo n.º 6
0
        public void GetTransactions_FilterByTag_FilteredTransactions()
        {
            var target = TestHelper.CreateClient();
            var filter = new TransactionFilter();
            filter.TagId = TestHelper.TagId;
            var actual = target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                Assert.IsTrue(t.TagNames.Contains(TestHelper.TagName));
            }

            filter.TagId = null;
            filter.TagName = TestHelper.TagName;
            actual = target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                Assert.IsTrue(t.TagNames.Contains(TestHelper.TagName));
            }
        }
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _myConsumer        = new MyConsumer(GetTask <A>());
            _transactionFilter = new TransactionFilter(GetTask <bool>(), GetTask <bool>());

            configurator.Consumer(() => _myConsumer, x => x.UseFilter(_transactionFilter));
        }
Exemplo n.º 8
0
        public void AddTransaction_Transaction_Added()
        {
            var target = TestHelper.CreateClient();
            var transaction = new Transaction()
            {
                Description = "Test transaction from BuxferSharp.FunctionalTest",
                Amount = 1,
                AccountName = TestHelper.AccountName,
                Date = DateTime.Now.AddYears(1)
            };

            var actual = target.AddTransaction(transaction);
            Assert.IsTrue(actual);

            var filter = new TransactionFilter()
            {
                AccountName = TestHelper.AccountName
            };
            var lastTransactions = target.GetTransactions(filter);
            var last = lastTransactions.Entities.First();

            Assert.AreEqual(transaction.Description, last.Description);
            Assert.AreEqual(transaction.Amount, last.Amount);
            Assert.AreEqual(transaction.AccountName, last.AccountName);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Gets the transactions.
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 private IList <Transaction> GetTransactions(TransactionFilter filter)
 {
     if (filter == null)
     {
         throw new ArgumentNullException("filter");
     }
     using (var session = SessionProvider.SessionFactory.OpenSession())
     {
         //Build the criteria.
         ICriteria criteria = session.CreateCriteria <Transaction>();
         if (filter.FromDate.HasValue && filter.ToDate.HasValue)
         {
             criteria.Add(Restrictions.Between("TransactionDate", filter.FromDate.Value, filter.ToDate.Value));
         }
         if (filter.FromAmount.HasValue && filter.ToAmount.HasValue)
         {
             criteria.Add(Restrictions.Between("Amount", filter.FromAmount.Value, filter.ToAmount.Value));
         }
         if (!string.IsNullOrEmpty(filter.Username))
         {
             criteria.Add(Restrictions.Eq("CreatedBy", filter.Username));
         }
         return(criteria.List <Transaction>());
     }
 }
Exemplo n.º 10
0
 public IActionResult Get([FromQuery] TransactionFilter parameters = null)
 {
     try
     {
         var model = repository.GetByFilter(parameters).Select(a => new
         {
             a.PurchaseId,
             a.ReceiptNum,
             a.DateTimeOut,
             a.VehicleNum,
             a.SupplierName,
             a.RawMaterialDesc,
             a.RawMaterialDescPOType,
             a.PONum,
             a.POType,
             a.GrossWt,
             a.TareWt,
             a.NetWt,
             a.MC,
             a.SourceCategoryDesc,
             a.DriverName,
             a.WeigherOutName,
         });
         return(Ok(model));
     }
     catch (Exception ex)
     {
         logger.LogError(ex.GetExceptionMessages());
         return(StatusCode(StatusCodes.Status500InternalServerError, Constants.ErrorMessages.FetchError));
     }
 }
 public void Test_AddTransactionFilter_After_Dispose()
 {
     using var context = new DdeContext();
     IDdeTransactionFilter filter = new TransactionFilter();
     context.Dispose();
     Assert.Throws<ObjectDisposedException>(() => context.AddTransactionFilter(filter));
 }
Exemplo n.º 12
0
        private async Task <List <TransactionDayGroup> > ListTransactionDayGroup(TransactionDayGroupFilter filter)
        {
            // Khoi tao List chua ket qua
            List <TransactionDayGroup> result = new List <TransactionDayGroup>();

            // Lay het ngay trong thang filter ra
            List <DateTime> dates = GetDates(filter.Year, filter.Month);

            // Trong moi ngay ma co Transaction thi tao 1 TransactionDayGroup
            foreach (DateTime date in dates)
            {
                // Tao filter theo tung ngay trong thang
                TransactionFilter transactionFilter = new TransactionFilter
                {
                    Date = new DateTimeFilter {
                        Equal = date
                    },
                    WalletName = new StringFilter {
                        Equal = filter.WalletName
                    },
                    UserId = new GuidFilter {
                        Equal = filter.UserId
                    }
                };

                // List transactions trong ngay hom do
                List <Transaction> transactions = await List(transactionFilter);

                // Neu ngay hom do co transactions thi tao 1 TransactionDayGroup moi
                if (transactions != null)
                {
                    if (transactions.Count > 0)
                    {
                        decimal inflow  = 0;
                        decimal outflow = 0;
                        transactions.ForEach(t =>
                        {
                            if (t.Amount < 0)
                            {
                                outflow += t.Amount;
                            }
                            else
                            {
                                inflow += t.Amount;
                            }
                        });
                        result.Add(new TransactionDayGroup
                        {
                            Date         = date,
                            Transactions = transactions,
                            Inflow       = inflow,
                            Outflow      = outflow
                        });
                    }
                }
            }

            // Tra ket qua
            return(result);
        }
Exemplo n.º 13
0
        public async Task <TransactionResponse> GetTransactions(TransactionFilter filter)
        {
            var income = await _incomeService.FilterAsync(filter);

            var expense = await _expenseService.FilterAsync(filter);

            var adjustment = await _adjustmentService.FilterAsync(filter);

            return(new TransactionResponse
            {
                Adjustment = new TransactionCollection <BalanceAdjustment>
                {
                    Items = adjustment.records,
                    TotalCount = adjustment.count
                },
                Expense = new TransactionCollection <Expense>
                {
                    Items = expense.records,
                    TotalCount = expense.count
                },
                Income = new TransactionCollection <Income>
                {
                    Items = income.records,
                    TotalCount = income.count
                }
            });
        }
Exemplo n.º 14
0
        public async Task AddLegacy_Transaction_Transaction_Added()
        {
            var target      = TestClientFactory.BuildClient(out var settings);
            var transaction = new Transaction
            {
                Description = "Test transaction from BuxferSharp.FunctionalTest",
                Amount      = 1,
                AccountName = settings.AccountName,
                Date        = DateTime.Now.AddYears(1)
            };

            var actual = await target.AddTransactionAsSms(transaction);

            Assert.IsTrue(actual);

            var filter = new TransactionFilter
            {
                AccountName = settings.AccountName
            };
            var lastTransactions = await target.GetTransactions(filter);

            var last = lastTransactions.Entities.First();

            Assert.AreEqual(transaction.Description, last.Description);
            Assert.AreEqual(transaction.Amount, last.Amount);
            Assert.AreEqual(transaction.AccountName, last.AccountName);
        }
        public async Task <int> Count(TransactionFilter filter)
        {
            IQueryable <TransactionDAO> transactions = wASContext.Transaction;

            transactions = DynamicFilter(transactions, filter);
            return(await transactions.CountAsync());
        }
Exemplo n.º 16
0
        public QueryTransactionResponse QueryTransaction(TransactionFilter filter)
        {
            if (!filter.IsValid)
            {
                return(SdkInternalErrorsResponse <QueryTransactionResponse>());
            }

            var response = new TransactionSearchResponse();

            if (filter.IsValidTransactionID)
            {
                response = _rapidService.QueryTransaction(filter.TransactionID);
            }
            else if (filter.IsValidAccessCode)
            {
                response = _rapidService.QueryTransaction(filter.AccessCode);
            }
            else if (filter.IsValidInvoiceRef)
            {
                response = _rapidService.QueryInvoiceRef(filter.InvoiceReference);
            }
            else if (filter.IsValidInvoiceNum)
            {
                response = _rapidService.QueryInvoiceNumber(filter.InvoiceNumber);
            }

            return(_mappingService.Map <TransactionSearchResponse, QueryTransactionResponse>(response));
        }
        public async Task Run()
        {
            var blockchainProxyService = new BlockchainProxyService("https://rinkeby.infura.io/v3/25e7b6dfc51040b3bfc0e47317d38f60");
            var transactionHandler     = new SimpleTransactionHandler();
            var handlers = new HandlerContainer {
                TransactionHandler = transactionHandler
            };

            //only tx sent to this address
            var transactionFilter = TransactionFilter.To("0xc0e15e11306334258d61fee52a22d15e6c9c59e0");

            var filter = new FilterContainer(transactionFilter);

            var blockProcessor = BlockProcessorFactory.Create(
                blockchainProxyService,
                handlers,
                filter,
                processTransactionsInParallel: false);

            var processingStrategy  = new ProcessingStrategy(blockProcessor);
            var blockchainProcessor = new BlockchainProcessor(processingStrategy);

            var result = await blockchainProcessor.ExecuteAsync(2830143, 2830153);

            Assert.True(result);
            Assert.Equal(12, transactionHandler.TransactionsHandled.Count);
            Assert.Empty(transactionHandler.ContractCreationTransactionsHandled);
        }
Exemplo n.º 18
0
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
        public async Task <IActionResult> TransactionDetailsByBundle(string hash, TransactionFilter filter)
#pragma warning restore CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
        {
            if (!CommonHelpers.IsValidHash(hash))
            {
                return(BadRequest("Incorect format of the bundle hash")); //return 400 error
            }

            HashSet <TransactionContainer> res;

            try
            {
                res = await _repository.GetDetailedTransactionsByBundle(hash);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Error occured in " + nameof(TransactionDetailsByBundle));
                return(StatusCode(504)); //returns 504
            }

            List <TransactionContainer> sorted;

            if (filter == TransactionFilter.All)
            { // all transactions
                sorted = (from i in res orderby i.Transaction.Timestamp descending select i).ToList();
            }
            else
            { // only confirmed
                sorted = (from i in res where (bool)i.IsConfirmed orderby i.Transaction.Timestamp descending select i).ToList();
            }
            return(Json(sorted));
        }
Exemplo n.º 19
0
        public async Task GetTransactions_FilterByTag_FilteredTransactions()
        {
            var target = TestClientFactory.BuildClient(out var settings);
            var filter = new TransactionFilter();

            filter.TagId = settings.TagId;
            var actual = await target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                Assert.IsTrue(t.TagNames.Contains(settings.TagName));
            }

            filter.TagId   = null;
            filter.TagName = settings.TagName;
            actual         = await target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                Assert.IsTrue(t.TagNames.Contains(settings.TagName));
            }
        }
Exemplo n.º 20
0
        public async Task Run()
        {
            var web3 = new Web3.Web3(TestConfiguration.BlockchainUrls.Infura.Rinkeby);
            var transactionHandler = new SimpleTransactionHandler();
            var handlers           = new HandlerContainer {
                TransactionHandler = transactionHandler
            };

            //only tx sent to this address
            var transactionFilter = TransactionFilter.To("0xc0e15e11306334258d61fee52a22d15e6c9c59e0");

            var filter = new FilterContainer(transactionFilter);

            var blockProcessor = BlockProcessorFactory.Create(
                web3,
                handlers,
                filter,
                processTransactionsInParallel: false);

            var processingStrategy  = new ProcessingStrategy(blockProcessor);
            var blockchainProcessor = new BlockchainProcessor(processingStrategy);

            var result = await blockchainProcessor.ExecuteAsync(2830143, 2830153);

            Assert.True(result);
            Assert.Equal(12, transactionHandler.TransactionsHandled.Count);
            Assert.Empty(transactionHandler.ContractCreationTransactionsHandled);
        }
 public void Test_RemoveTransactionFilter()
 {
     using var context = new DdeContext();
     var filter = new TransactionFilter();
     context.AddTransactionFilter(filter);
     context.RemoveTransactionFilter(filter);
 }
 private static void ApplyFilter(OrderItemSpecification specification, TransactionFilter filter)
 {
     if (filter.From.HasValue)
     {
         specification.Where(transaction => transaction.CreationDate.Date >= filter.From.Value.Date);
     }
     if (filter.To.HasValue)
     {
         specification.Where(transaction => transaction.CreationDate <= filter.To.Value.Date);
     }
     if (filter.paymentMethod.HasValue)
     {
         specification.Where(orderItem => orderItem.Transactions
                             .Any(Transaction =>
                                  Transaction.PaymentMethod.Type == filter.paymentMethod));
     }
     if (filter.Status.HasValue)
     {
         specification.Where(orderItem => orderItem.Transactions
                             .Any(Transaction =>
                                  filter.Status == TransactionStatus.All ||
                                  Transaction.Status == filter.Status));
     }
     if (!string.IsNullOrEmpty(filter.Patient))
     {
         filter.Patient = filter.Patient.Trim();
         specification.Where(orderItem =>
                             orderItem.Patient.FirstName == filter.Patient ||
                             orderItem.Patient.LastName == filter.Patient ||
                             orderItem.Patient.Email == filter.Patient);
     }
 }
Exemplo n.º 23
0
        public void QueryTransaction_ByInvoiceRef_Test()
        {
            var client = CreateRapidApiClient();
            //Arrange
            var transaction      = TestUtil.CreateTransaction();
            var r                = new Random();
            var randomInvoiceRef = r.Next(100000, 999999);

            transaction.PaymentDetails.InvoiceReference = randomInvoiceRef.ToString();
            //Act
            var response = client.Create(PaymentMethod.Direct, transaction);
            var filter   = new TransactionFilter()
            {
                InvoiceReference = response.Transaction.PaymentDetails.InvoiceReference
            };
            var queryResponse  = client.QueryTransaction(filter);
            var queryResponse2 = client.QueryInvoiceRef(response.Transaction.PaymentDetails.InvoiceReference);

            //Assert
            Assert.IsNotNull(queryResponse);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse.TransactionStatus.TransactionID);
            Assert.IsNotNull(queryResponse2);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse2.TransactionStatus.TransactionID);
            TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
                                                                      queryResponse.Transaction.Customer);
            TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
                                                                      queryResponse2.Transaction.Customer);
        }
Exemplo n.º 24
0
        public void QueryTransaction_ByTransactionId_Test()
        {
            var client = CreateRapidApiClient();
            //Arrange
            var transaction = TestUtil.CreateTransaction();

            //Act
            var response = client.Create(PaymentMethod.Direct, transaction);
            var filter   = new TransactionFilter()
            {
                TransactionID = response.TransactionStatus.TransactionID
            };
            var queryResponse  = client.QueryTransaction(filter);
            var queryResponse2 = client.QueryTransaction(response.TransactionStatus.TransactionID);

            //Assert
            Assert.IsNotNull(queryResponse);
            Assert.IsNotNull(queryResponse2);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse.TransactionStatus.TransactionID);
            Assert.AreEqual(response.TransactionStatus.TransactionID, queryResponse2.TransactionStatus.TransactionID);
            Assert.AreEqual(response.TransactionStatus.Total, queryResponse2.TransactionStatus.Total);
            //TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
            //    queryResponse.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAllFieldsAreEqual(response.Transaction.Customer,
            //    queryResponse.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAddressAreEqual(response.Transaction.Customer,
            //    queryResponse2.Transaction.Customer);
            //TestUtil.AssertReturnedCustomerData_VerifyAllFieldsAreEqual(response.Transaction.Customer,
            //    queryResponse2.Transaction.Customer);
        }
Exemplo n.º 25
0
        public RecurringBatchTransactionViewModel GetTransactionViewWithPaging(TransactionFilter filter)
        {
            try
            {
                var batchReport = batchReportRepository.GetSingle(filter.BatchId);

                var transactionViewModel = new RecurringBatchTransactionViewModel
                {
                    AgreementNumber             = batchReport.MerchantAgreementNumber,
                    BatchStatus                 = batchReport.BatchStatus,
                    DbaName                     = batchReport.DbaName,
                    MerchantAssignedBatchNumber = batchReport.MerchantAssignedBatchNumber,
                    MerchantName                = batchReport.MerchantName,
                    MerchantNationalId          = batchReport.AuxiliaryField02,
                    ProcessingEndTime           = batchReport.ProcessingEndTime,
                    ProcessingStartTime         = batchReport.ProcessingStartTime,
                    BatchId                     = filter.BatchId
                };

                var transactionReports = transactionReportRepository.GetPagedTransactionList(filter);
                foreach (var transactionReport in transactionReports.Transactions)
                {
                    var transactionDataViewModel = new RecurringBatchTransactionDataViewModel
                    {
                        ReferenceNumber             = transactionReport.ReferenceNumber,
                        TransId                     = transactionReport.TransId,
                        AuthorizationCode           = transactionReport.AuthCode,
                        CardNumber                  = transactionReport.AuxiliaryField05,
                        Amount                      = transactionReport.Amount,
                        TransactionId               = transactionReport.Id,
                        VirtualAccountNumber        = transactionReport.ReceivedVirtualAccount,
                        UpdatedVirtualAccountNumber = transactionReport.UpdatedVirtualAccount
                    };
                    if (transactionReport.UpdatedVirtualAccount != guid.Empty)
                    {
                        transactionDataViewModel.NewCardNumber =
                            virtualNumberApiAccess.Get6Plus4CardForVirtualNumber(transactionReport.UpdatedVirtualAccount);
                    }

                    transactionViewModel.Transactions.Add(transactionDataViewModel);
                }
                transactionViewModel.TransactionFilter = filter;
                transactionViewModel.Pagination        = new PaginationViewModel
                {
                    CurrentPage           = transactionReports.CurrentPage,
                    IsNextPage            = transactionReports.IsNextPage,
                    IsPreviousPage        = transactionReports.IsPreviousPage,
                    TotalCount            = transactionReports.TotalCount,
                    TotalPages            = transactionReports.TotalPages,
                    PaginationFunctionUrl = "RecurringBatchTransaction/GetPage"
                };
                return(transactionViewModel);
            }
            catch (Exception exception)
            {
                //logger.LogError("Unexpected error occurred when filtering and mapping RecurringBatch", exception);
                return(null);
            }
        }
Exemplo n.º 26
0
 public IEnumerable <GetActiveContractsResponse> GetActiveContractsSync(
     TransactionFilter transactionFilter,
     bool verbose              = true,
     string accessToken        = null,
     TraceContext traceContext = null)
 {
     return(GetActiveContractsImpl(transactionFilter, verbose, accessToken, traceContext).ToListAsync().Result);
 }
Exemplo n.º 27
0
 public void Test_AddTransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         IDdeTransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
     }
 }
Exemplo n.º 28
0
 public void Test_AddTransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         IDdeTransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
     }
 }
Exemplo n.º 29
0
 public IAsyncEnumerator <GetActiveContractsResponse> GetActiveContracts(
     TransactionFilter transactionFilter,
     bool verbose              = true,
     string accessToken        = null,
     TraceContext traceContext = null)
 {
     return(GetActiveContractsImpl(transactionFilter, verbose, accessToken, traceContext).ReadAllAsync().GetAsyncEnumerator());
 }
Exemplo n.º 30
0
        public async Task TransactionFilter_ToOrEmpty_When_Address_Is_Different_Returns_False()
        {
            var tx = new Transaction {
                To = Address2
            };
            var filter = TransactionFilter.ToOrEmpty(Address1);

            Assert.False(await filter.IsMatchAsync(tx));
        }
Exemplo n.º 31
0
        public async Task TransactionFilter_FromAndTo_Reports_Matches()
        {
            var tx = new Transaction {
                From = Address1, To = Address2
            };
            var filter = TransactionFilter.FromAndTo(Address1, Address2);

            Assert.True(await filter.IsMatchAsync(tx));
        }
Exemplo n.º 32
0
        public async Task TransactionFilter_FromAndTo_Reports_Non_Matches(string from, string to)
        {
            var tx1 = new Transaction {
                From = from, To = to
            };
            var filter = TransactionFilter.FromAndTo(Address1, Address2);

            Assert.False(await filter.IsMatchAsync(tx1));
        }
Exemplo n.º 33
0
        public async Task TransactionFilter_To_Reports_Matches()
        {
            var tx = new Transaction {
                To = Address1
            };
            var filter = TransactionFilter.To(Address1);

            Assert.True(await filter.IsMatchAsync(tx));
        }
Exemplo n.º 34
0
        public void GetTransactions_FilterByDate_FilteredTransactions()
        {
            var target = TestHelper.CreateClient();
            var filter = new TransactionFilter();
            filter.StartDate = DateTime.UtcNow.AddDays(-20);
            filter.EndDate = DateTime.UtcNow.AddDays(-10);
            var actual = target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                Assert.IsTrue(t.Date >= filter.StartDate.Value);
                Assert.IsTrue(t.Date <= filter.EndDate.Value);
            }
        }
Exemplo n.º 35
0
        public void GetTransactions_FilterByString_FilteredTransactions()
        {
            var target = TestHelper.CreateClient();
            var filter = new TransactionFilter();
            filter.AccountName = TestHelper.AccountName;
            var actual = target.GetTransactions(filter);

            Assert.AreNotEqual(0, actual.TotalCount);

            foreach (var t in actual.Entities)
            {
                if (t.Type != TransactionType.Transfer)
                {
                    Assert.AreEqual(TestHelper.AccountName, t.AccountName);
                }
            }
        }
Exemplo n.º 36
0
        public void GetTransactions_Page2_DiffResultPage1()
        {
            var target = TestHelper.CreateClient();
            var filter = new TransactionFilter();
            var actual = target.GetTransactions(filter);
            var page1FirstTransaction = actual.Entities.First();

            filter.Page = 2;
            actual = target.GetTransactions(filter);
            var page2FirstTransaction = actual.Entities.First();

            Assert.AreNotEqual(page1FirstTransaction.Id, page2FirstTransaction.Id);
        }
Exemplo n.º 37
0
 public void Test_RemoveTransactionFilter_After_Dispose()
 {
     using (DdeContext context = new DdeContext())
     {
         TransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
         context.Dispose();
         context.RemoveTransactionFilter(filter);
     }
 }
Exemplo n.º 38
0
 public void Test_TransactionFilter()
 {
     using (DdeContext context = new DdeContext())
     {
         TransactionFilter filter = new TransactionFilter();
         context.AddTransactionFilter(filter);
         context.Initialize();
         using (DdeServer server = new TestServer(ServiceName))
         {
             server.Register();
         }
         Assert.IsTrue(filter.Received.WaitOne(Timeout, false));
     }
 }