public void ShouldIncreaseUserBalanceWhenDepositMoney()
        {
            var transactionService = new TransactionService();
            var bankUser = new BankUser();
            transactionService.Deposit(bankUser, 100);

            Assert.AreEqual(100,bankUser.Balance);
        }
        public void ShouldNotCalculateInterestWhenBalanceIsBelovMinimum()
        {
            var transactionService = new TransactionService();

            var interest = transactionService.CalculateInterest(100, 1000, 1,0.1m);

            Assert.AreEqual(0,interest);
        }
        public void ShouldDecreaseUserBalanceWhenWithdrawMoney()
        {
            var transactionService = new TransactionService();
            var bankUser = new BankUser(){Balance = 500};
            transactionService.Withdraw(bankUser, 100,0.02m);

            Assert.AreEqual(398, bankUser.Balance);
        }
        public void ShouldUpdateLastTransactionTimeWhenWithdrawMoney()
        {
            var transactionService = new TransactionService();
            var defaultTransactionTime = DateTime.MinValue;
            var bankUser = new BankUser() {Balance = 300, LastTransactionTime = defaultTransactionTime };
            transactionService.Withdraw(bankUser, 100,0.02m);

            Assert.IsTrue(bankUser.LastTransactionTime > defaultTransactionTime);
        }
        public void ShouldUpdateLastTransactionTimeWhenDepositMoney()
        {
            var transactionService = new TransactionService();
            var defaultTransactionTime = DateTime.MinValue;
            var bankUser = new BankUser(){LastTransactionTime =defaultTransactionTime};
            transactionService.Deposit(bankUser, 100);

            Assert.IsTrue(bankUser.LastTransactionTime>defaultTransactionTime);
        }
 public void GetCounts()
 {
     var rep = new TransactionDBRepository();
     var service = new TransactionService(rep);
     var t = service.GetTrancCount();
     t.Item1.Should(Be.GreaterThan(0));
     t.Item2.Should(Be.GreaterThan(0));
     t.Item3.Should(Be.GreaterThan(0));
 }
 public void Connect(string apiUrl, string apiKey)
 {
     PaymillWrapper.Paymill.ApiKey = apiKey;
     PaymillWrapper.Paymill.ApiUrl = apiUrl;
     clientService = Paymill.GetService<ClientService>();
     paymentService = Paymill.GetService<PaymentService>();
     transactionService = Paymill.GetService<TransactionService>();
     refundService = Paymill.GetService<RefundService>();
 }
Beispiel #8
0
        public ActionResult ImportFile(string username, string file)
        {
            var service = new TransactionService();
            var user = service.GetUserByUserId(username);

            var base64EncodedBytes = System.Convert.FromBase64String(file);
            service.ImportTransactions(user, System.Text.Encoding.UTF8.GetString(base64EncodedBytes), TransactionProviderType.OFXTransactionProvider);

            user = service.GetUserByUserId(username);

            return PartialView("TransactionList", user.Transactions);
        }
Beispiel #9
0
        public ActionResult Index()
        {
            var service = new TransactionService();
            var user = service.GetUserByUserId(User.Identity.Name);

            //user.Transactions.Clear();
            //service.SaveUser(user);

            //user = service.GetUserByUserId(User.Identity.Name);

            return View(user);
        }
        public void Setup()
        {
            _service = new TransactionService();

            _user = _service.GetUserByUserId(_userId);

            if (_user == null)
            {
                _user = CreateUser();
                AddUser();
            }
        }
Beispiel #11
0
 public async Task <ArkTransactionList> GetUnconfirmedTransactionsAsync()
 {
     return(await TransactionService.GetUnconfirmedTransactionsAsync(GetArkAccount().Address));
 }
Beispiel #12
0
        /// <summary>Process all transactions (payments) from Service Reef.</summary>
        /// <param name="message">The message that is returned depending on the result.</param>
        /// <param name="state">The state of the process.</param>
        /// <returns><see cref="WorkerResultStatus"/></returns>
        public void Execute(IJobExecutionContext context)
        {
            RockContext                 dbContext                   = new RockContext();
            FinancialBatchService       financialBatchService       = new FinancialBatchService(dbContext);
            PersonService               personService               = new PersonService(dbContext);
            PersonAliasService          personAliasService          = new PersonAliasService(dbContext);
            FinancialAccountService     financialAccountService     = new FinancialAccountService(dbContext);
            FinancialAccountService     accountService              = new FinancialAccountService(dbContext);
            FinancialTransactionService financialTransactionService = new FinancialTransactionService(dbContext);
            FinancialGatewayService     financialGatewayService     = new FinancialGatewayService(dbContext);
            DefinedValueService         definedValueService         = new DefinedValueService(dbContext);
            DefinedTypeService          definedTypeService          = new DefinedTypeService(dbContext);
            TransactionService          transactionService          = new TransactionService(new PayPalReporting.Data.PayPalReportingContext());

            // Get the datamap for loading attributes
            JobDataMap dataMap = context.JobDetail.JobDataMap;

            String warnings = string.Empty;

            FinancialBatch batch       = null;
            Double         totalAmount = 0;
            var            total       = 1;
            var            processed   = 0;

            try
            {
                DateRange dateRange = Rock.Web.UI.Controls.SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues(dataMap.GetString("DateRange") ?? "-1||");

                String            SRApiKey          = Encryption.DecryptString(dataMap.GetString("ServiceReefAPIKey"));
                String            SRApiSecret       = Encryption.DecryptString(dataMap.GetString("ServiceReefAPISecret"));
                String            SRApiUrl          = dataMap.GetString("ServiceReefAPIURL");
                DefinedValueCache transactionSource = DefinedValueCache.Read(dataMap.GetString("TransactionSource").AsGuid(), dbContext);
                DefinedValueCache connectionStatus  = DefinedValueCache.Read(dataMap.GetString("ConnectionStatus").AsGuid(), dbContext);
                DefinedValueCache contribution      = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.TRANSACTION_TYPE_CONTRIBUTION);

                // Setup some lookups
                DefinedTypeCache        creditCards = DefinedTypeCache.Read(Rock.SystemGuid.DefinedType.FINANCIAL_CREDIT_CARD_TYPE.AsGuid(), dbContext);
                DefinedTypeCache        tenderType  = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.FINANCIAL_CURRENCY_TYPE.AsGuid(), dbContext);
                FinancialAccount        specialFund = accountService.Get(dataMap.GetString("Account").AsGuid());
                FinancialGateway        gateway     = financialGatewayService.Get(dataMap.GetString("FinancialGateway").AsGuid());
                List <FinancialAccount> trips       = financialAccountService.Queryable().Where(fa => fa.ParentAccountId == specialFund.Id).OrderBy(fa => fa.Order).ToList();

                // Get the trips
                DefinedValueCache serviceReefAccountType = DefinedValueCache.Get(dataMap.Get("ServiceReefAccountType").ToString().AsGuid());

                // Setup the ServiceReef API Client
                var client = new RestClient(SRApiUrl);
                client.Authenticator = new HMACAuthenticator(SRApiKey, SRApiSecret);

                // Get all payments from ServiceReef
                var request = new RestRequest("v1/payments", Method.GET);
                request.AddParameter("pageSize", 100);
                if (dateRange.Start.HasValue)
                {
                    request.AddParameter("startDate", dateRange.Start.Value.ToString("o"));
                }
                if (dateRange.End.HasValue)
                {
                    request.AddParameter("endDate", dateRange.End.Value.ToString("o"));
                }
                request.AddParameter("page", 1);

                while (total > processed)
                {
                    var response = client.Execute <Contracts.Payments>(request);
                    if (response.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        throw new Exception("ServiceReef API Response: " + response.StatusDescription + " Content Length: " + response.ContentLength);
                    }
                    if (response.Data != null && response.Data.PageInfo != null)
                    {
                        total = response.Data.PageInfo.TotalRecords;
                        foreach (Contracts.Payments.Result result in response.Data.Results)
                        {
                            // Process the transaction
                            if (result.PaymentProcessorTransactionId != null)
                            {
                                if (result.FirstName == null || result.LastName == null)
                                {
                                    warnings += "Missing Firstname/Lastname for ServiceReef transaction Id: " + result.TransactionId + Environment.NewLine;
                                    processed++;
                                    continue;
                                }
                                FinancialAccount trip = null;
                                // Make sure we have a sub-account to go with this transaction
                                if (result.EventId > 0)
                                {
                                    trip = trips.Where(t => t.GlCode == result.EventCode && t.Url == result.EventUrl).FirstOrDefault();
                                }
                                if (trip == null)
                                {
                                    if (result.EventCode == null)
                                    {
                                        warnings += "Event Code is missing on the Service Reef Trip for ServiceReef transaction Id: " + result.TransactionId + Environment.NewLine;
                                        processed++;
                                        continue;
                                    }

                                    // Create the trip subaccount
                                    FinancialAccount tripFA = new FinancialAccount();
                                    tripFA.Name = result.EventName;
                                    // Name is limited to 50
                                    if (tripFA.Name.Length > 50)
                                    {
                                        tripFA.Name = tripFA.Name.Substring(0, 50);
                                    }
                                    tripFA.Description = "Service Reef Event.  Name: " + result.EventName + " ID: " + result.EventId;
                                    tripFA.GlCode      = result.EventCode;
                                    tripFA.Url         = result.EventUrl;
                                    tripFA.PublicName  = result.EventName;
                                    // Public Name is limited to 50
                                    if (tripFA.PublicName.Length > 50)
                                    {
                                        tripFA.PublicName = tripFA.PublicName.Substring(0, 50);
                                    }
                                    tripFA.IsTaxDeductible    = true;
                                    tripFA.IsPublic           = false;
                                    tripFA.ParentAccountId    = specialFund.Id;
                                    tripFA.Order              = specialFund.Order + 1;
                                    tripFA.AccountTypeValueId = serviceReefAccountType.Id;
                                    // Figure out what order it should be;
                                    foreach (FinancialAccount tmpTrip in trips)
                                    {
                                        if (tmpTrip.Name.CompareTo(tripFA.Name) < 0)
                                        {
                                            tripFA.Order++;
                                        }
                                    }

                                    financialAccountService.Add(tripFA);

                                    // Now save the trip
                                    dbContext.SaveChanges();
                                    // Increment all the rest of the Orders
                                    financialAccountService.Queryable().Where(fa => fa.Order >= tripFA.Order && fa.Id != tripFA.Id).ToList().ForEach(c => c.Order++);
                                    dbContext.SaveChanges();
                                    trips = financialAccountService.Queryable().Where(fa => fa.ParentAccountId == specialFund.Id).OrderBy(fa => fa.Order).ToList();
                                    trip  = tripFA;
                                }

                                FinancialTransaction tran = financialTransactionService.Queryable().Where(tx => tx.TransactionCode == result.PaymentProcessorTransactionId).FirstOrDefault();

                                // We haven't processed this before so get busy!
                                if (tran == null)
                                {
                                    tran = new FinancialTransaction();
                                    tran.FinancialPaymentDetail = new FinancialPaymentDetail();
                                    if (result.Type == "CreditCard")
                                    {
                                        tran.FinancialPaymentDetail.CurrencyTypeValueId = tenderType.DefinedValues.Where(t => t.Value == "Credit Card").FirstOrDefault().Id;
                                    }
                                    else
                                    {
                                        tran.TransactionTypeValueId = tenderType.DefinedValues.Where(t => t.Value == "Credit Card").FirstOrDefault().Id;
                                    }

                                    Person person = null;
                                    // Find the person this transaction belongs to
                                    // 1. First start by determining whether this was a person
                                    //    paying their application fee or contributing to themselves
                                    //    because then we can just use their member info
                                    if (result.UserId > 0 &&
                                        result.DonatedToUserId == result.UserId &&
                                        result.DonatedToFirstName == result.FirstName &&
                                        result.DonatedToLastName == result.LastName)
                                    {
                                        var memberRequest = new RestRequest("v1/members/{userId}", Method.GET);
                                        memberRequest.AddUrlSegment("userId", result.UserId.ToString());
                                        var memberResult = client.Execute <Contracts.Member>(memberRequest);
                                        if (memberResult.Data != null && memberResult.Data.ArenaId > 0)
                                        {
                                            try
                                            {
                                                Person personMatch = personAliasService.Queryable().Where(pa => pa.AliasPersonId == memberResult.Data.ArenaId).Select(pa => pa.Person).FirstOrDefault();
                                                if (personMatch == null)
                                                {
                                                    throw new Exception("Person not found: " + memberResult.Data.ArenaId);
                                                }
                                                person = personMatch;
                                            } catch (Exception e)
                                            {
                                                warnings += "Loading the person failed transaction id " + result.TransactionId + " for " + result.FirstName + " " + result.LastName + " with the following error: " + e.Message + Environment.NewLine;
                                                processed++;
                                                continue;
                                            }
                                        }
                                    }
                                    // 2. If we didn't get a person match via their Alias Id
                                    //    then just use the standard person match logic
                                    if (person == null)
                                    {
                                        String street1    = null;
                                        String postalCode = null;
                                        if (result.Address != null)
                                        {
                                            street1    = result.Address.Address1;
                                            postalCode = result.Address.Zip;
                                        }
                                        List <Person> matches = personService.GetByMatch(result.FirstName.Trim(), result.LastName.Trim(), null, result.Email, null, street1, postalCode).ToList();

                                        if (matches.Count > 1)
                                        {
                                            // Find the oldest member record in the list
                                            person = matches.Where(p => p.ConnectionStatusValue.Value == "Member").OrderBy(p => p.Id).FirstOrDefault();
                                            if (person == null)
                                            {
                                                // Find the oldest attendee record in the list
                                                person = matches.Where(p => p.ConnectionStatusValue.Value == "Attendee").OrderBy(p => p.Id).FirstOrDefault();
                                                if (person == null)
                                                {
                                                    person = matches.OrderBy(p => p.Id).First();
                                                }
                                            }
                                        }
                                        else if (matches.Count == 1)
                                        {
                                            person = matches.First();
                                        }
                                        else
                                        {
                                            // Create the person
                                            person           = new Person();
                                            person.FirstName = result.FirstName.Trim();
                                            person.LastName  = result.LastName.Trim();
                                            if (result.Email.IsValidEmail())
                                            {
                                                person.Email = result.Email.Trim();
                                            }
                                            person.RecordTypeValueId       = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.PERSON_RECORD_TYPE_PERSON.AsGuid()).Id;
                                            person.ConnectionStatusValueId = connectionStatus.Id;
                                            person.RecordStatusValueId     = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.PERSON_RECORD_STATUS_ACTIVE.AsGuid()).Id;
                                            Group         family   = PersonService.SaveNewPerson(person, dbContext);
                                            GroupLocation location = new GroupLocation();
                                            location.GroupLocationTypeValueId = DefinedValueCache.Read(Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME).Id;
                                            location.Location = new Location()
                                            {
                                                Street1    = result.Address.Address1,
                                                Street2    = result.Address.Address2,
                                                City       = result.Address.City,
                                                State      = result.Address.State,
                                                PostalCode = result.Address.Zip,
                                                Country    = result.Address.Country
                                            };
                                            family.CampusId = CampusCache.All().FirstOrDefault().Id;
                                            family.GroupLocations.Add(location);
                                            dbContext.SaveChanges();
                                        }
                                    }

                                    // Get details about the transaction from our PayPal report table
                                    Transaction tx = transactionService.Get(result.PaymentProcessorTransactionId);
                                    if (tx != null)
                                    {
                                        if (tx.TenderType.Contains("ACH"))
                                        {
                                            result.Type   = "ACH";
                                            result.Method = null;
                                        }
                                        else
                                        {
                                            result.Type   = "Credit Card";
                                            result.Method = tx.TenderType;
                                        }
                                    }
                                    else
                                    {
                                        // Defaults
                                        result.Type   = "Credit Card";
                                        result.Method = "Visa";

                                        warnings += "Unable to find transaction in _org_secc_PaypalReporting_Transaction table: " + result.TransactionId + Environment.NewLine;
                                    }

                                    // If we don't have a batch, create one
                                    if (batch == null)
                                    {
                                        batch = new FinancialBatch();
                                        batch.BatchStartDateTime = result.Date;
                                        batch.BatchEndDateTime   = DateTime.Now;
                                        batch.Name   = "Service Reef Payments";
                                        batch.Status = BatchStatus.Open;
                                        financialBatchService.Add(batch);
                                        dbContext.SaveChanges();
                                    }

                                    // Complete the FinancialTransaction
                                    tran.AuthorizedPersonAliasId = person.PrimaryAliasId;
                                    tran.BatchId             = batch.Id;
                                    tran.Summary             = "F" + specialFund.Id + ":$" + result.Amount.ToString();
                                    tran.TransactionDateTime = result.Date;
                                    tran.FinancialGatewayId  = gateway.Id;

                                    FinancialTransactionDetail financialTransactionDetail = new FinancialTransactionDetail();
                                    financialTransactionDetail.AccountId = trip.Id;
                                    financialTransactionDetail.Amount    = result.Amount.ToString().AsDecimal();
                                    tran.TransactionDetails.Add(financialTransactionDetail);
                                    tran.TransactionTypeValueId = contribution.Id;

                                    tran.FinancialPaymentDetail = new FinancialPaymentDetail();
                                    tran.FinancialPaymentDetail.CurrencyTypeValueId = tenderType.DefinedValues.Where(type => type.Value.ToLower() == result.Type.ToLower()).FirstOrDefault().Id;
                                    if (result.Method != null)
                                    {
                                        tran.FinancialPaymentDetail.CreditCardTypeValueId = creditCards.DefinedValues.Where(card => card.Value.ToLower() == result.Method.ToLower()).FirstOrDefault().Id;
                                    }
                                    tran.TransactionCode   = result.PaymentProcessorTransactionId;
                                    tran.SourceTypeValueId = transactionSource.Id;

                                    financialTransactionService.Add(tran);
                                    dbContext.SaveChanges();

                                    totalAmount += result.Amount;
                                }
                            }
                            processed++;
                        }
                    }
                    else
                    {
                        total = 0;
                    }
                    // Update the page number for the next request
                    var pageParam = request.Parameters.Where(p => p.Name == "page").FirstOrDefault();
                    pageParam.Value = (int)pageParam.Value + 1;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("ServiceReef Job Failed", ex);
            } finally
            {
                if (batch != null && totalAmount > 0)
                {
                    batch.ControlAmount = (Decimal)totalAmount;
                }
                dbContext.SaveChanges();
            }
            if (warnings.Length > 0)
            {
                throw new Exception(warnings);
            }
            context.Result = "Successfully imported " + processed + " transactions.";
        }
Beispiel #13
0
 public AccountController(IMemoryCache cache, TransactionService service)
 {
     _cache   = cache;
     _service = service;
 }
        public void ShouldCreateADepositTransactionAndUpdateRelevantMilestones()
        {
            //Arrange
            int          knownUserId                   = 150;
            int          knownTargetGoalId             = 15;
            int          expectedTransactionId         = 1154;
            DateTime     expectedTransactionCreateTime = DateTime.Now;
            const double depositAmount                 = 1250;
            Transaction  transaction                   = new Transaction(depositAmount, null, expectedTransactionCreateTime);
            Transaction  expectedTransaction           = new Transaction(expectedTransactionId, depositAmount, null, expectedTransactionCreateTime);

            //When creating, simply assign the ID as if this has been created on the server
            mockTransactionRepository.Setup(tr => tr.Create(It.Is <Transaction>(t => t.Equals(transaction)), It.Is <int?>(id => id.GetValueOrDefault() == knownTargetGoalId))).Returns <Transaction, int?>
            (
                (t, id) =>
            {
                t.Id = expectedTransactionId;
                return(t);
            }
            );

            //Assume the goals exist for the user
            List <Goal> userGoals = new List <Goal>()
            {
                new Goal(knownTargetGoalId, "Testing Goal", "Testing", 2500, GoalStatus.Open, true)
            };

            mockGoalRepository.Setup(gr => gr.GetGoalsForUser(It.Is <int>(id => id == knownUserId))).Returns(userGoals);

            //We have £500 posted against the goal
            IEnumerable <Transaction> transactionsForTargetGoal = new List <Transaction>()
            {
                new Transaction(123, 600.00, null, DateTime.Now.AddDays(-7)),
                new Transaction(175, 150.00, knownTargetGoalId, DateTime.Now.AddDays(-3)),
                new Transaction(251, 50.00, null, DateTime.Now.AddDays(-1)),
            };

            mockTransactionRepository.Setup(tr => tr.GetTransactionsForGoal(It.Is <int>(id => id == knownTargetGoalId))).Returns(transactionsForTargetGoal);

            //We have achieved "£500" already
            List <Milestone> milestonesForGoal = new List <Milestone>()
            {
                new Milestone(100, 500, "£500", DateTime.Now.AddDays(-7)),
                new Milestone(101, 1000, "£1000", null),
                new Milestone(102, 1500, "£1500", null),
                new Milestone(103, 2000, "£2000", null),
                new Milestone(104, 2500, "£2500", null)
            };

            mockMilestoneRepository.Setup(mr => mr.GetForGoal(It.Is <int>(id => id == knownTargetGoalId))).Returns(milestonesForGoal);

            //Ensure that we update ONLY the ones we know to have passed
            List <Milestone>        updatedMilestones          = new List <Milestone>();
            IEnumerable <Milestone> expectedAchievedMilestones = new List <Milestone>()
            {
                milestonesForGoal[1], milestonesForGoal[2]
            };

            mockMilestoneRepository
            .Setup(mr => mr.Update(It.IsAny <int>(), It.IsIn(expectedAchievedMilestones)))
            .Callback <int, Milestone>((id, milestone) =>
            {
                //Add these to the list to be checked later
                updatedMilestones.Add(milestone);
            })
            .Returns <int, Milestone>((id, ms) => ms);
            ITransactionService transactionService = new TransactionService(mockTransactionRepository.Object, mockGoalRepository.Object, mockMilestoneRepository.Object);

            //Act
            Transaction createdTransaction = transactionService.CreateTransaction(knownUserId, transaction, knownTargetGoalId);

            //Assert
            createdTransaction.Should().BeEquivalentTo(expectedTransaction);

            //Check that the expected milestones have been reached
            updatedMilestones.Count.Should().Be(2);
            updatedMilestones.All(ms => ms.DateMet.Value.Equals(expectedTransactionCreateTime)).Should().BeTrue();

            //Should only have called update twice
            mockMilestoneRepository.Verify(mr => mr.Update(It.IsAny <int>(), It.IsIn(expectedAchievedMilestones)), Times.Exactly(2));
        }
Beispiel #15
0
        public async Task ReturnTransactionDTO_OfTypeStakeAndWin_WhenPassedValidParams(string userName, string amount, string game, string description, string type)
        {
            //Arrange
            contextOptions = new DbContextOptionsBuilder <ItsAllAboutTheGameDbContext>()
                             .UseInMemoryDatabase(databaseName: "ReturnTransactionDTO_OfTypeStakeAndWin_WhenPassedValidParams")
                             .Options;

            dateTimeProviderMock       = new Mock <IDateTimeProvider>();
            foreignExchangeServiceMock = new Mock <IForeignExchangeService>();
            walletServiceMock          = new Mock <IWalletService>();
            userServiceMock            = new Mock <IUserService>();
            cardServiceMock            = new Mock <ICardService>();

            foreignExchangeDTO = new ForeignExchangeDTO
            {
                Base  = GlobalConstants.BaseCurrency,
                Rates = Enum.GetNames(typeof(Currency)).ToDictionary(name => name, value => 2m)
            };

            foreignExchangeServiceMock.Setup(fesm => fesm.GetConvertionRates()).ReturnsAsync(foreignExchangeDTO);

            var user = new User
            {
                Cards        = new List <CreditCard>(),
                Transactions = new List <Transaction>(),
                UserName     = userName,
                CreatedOn    = dateTimeProviderMock.Object.Now,
                Email        = "*****@*****.**",
                FirstName    = "Edward",
                LastName     = "Evlogiev",
                DateOfBirth  = DateTime.Parse("12.03.1993"),
                Role         = UserRole.None,
            };

            var wallet = new Wallet
            {
                Balance  = 0,
                Currency = Currency.EUR,
                User     = user
            };

            //Act
            using (var actContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                await actContext.Users.AddAsync(user);

                await actContext.Wallets.AddAsync(wallet);

                await actContext.SaveChangesAsync();
            }

            //Assert
            using (var assertContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                var sut = new TransactionService(assertContext, walletServiceMock.Object, userServiceMock.Object,
                                                 foreignExchangeServiceMock.Object, cardServiceMock.Object, dateTimeProviderMock.Object);
                assertContext.Attach(wallet);
                var gameResult = await sut.GameTransaction(user, int.Parse(amount),
                                                           game, description, (TransactionType)Enum.Parse(typeof(TransactionType), type));

                Assert.IsInstanceOfType(gameResult, typeof(TransactionDTO));
                Assert.IsTrue(gameResult.Description == description + game);
                Assert.IsTrue(gameResult.Type == (TransactionType)Enum.Parse(typeof(TransactionType), type));
                Assert.IsTrue(gameResult.Amount == int.Parse(amount) / 2);
                Assert.IsTrue(gameResult.Username == userName);
            }
        }
Beispiel #16
0
        public PurchaseTransactionType(DataLoader loader, UserRepository users, ProductRepository products, UserManager <User> userManager, TransactionService transactionService)
        {
            Name        = "Purchase";
            Description = "A product purchase.";

            TransactionInterfaceType.Implement(this, loader, users);

            Field("pricePerUnit", x => x.ProductPrice).Description("The unit price of the product at the time of purchase.");
            Field("itemName", x => x.ProductName).Description("The product's name at the time of purchase.");
            Field(x => x.Quantity).Description("The quantity that was purchased");
            Field("wasFromSubscription", x => x.IsFromSubscription).Description("Indicates if this purchase was triggered by a subscription.");
            Field <BooleanGraphType>(
                "canDelete",
                description: "Indicates if the purchased can be cancelled.",
                resolve: ctx => {
                var currentUser   = ctx.UserContext.As <DepanneurUserContext>().User;
                var currentUserId = userManager.GetUserId(currentUser);

                return(transactionService.CanCancel(currentUserId, ctx.Source));
            });
            Field <ProductType>("product", resolve: ctx => loader.LoadBatch("GetProductsById", ctx.Source.ProductId, products.GetProductsById));
        }
Beispiel #17
0
 public RequestModel(ILogger <RequestModel> logger, TransactionService trans)
 {
     _logger    = logger;
     this.trans = trans;
 }
Beispiel #18
0
 public TransactionController()
 {
     _service = new TransactionService();
 }
        public void Init()
        {
            AddDecoders();
            ILogManager logManager = _api.LogManager;
            ILogger     logger     = logManager.GetClassLogger();

            bool disableSendingDepositTransaction  = HasEnabledVariable("SENDING_DEPOSIT_TRANSACTION_DISABLED");
            bool instantDepositVerificationEnabled = HasEnabledVariable("INSTANT_DEPOSIT_VERIFICATION_ENABLED");
            bool backgroundServicesDisabled        = HasEnabledVariable("BACKGROUND_SERVICES_DISABLED");

            if (disableSendingDepositTransaction)
            {
                if (logger.IsWarn)
                {
                    logger.Warn("*** NDM sending deposit transaction is disabled ***");
                }
            }

            if (instantDepositVerificationEnabled)
            {
                if (logger.IsWarn)
                {
                    logger.Warn("*** NDM instant deposit verification is enabled ***");
                }
            }

            if (backgroundServicesDisabled)
            {
                if (logger.IsWarn)
                {
                    logger.Warn("*** NDM background services are disabled ***");
                }
            }

            INdmConfig ndmConfig       = _api.NdmConfig;
            string     configId        = ndmConfig.Id;
            IDbConfig  dbConfig        = _api.ConfigProvider.GetConfig <IDbConfig>();
            Address    contractAddress = string.IsNullOrWhiteSpace(ndmConfig.ContractAddress)
                ? Address.Zero
                : new Address(ndmConfig.ContractAddress);
            ConsumerRocksDbProvider rocksDbProvider = new ConsumerRocksDbProvider(_api.BaseDbPath, dbConfig,
                                                                                  logManager);
            DepositDetailsDecoder             depositDetailsRlpDecoder  = new DepositDetailsDecoder();
            DepositApprovalDecoder            depositApprovalRlpDecoder = new DepositApprovalDecoder();
            DataDeliveryReceiptDetailsDecoder receiptRlpDecoder         = new DataDeliveryReceiptDetailsDecoder();
            ConsumerSessionDecoder            sessionRlpDecoder         = new ConsumerSessionDecoder();
            ReceiptRequestValidator           receiptRequestValidator   = new ReceiptRequestValidator(logManager);

            IDepositDetailsRepository          depositRepository;
            IConsumerDepositApprovalRepository depositApprovalRepository;
            IProviderRepository        providerRepository;
            IReceiptRepository         receiptRepository;
            IConsumerSessionRepository sessionRepository;

            switch (ndmConfig.Persistence?.ToLowerInvariant())
            {
            case "mongo":
                IMongoDatabase?database = _api.MongoProvider.GetDatabase();
                if (database == null)
                {
                    throw new ApplicationException("Failed to initialize Mongo DB.");
                }

                depositRepository         = new DepositDetailsMongoRepository(database);
                depositApprovalRepository = new ConsumerDepositApprovalMongoRepository(database);
                providerRepository        = new ProviderMongoRepository(database);
                receiptRepository         = new ReceiptMongoRepository(database, "consumerReceipts");
                sessionRepository         = new ConsumerSessionMongoRepository(database);
                break;

            case "memory":
                if (logger.IsWarn)
                {
                    logger.Warn("*** NDM is using in memory database ***");
                }
                DepositsInMemoryDb depositsDatabase = new DepositsInMemoryDb();
                depositRepository         = new DepositDetailsInMemoryRepository(depositsDatabase);
                depositApprovalRepository = new ConsumerDepositApprovalInMemoryRepository();
                providerRepository        = new ProviderInMemoryRepository(depositsDatabase);
                receiptRepository         = new ReceiptInMemoryRepository();
                sessionRepository         = new ConsumerSessionInMemoryRepository();
                break;

            default:
                depositRepository = new DepositDetailsRocksRepository(rocksDbProvider.DepositsDb,
                                                                      depositDetailsRlpDecoder);
                depositApprovalRepository = new ConsumerDepositApprovalRocksRepository(
                    rocksDbProvider.ConsumerDepositApprovalsDb, depositApprovalRlpDecoder);
                providerRepository = new ProviderRocksRepository(rocksDbProvider.DepositsDb,
                                                                 depositDetailsRlpDecoder);
                receiptRepository = new ReceiptRocksRepository(rocksDbProvider.ConsumerReceiptsDb,
                                                               receiptRlpDecoder);
                sessionRepository = new ConsumerSessionRocksRepository(rocksDbProvider.ConsumerSessionsDb,
                                                                       sessionRlpDecoder);
                break;
            }

            uint                 requiredBlockConfirmations = ndmConfig.BlockConfirmations;
            IAbiEncoder          abiEncoder       = _api.AbiEncoder;
            INdmBlockchainBridge blockchainBridge = _api.BlockchainBridge;
            IBlockProcessor      blockProcessor   = _api.MainBlockProcessor;
            IConfigManager       configManager    = _api.ConfigManager;
            Address              consumerAddress  = _api.ConsumerAddress;
            ICryptoRandom        cryptoRandom     = _api.CryptoRandom;
            IDepositService      depositService   = _api.DepositService;

            gasPriceService = _api.GasPriceService;
            IEthereumEcdsa ecdsa = _api.EthereumEcdsa;

            ethRequestService         = _api.EthRequestService;
            jsonRpcNdmConsumerChannel = _api.JsonRpcNdmConsumerChannel;
            INdmNotifier ndmNotifier   = _api.NdmNotifier;
            PublicKey    nodePublicKey = _api.Enode.PublicKey;

            timestamper = _api.Timestamper;
            IWallet                wallet                = _api.Wallet;
            IHttpClient            httpClient            = _api.HttpClient;
            IJsonRpcClientProxy?   jsonRpcClientProxy    = _api.JsonRpcClientProxy;
            IEthJsonRpcClientProxy?ethJsonRpcClientProxy = _api.EthJsonRpcClientProxy;
            TransactionService     transactionService    = _api.TransactionService;
            IMonitoringService     monitoringService     = _api.MonitoringService;

            monitoringService?.RegisterMetrics(typeof(Metrics));

            DataRequestFactory     dataRequestFactory     = new DataRequestFactory(wallet, nodePublicKey);
            TransactionVerifier    transactionVerifier    = new TransactionVerifier(blockchainBridge, requiredBlockConfirmations);
            DepositUnitsCalculator depositUnitsCalculator = new DepositUnitsCalculator(sessionRepository, timestamper);
            DepositProvider        depositProvider        = new DepositProvider(depositRepository, depositUnitsCalculator, logManager);
            KycVerifier            kycVerifier            = new KycVerifier(depositApprovalRepository, logManager);
            ConsumerNotifier       consumerNotifier       = new ConsumerNotifier(ndmNotifier);

            DataAssetService   dataAssetService   = new DataAssetService(providerRepository, consumerNotifier, logManager);
            ProviderService    providerService    = new ProviderService(providerRepository, consumerNotifier, logManager);
            DataRequestService dataRequestService = new DataRequestService(dataRequestFactory, depositProvider, kycVerifier, wallet,
                                                                           providerService, timestamper, sessionRepository, consumerNotifier, logManager);

            SessionService sessionService = new SessionService(providerService, depositProvider, dataAssetService,
                                                               sessionRepository, timestamper, consumerNotifier, logManager);
            DataConsumerService dataConsumerService = new DataConsumerService(depositProvider, sessionService,
                                                                              consumerNotifier, timestamper, sessionRepository, logManager);
            DataStreamService dataStreamService = new DataStreamService(dataAssetService, depositProvider,
                                                                        providerService, sessionService, wallet, consumerNotifier, sessionRepository, logManager);
            DepositApprovalService depositApprovalService = new DepositApprovalService(dataAssetService, providerService,
                                                                                       depositApprovalRepository, timestamper, consumerNotifier, logManager);
            DepositConfirmationService depositConfirmationService = new DepositConfirmationService(blockchainBridge, consumerNotifier,
                                                                                                   depositRepository, depositService, logManager, requiredBlockConfirmations);

            IDepositManager depositManager = new DepositManager(depositService, depositUnitsCalculator,
                                                                dataAssetService, kycVerifier, providerService, abiEncoder, cryptoRandom, wallet, gasPriceService,
                                                                depositRepository, timestamper, logManager, requiredBlockConfirmations,
                                                                disableSendingDepositTransaction);

            if (instantDepositVerificationEnabled)
            {
                depositManager = new InstantDepositManager(depositManager, depositRepository, timestamper, logManager,
                                                           requiredBlockConfirmations);
            }

            depositReportService = new DepositReportService(depositRepository, receiptRepository, sessionRepository,
                                                            timestamper);
            ReceiptService receiptService = new ReceiptService(depositProvider, providerService, receiptRequestValidator,
                                                               sessionService, timestamper, receiptRepository, sessionRepository, abiEncoder, wallet, ecdsa,
                                                               nodePublicKey, logManager);
            RefundService refundService = new RefundService(blockchainBridge, abiEncoder, depositRepository,
                                                            contractAddress, logManager);
            RefundClaimant refundClaimant = new RefundClaimant(refundService, blockchainBridge, depositRepository,
                                                               transactionVerifier, gasPriceService, timestamper, logManager);

            _api.AccountService = new AccountService(configManager, dataStreamService, providerService,
                                                     sessionService, consumerNotifier, wallet, configId, consumerAddress, logManager);
            ProxyService proxyService = new ProxyService(jsonRpcClientProxy, configManager, configId, logManager);

            _api.ConsumerService = new ConsumerService(_api.AccountService, dataAssetService, dataRequestService,
                                                       dataConsumerService, dataStreamService, depositManager, depositApprovalService, providerService,
                                                       receiptService, refundService, sessionService, proxyService);
            ethPriceService             = new EthPriceService(httpClient, timestamper, logManager);
            consumerTransactionsService = new ConsumerTransactionsService(transactionService, depositRepository,
                                                                          timestamper, logManager);
            gasLimitsService = new ConsumerGasLimitsService(depositService, refundService);

            if (!backgroundServicesDisabled)
            {
                bool useDepositTimer = ndmConfig.ProxyEnabled;
                ConsumerServicesBackgroundProcessor consumerServicesBackgroundProcessor =
                    new ConsumerServicesBackgroundProcessor(
                        _api.AccountService,
                        refundClaimant,
                        depositConfirmationService,
                        ethPriceService,
                        _api.GasPriceService,
                        _api.MainBlockProcessor,
                        depositRepository,
                        consumerNotifier,
                        logManager,
                        useDepositTimer,
                        ethJsonRpcClientProxy);
                consumerServicesBackgroundProcessor.Init();
            }
        }
Beispiel #20
0
 public ArkTransactionList GetUnconfirmedTransactions()
 {
     return(TransactionService.GetUnconfirmedTransactions(GetArkAccount().Address));
 }
Beispiel #21
0
 public async Task <ArkTransactionList> GetTransactionsAsync(int offset = 0, int limit = 50)
 {
     return(await TransactionService.GetTransactionsAsync(GetArkAccount().Address, offset, limit));
 }
Beispiel #22
0
 public ArkTransactionList GetTransactions(int offset = 0, int limit = 50)
 {
     return(TransactionService.GetTransactions(GetArkAccount().Address, offset, limit));
 }
Beispiel #23
0
        public async Task <ArkTransactionPostResponse> RegisterAsDelegateAsync(string username)
        {
            var tx = TransactionApi.CreateDelegate(username, _passPhrase, _secondPassPhrase);

            return(await TransactionService.PostTransactionAsync(tx));
        }
Beispiel #24
0
        public ArkTransactionPostResponse RegisterAsDelegate(string username)
        {
            var tx = TransactionApi.CreateDelegate(username, _passPhrase, _secondPassPhrase);

            return(TransactionService.PostTransaction(tx));
        }
Beispiel #25
0
 public AccountService(DepositService depositService, WithdrawService withdrawService, ConsoleService consoleService, TransactionService transactionService)
 {
     _depositService     = depositService;
     _withdrawService    = withdrawService;
     _consoleService     = consoleService;
     _transactionService = transactionService;
 }
Beispiel #26
0
        public ArkTransactionPostResponse VoteForDelegate(List <string> votes)
        {
            var tx = TransactionApi.CreateVote(votes, _passPhrase, _secondPassPhrase);

            return(TransactionService.PostTransaction(tx));
        }
Beispiel #27
0
 public IndexModel()
 {
     _svc = new TransactionService();
 }
        //Not sure if this is necessary without identity/authentification
        private TransactionService CreateTransactionService()
        {
            var transactionService = new TransactionService();

            return(transactionService);
        }
Beispiel #29
0
 public void Setup()
 {
     _transactionService = new TransactionService();
 }
Beispiel #30
0
        public TransactionController(FridayCoinContext context)
        {
            var coinService = new FridayCoinService(context);

            _transactionService = new TransactionService(context, coinService);
        }
 public TransactionsController(TransactionService transactionService)
 {
     _transactionService = transactionService;
 }
Beispiel #32
0
        public ActionResult Sales()
        {
            var results = TransactionService.SalesSummary(SessionHelper.Transactions);

            return(View(results));
        }
Beispiel #33
0
        public async Task MakeTransactions_ThatAreAdded_ToTheBase(string userName, string amount, string game, string description, string type)
        {
            //Arrange
            contextOptions = new DbContextOptionsBuilder <ItsAllAboutTheGameDbContext>()
                             .UseInMemoryDatabase(databaseName: "MakeTransactions_ThatAreAdded_ToTheBase")
                             .Options;

            dateTimeProviderMock       = new Mock <IDateTimeProvider>();
            foreignExchangeServiceMock = new Mock <IForeignExchangeService>();
            walletServiceMock          = new Mock <IWalletService>();
            userServiceMock            = new Mock <IUserService>();
            cardServiceMock            = new Mock <ICardService>();

            foreignExchangeDTO = new ForeignExchangeDTO
            {
                Base  = GlobalConstants.BaseCurrency,
                Rates = Enum.GetNames(typeof(Currency)).ToDictionary(name => name, value => 2m)
            };

            foreignExchangeServiceMock.Setup(fesm => fesm.GetConvertionRates()).ReturnsAsync(foreignExchangeDTO);

            var user = new User
            {
                Cards        = new List <CreditCard>(),
                Transactions = new List <Transaction>(),
                UserName     = userName,
                CreatedOn    = dateTimeProviderMock.Object.Now,
                Email        = "*****@*****.**",
                FirstName    = "Edward",
                LastName     = "Evlogiev",
                DateOfBirth  = DateTime.Parse("12.03.1993"),
                Role         = UserRole.None,
            };

            var wallet = new Wallet
            {
                Balance  = 0,
                Currency = Currency.EUR,
                User     = user
            };

            var transaction = new Transaction()
            {
                Type        = (TransactionType)Enum.Parse(typeof(TransactionType), type),
                Description = description + game,
                User        = user,
                Amount      = int.Parse(amount) / foreignExchangeDTO.Rates[Currency.EUR.ToString()],
                CreatedOn   = dateTimeProviderMock.Object.Now,
                Currency    = wallet.Currency
            };

            //Act
            using (var actContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                await actContext.Users.AddAsync(user);

                await actContext.Wallets.AddAsync(wallet);

                await actContext.Transactions.AddAsync(transaction);

                await actContext.SaveChangesAsync();
            }

            //Assert
            using (var assertContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                var sut = new TransactionService(assertContext, walletServiceMock.Object, userServiceMock.Object,
                                                 foreignExchangeServiceMock.Object, cardServiceMock.Object, dateTimeProviderMock.Object);
                assertContext.Attach(wallet);
                var gameResult = await sut.GameTransaction(user, int.Parse(amount),
                                                           game, description, (TransactionType)Enum.Parse(typeof(TransactionType), type));

                Assert.AreEqual(transaction, await assertContext.Transactions.Where(t => t.User == user).FirstOrDefaultAsync());
            }
        }
Beispiel #34
0
        public ActionResult Management()
        {
            var results = TransactionService.ManagementSummary(SessionHelper.Transactions);

            return(View(results));
        }
 public DepositsController(TransactionService transactionServie)
 {
     _transactionService = transactionServie;
 }
 void _view_TopTransactionsBySum(object sender, EventArgs e)
 {
     var service = new TransactionService();
     var transactions = service.TopTransactionsBySum();
     _view.TransactionsGrid = transactions;
 }
Beispiel #37
0
        public void TestReconcileBalance()
        {
            ILoggerFactory loggerFactory = new LoggerFactory();

            using (var sqliteMemoryWrapper = new SqliteMemoryWrapper())
            {
                var currencyFactory   = new CurrencyFactory();
                var usdCurrencyEntity = currencyFactory.Create(CurrencyPrefab.Usd, true);
                currencyFactory.Add(sqliteMemoryWrapper.DbContext, usdCurrencyEntity);

                var accountFactory = new AccountFactory();
                Entities.Account incomeAccountEntity   = accountFactory.Create(AccountPrefab.Income, usdCurrencyEntity);
                Entities.Account checkingAccountEntity = accountFactory.Create(AccountPrefab.Checking, usdCurrencyEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, incomeAccountEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, checkingAccountEntity);

                var transactionEntities = new Entities.Transaction[]
                {
                    new Entities.Transaction
                    {
                        CreditAccount = incomeAccountEntity,
                        DebitAccount  = checkingAccountEntity,
                        Amount        = 100m,
                        At            = new DateTime(2018, 1, 1, 8, 30, 0)
                    }
                };

                sqliteMemoryWrapper.DbContext.Transactions.AddRange(transactionEntities);
                sqliteMemoryWrapper.DbContext.SaveChanges();

                var accountService = new AccountService(
                    loggerFactory,
                    sqliteMemoryWrapper.DbContext);

                var currencyService = new CurrencyService(
                    loggerFactory,
                    sqliteMemoryWrapper.DbContext);

                var transactionService = new TransactionService(
                    loggerFactory,
                    sqliteMemoryWrapper.DbContext);

                var viewModel = new ReconcileBalanceViewModel(
                    loggerFactory,
                    accountService,
                    currencyService,
                    transactionService,
                    new Concrete.StubAccountLinkViewModelFactory(),
                    new Mock <IForeignAmountViewService>().Object,
                    checkingAccountEntity.AccountId);
                viewModel.Balance = 140m;
                viewModel.At      = new DateTime(2018, 1, 2, 7, 0, 0);
                viewModel.OKCommand.Execute(null);
                Transaction newTransaction = viewModel.ToTransaction();

                Assert.AreEqual(1, viewModel.Accounts.Count);
                Assert.AreEqual(40m, newTransaction.Amount);
                Assert.AreEqual(incomeAccountEntity.AccountId, newTransaction.CreditAccount.AccountId);
                Assert.AreEqual(checkingAccountEntity.AccountId, newTransaction.DebitAccount.AccountId);
                Assert.AreEqual(viewModel.At, newTransaction.At);
            }
        }
Beispiel #38
0
 public SentModel(AccountService account, TransactionService ts)
 {
     this.account = account;
     this.ts      = ts;
 }
        public async Task ReturnEmptyTransactionListDTO_With_UserWalletCurrency_WhenUserHasNoTransactions()
        {
            //Arrange
            contextOptions = new DbContextOptionsBuilder <ItsAllAboutTheGameDbContext>()
                             .UseInMemoryDatabase(databaseName: "ReturnEmptyTransactionListDTO_With_UserWalletCurrency_WhenUserHasNoTransactions")
                             .Options;

            dateTimeProviderMock = new Mock <IDateTimeProvider>();
            walletServiceMock    = new Mock <IWalletService>();
            userServiceMock      = new Mock <IUserService>();
            cardServiceMock      = new Mock <ICardService>();

            user = new User
            {
                Cards        = new List <CreditCard>(),
                Transactions = new List <Transaction>(),
                UserName     = userName,
                CreatedOn    = dateTimeProviderMock.Object.Now,
                Email        = email,
                FirstName    = firstName,
                LastName     = lastName,
                DateOfBirth  = DateTime.Parse("02.01.1996"),
                Role         = UserRole.None,
            };

            var userTwo = new User
            {
                Cards        = new List <CreditCard>(),
                Transactions = new List <Transaction>(),
                UserName     = "******",
                CreatedOn    = dateTimeProviderMock.Object.Now.AddDays(1),
                Email        = "email",
                FirstName    = "firstName",
                LastName     = "lastName",
                DateOfBirth  = DateTime.Parse("02.01.1996"),
                Role         = UserRole.None,
            };

            var wallet = new Wallet
            {
                Balance  = 0,
                Currency = Currency.GBP,
                User     = user
            };

            foreignExchangeServiceMock = new Mock <IForeignExchangeService>();

            foreignExchangeDTO = new ForeignExchangeDTO
            {
                Base  = GlobalConstants.BaseCurrency,
                Rates = Enum.GetNames(typeof(Currency)).ToDictionary(name => name, value => 2m)
            };

            foreignExchangeServiceMock.Setup(fesm => fesm.GetConvertionRates()).ReturnsAsync(foreignExchangeDTO);

            //Act
            using (var actContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                await actContext.Users.AddAsync(user);

                await actContext.Users.AddAsync(userTwo);

                await actContext.Wallets.AddAsync(wallet);

                await actContext.SaveChangesAsync();
            }

            //Assert
            using (var assertContext = new ItsAllAboutTheGameDbContext(contextOptions))
            {
                var sut = new TransactionService(assertContext, walletServiceMock.Object, userServiceMock.Object,
                                                 foreignExchangeServiceMock.Object, cardServiceMock.Object, dateTimeProviderMock.Object);
                var listDTO = await sut.GetUserTransactions(user.UserName); // we get only the DTO of one of the users

                Assert.IsInstanceOfType(listDTO, typeof(TransactionListDTO));
                Assert.IsTrue(listDTO.TotalItemCount == 0);
            }
        }
Beispiel #40
0
 public ReceiverController(TransactionService service)
 {
     this.service = service;
 }
Beispiel #41
0
        public ActionResult Break()
        {
            var results = TransactionService.BreakReport(SessionHelper.Transactions);

            return(View(results));
        }
 public TransactionListingPresenter(ITransactionListingView view, TransactionService transactionService, CategoryService categoryService)
 {
     _view = view;
     _transactionService = transactionService;
     _categoryService = categoryService;
 }
 void _view_TransactionsOrderByDate(object sender, EventArgs e)
 {
     var service = new TransactionService();
     var transactions = service.TransactionsOrderByDate();
     _view.TransactionsGrid = transactions;
 }
Beispiel #44
0
        public ActionResult Investor()
        {
            var results = TransactionService.InvestorProfit(SessionHelper.Transactions);

            return(View(results));
        }