public void CreateDepositSheet(ExcelPackage Ep, List <Person> users) { DepositService service = new DepositService(); var collection = service.GetReport("Monthly EMI"); ExcelWorksheet Sheet = Ep.Workbook.Worksheets.Add("Deposit Report"); var startCol = 'B'; var startRow = 1; var endCol = 'H'; var endRow = 1; var hearder = string.Format("{0}{1}:{2}{3}", startCol, startRow, endCol, endRow); Sheet.Cells[hearder].Value = "MIXUP ACCOUNT"; Sheet.Cells[hearder].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; Color purple = ColorTranslator.FromHtml("#7030a0"); //Sheet.Cells[string.Format("{0}{1}:{2}{3}", startCol, preserveStartRow, endCol, startRow)].Style.Fill.PatternType = ExcelFillStyle.Solid; Sheet.Cells[hearder].Style.Font.Size = 22; Sheet.Cells[hearder].Style.Font.Color.SetColor(purple); Sheet.Cells[hearder].Merge = true; Sheet.Cells[hearder].Style.Border.Top.Style = ExcelBorderStyle.Thin; Sheet.Cells[hearder].Style.Border.Right.Style = ExcelBorderStyle.Thin; Sheet.Cells[hearder].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Sheet.Cells[hearder].Style.Border.Left.Style = ExcelBorderStyle.Thin; CreateTable(users, collection, Sheet, 2, 'B', "Month Wise Money Deposit"); Sheet.Cells["A:AZ"].AutoFitColumns(); }
private void FrmDeposit_Load(object sender, EventArgs e) { try { if (_commonService == null) { _commonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } if (_depositService == null) { _depositService = ServiceFactory.GenerateServiceInstance().GenerateDepositService(); } if (_saleOrderService == null) { _saleOrderService = ServiceFactory.GenerateServiceInstance().GenerateSaleOrderService(); } InitializeDepositList(); RetrieveDataHandler(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CtrlReport_Load(object sender, EventArgs e) { if (_SaleOrderService == null) { _SaleOrderService = ServiceFactory.GenerateServiceInstance().GenerateSaleOrderService(); } if (_depositService == null) { _depositService = ServiceFactory.GenerateServiceInstance().GenerateDepositService(); } if (_ProductService == null) { _ProductService = ServiceFactory.GenerateServiceInstance().GenerateProductService(); } if (_ExpenseService == null) { _ExpenseService = ServiceFactory.GenerateServiceInstance().GenerateExpenseService(); } try { ThreadStart threadStart = RemoveTemporaryFiles; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
public ActionResult AutoCreate(Guid id) { var person = db.Persons.FirstOrDefault(x => x.PersonGuid == id); var deposit = new Deposit() { TransactionDate = DateTime.Now.Date, IsApproved = false }; deposit.Person = person; decimal amount = 0; string message = string.Empty; decimal selfInterest = 0; string selfInterestMessage = string.Empty; decimal externalInterest = 0; string externalInterestMessage = string.Empty; DepositService service = new DepositService(); var transactionFor = db.TransactionFor.FirstOrDefault(x => x.TranscationFor.Equals("Monthly EMI")); service.GetAmount(person.PersonGuid, transactionFor.TranscationForGuid, ref amount, ref message, ref selfInterest, ref selfInterestMessage, ref externalInterest, ref externalInterestMessage); //deposit.TransactionFor = deposit.Amount = amount; deposit.SelfInterest = selfInterest; deposit.ExternalInterest = externalInterest; ViewBag.PersonGuid = new SelectList(db.Persons, "PersonGuid", "LoginId", person.PersonGuid); ViewBag.TransactionFor = new SelectList(db.TransactionFor.Where(x => x.TransactionType == 1), "TranscationForGuid", "TranscationFor"); //ViewBag.TransactionType = new SelectList(new List<object>() { new { item = "Credit", value = "1" }, new { item = "Debit", value = "2" } }, "value", "item"); return(View("Create", deposit)); }
public AccountService(DepositService depositService, WithdrawService withdrawService, ConsoleService consoleService, TransactionService transactionService) { _depositService = depositService; _withdrawService = withdrawService; _consoleService = consoleService; _transactionService = transactionService; }
public async void Deposit_Valid_Amount(string pin, string name, string accountId, double amount) { var account = Substitute.For <Account>(); var customer = Substitute.For <Customer>(); customer.FindAccount(Arg.Any <Guid>()) .Returns(account); customerReadOnlyRepository .GetByAccount(Guid.Parse(accountId)) .Returns(customer); var depositUseCase = new DepositService( customerReadOnlyRepository, customerWriteOnlyRepository, converter ); var request = new DepositCommand( Guid.Parse(accountId), amount ); DepositResult result = await depositUseCase.Handle(request); Assert.Equal(request.Amount, result.Transaction.Amount); }
public void deposit_correct_amount_in_bank_account() { var depositService = new DepositService(); var value = 50; depositService.Deposit(value); }
public ActionResult ReturnMoneyOutside() { ViewBag.Persons = db.Persons.ToList(); DepositService service = new DepositService(); return(View("Index", service.GetReport("Return Money(Third Party)"))); }
public ActionResult ReturnMoneySelf() { ViewBag.Persons = db.Persons.ToList(); DepositService service = new DepositService(); return(View("Index", service.GetReport("Return Money(Self)"))); }
public ActionResult Index() { ViewBag.Persons = db.Persons.ToList(); DepositService service = new DepositService(); return(View(service.GetReport("Monthly EMI"))); }
public ActionResult PaidInterestThirdParty() { ViewBag.Persons = db.Persons.ToList(); DepositService service = new DepositService(); return(View("Index", service.GetReport("Interest(Third Party)"))); }
public void Ok_when_code_is_valid() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); DepositService depositService = new DepositService(bridge, _txPool, _abiEncoder, _wallet, _contractAddress, LimboLogs.Instance); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.FromHexString(ContractData.DeployedCode)); depositService.ValidateContractAddress(contractAddress); }
public void Throws_when_unexpected_code() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); DepositService depositService = new DepositService(bridge, _txPool, _abiEncoder, _wallet, _contractAddress, LimboLogs.Instance); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.FromHexString("0xa234")); Assert.Throws <InvalidDataException>(() => depositService.ValidateContractAddress(contractAddress)); }
public void Throws_when_no_code_deployed() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); DepositService depositService = new DepositService(bridge, _abiEncoder, _wallet, _ndmConfig, LimboLogs.Instance); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.Empty); Assert.Throws <InvalidDataException>(() => depositService.ValidateContractAddress(contractAddress)); }
public void DepositService_AccountNotFound_Assert_Exception() { Account = new Account(); var stubRepo = new Mock <IAccountRepository>(); IBankDataBaseService bankDataBaseService = new BankDataBaseService(stubRepo.Object); DepositService = new DepositService(bankDataBaseService); DepositService.Execute(27056, new Amount("USD", 1100)); }
public async Task can_claim_refund() { uint timestamp = 1546871954; _bridge.NextBlockPlease(timestamp); DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Keccak assetId = Keccak.Compute("data asset"); uint expiryTime = timestamp + 4; UInt256 value = 1.Ether(); uint units = 10U; byte[] salt = new byte[16]; AbiSignature depositAbiDef = new AbiSignature("deposit", new AbiBytes(32), new AbiUInt(32), new AbiUInt(96), new AbiUInt(32), new AbiBytes(16), AbiType.Address, AbiType.Address); byte[] depositData = _abiEncoder.Encode(AbiEncodingStyle.Packed, depositAbiDef, assetId.Bytes, units, value, expiryTime, salt, _providerAccount, _consumerAccount); Keccak depositId = Keccak.Compute(depositData); Deposit deposit = new Deposit(depositId, units, expiryTime, value); Keccak depositTxHash = await depositService.MakeDepositAsync(_consumerAccount, deposit, 20.GWei()); _bridge.IncrementNonce(_consumerAccount); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); TestContext.WriteLine("GAS USED FOR DEPOSIT: {0}", depositTxReceipt.GasUsed); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); // calls revert and cannot reuse the same state - use only for manual debugging // Assert.True(depositService.VerifyDeposit(deposit.Id), "deposit verified"); RefundService refundService = new RefundService(_ndmBridge, _abiEncoder, _depositRepository, _contractAddress, LimboLogs.Instance, _wallet); // it will not work so far as we do everything within the same block and timestamp is wrong _bridge.NextBlockPlease(expiryTime + 1); RefundClaim refundClaim = new RefundClaim(depositId, assetId, units, value, expiryTime, salt, _providerAccount, _consumerAccount); UInt256 balanceBefore = _state.GetBalance(_consumerAccount); Keccak refundTxHash = await refundService.ClaimRefundAsync(_consumerAccount, refundClaim, 20.GWei()); TxReceipt refundReceipt = _bridge.GetReceipt(refundTxHash); TestContext.WriteLine("GAS USED FOR REFUND CLAIM: {0}", refundReceipt.GasUsed); Assert.AreEqual(StatusCode.Success, refundReceipt.StatusCode, $"refund claim {refundReceipt.Error} {Encoding.UTF8.GetString(refundReceipt.ReturnValue ?? new byte[0])}"); UInt256 balanceAfter = _state.GetBalance(_consumerAccount); Assert.Greater(balanceAfter, balanceBefore); }
private async Task <CurrencyPeerInfoModel> GetOrCachePeerInfo(int currencyId) { var cacheResult = await CacheService.GetOrSetHybridAsync(CacheKey.CurrencyPeerInfo(currencyId), TimeSpan.FromMinutes(10), async() => { var currency = await GetCurrency(currencyId).ConfigureAwait(false); var result = new CurrencyPeerInfoModel { Name = currency.Name, Symbol = currency.Symbol, PeerInfo = new List <PeerInfoModel>() }; var peerData = await DepositService.GetPeerInfo(currencyId).ConfigureAwait(false); #if DEBUG peerData.Add(new PeerInfoModel { Address = "116.74.107.102:9229" }); peerData.Add(new PeerInfoModel { Address = "98.115.147.74:9229" }); peerData.Add(new PeerInfoModel { Address = "45.35.64.39:9229" }); peerData.Add(new PeerInfoModel { Address = "188.166.182.57:9229" }); #endif foreach (var peer in peerData) { try { var ipaddress = peer.Address; if (ipaddress.Contains(":")) { ipaddress = ipaddress.Split(':')[0]; } using (var client = new HttpClient()) { client.Timeout = TimeSpan.FromSeconds(5); var peerLocation = JObject.Parse(await client.GetStringAsync("http://gd.geobytes.com/GetCityDetails?fqcn=" + ipaddress).ConfigureAwait(false)).ToObject <PeerData>(); if (peerLocation != null && peerLocation.geobyteslatitude.HasValue && peerLocation.geobyteslongitude.HasValue) { peer.geobyteslatitude = peerLocation.geobyteslatitude; peer.geobyteslongitude = peerLocation.geobyteslongitude; } } } catch { } } result.PeerInfo = peerData; return(result); }).ConfigureAwait(false); return(cacheResult); }
public void Can_make_and_verify_deposit_locally() { DepositService depositService = new DepositService(_bridge, _abiEncoder, _wallet, _ndmConfig, LimboLogs.Instance); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)new Timestamp().EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = depositService.MakeDeposit(_consumerAccount, deposit); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.True(depositService.VerifyDeposit(deposit.Id) > 0, "deposit verified"); }
public DepositeController(BankService bankService, DepositService depositService, IMapper mapper, ApplicationDbContext context, RecomendationSystem recomendation, UserManager <User> userManager, LikeDepositService likeDepositService) { this.bankService = bankService; this.depositService = depositService; this.mapper = mapper; this.context = context; this._recomendation = recomendation; this._userManager = userManager; this.likeDepositService = likeDepositService; }
public void Can_make_and_verify_deposit_2() { DepositService depositService = new DepositService(_bridge, _abiEncoder, _wallet, _ndmConfig, LimboLogs.Instance); Deposit deposit = new Deposit(new Keccak("0x7b1a21b95d2564c0e65807e921470575b20215d5430644014640009776d2fe04"), 336, 1549531335u, UInt256.Parse("33600000000000000000")); Keccak depositTxHash = depositService.MakeDeposit(new Address("2b5ad5c4795c026514f8317c7a215e218dccd6cf"), deposit); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.Greater(depositService.VerifyDeposit(deposit.Id), 0, "deposit verified"); }
public async Task Ok_when_code_is_valid() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); _ndmBridge = new NdmBlockchainBridge(bridge, _txPool); DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.FromHexString(ContractData.DeployedCode)); await depositService.ValidateContractAddressAsync(contractAddress); }
public void Throws_when_no_code_deployed() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); _ndmBridge = new NdmBlockchainBridge(bridge, _txPool); DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.Empty); Assert.ThrowsAsync <InvalidDataException>(async() => await depositService.ValidateContractAddressAsync(contractAddress)); }
public void Throws_when_unexpected_code() { IBlockchainBridge bridge = Substitute.For <IBlockchainBridge>(); _ndmBridge = new NdmBlockchainBridge(Substitute.For <ITxPoolBridge>(), bridge, _txPool); DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Address contractAddress = new Address(_ndmConfig.ContractAddress); bridge.GetCode(contractAddress).Returns(Bytes.FromHexString("0xa234")); Assert.ThrowsAsync <InvalidDataException>(async() => await depositService.ValidateContractAddressAsync(contractAddress)); }
public async Task Make_deposit_verify_incorrect_id() { DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)Timestamper.Default.EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = await depositService.MakeDepositAsync(_consumerAccount, deposit, 20.GWei()); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.AreEqual(0U, await depositService.VerifyDepositAsync(_consumerAccount, Keccak.Compute("incorrect id")), "deposit verified"); }
public async Task <ActionResult> PingCurrency(int id) { var result = await DepositService.Ping(id); if (result) { return(JsonSuccess("Successfully contacted wallet.")); } return(JsonError("No response from wallet.")); }
public async Task Returns_a_valid_balance() { DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)Timestamper.Default.EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = await depositService.MakeDepositAsync(_consumerAccount, deposit, 20.GWei()); _bridge.IncrementNonce(_consumerAccount); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); UInt256 balance = await depositService.ReadDepositBalanceAsync(_consumerAccount, deposit.Id); Assert.AreEqual(balance, 1.Ether()); }
public async Task Can_make_and_verify_deposit_locally() { DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)new Timestamper().EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = await depositService.MakeDepositAsync(_consumerAccount, deposit, 20.GWei()); _bridge.IncrementNonce(_consumerAccount); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.True(await depositService.VerifyDepositAsync(_consumerAccount, deposit.Id) > 0, "deposit verified"); }
public void Returns_a_valid_balance() { DepositService depositService = new DepositService(_bridge, _txPool, _abiEncoder, _wallet, _contractAddress, LimboLogs.Instance); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)new Timestamper().EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = depositService.MakeDeposit(_consumerAccount, deposit); _bridge.IncrementNonce(_consumerAccount); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); UInt256 balance = depositService.ReadDepositBalance(_consumerAccount, deposit.Id); Assert.AreEqual(balance, 1.Ether()); }
public void Make_deposit_verify_incorrect_id() { DepositService depositService = new DepositService(_bridge, _txPool, _abiEncoder, _wallet, _contractAddress, LimboLogs.Instance); Deposit deposit = new Deposit(Keccak.Compute("a secret"), 10, (uint)new Timestamper().EpochSeconds + 86000, 1.Ether()); Keccak depositTxHash = depositService.MakeDeposit(_consumerAccount, deposit); _bridge.IncrementNonce(_consumerAccount); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.AreEqual(0U, depositService.VerifyDeposit(_consumerAccount, Keccak.Compute("incorrect id")), "deposit verified"); }
public async Task Can_make_and_verify_deposit_2() { DepositService depositService = new DepositService(_ndmBridge, _abiEncoder, _wallet, _contractAddress); Deposit deposit = new Deposit(new Keccak("0x7b1a21b95d2564c0e65807e921470575b20215d5430644014640009776d2fe04"), 336, 1549531335u, UInt256.Parse("33600000000000000000")); Address address = new Address("2b5ad5c4795c026514f8317c7a215e218dccd6cf"); Keccak depositTxHash = await depositService.MakeDepositAsync(address, deposit, 20.GWei()); _bridge.IncrementNonce(address); TxReceipt depositTxReceipt = _bridge.GetReceipt(depositTxHash); Assert.AreEqual(StatusCode.Success, depositTxReceipt.StatusCode, $"deposit made {depositTxReceipt.Error} {Encoding.UTF8.GetString(depositTxReceipt.ReturnValue ?? new byte[0])}"); Assert.Greater(await depositService.VerifyDepositAsync(_consumerAccount, deposit.Id), 0, "deposit verified"); }
public ServiceList(string url, ResponseToken token) { this.eventService = new EventService(url, token); this.categoryService = new CategoryService(url, token); this.clubService = new ClubService(url, token); this.userService = new UserService(url, token); this.ticketService = new TicketService(url, token); this.meetingService = new MeetingService(url, token); this.invoiceService = new InvoiceService(url, token); this.groupService = new GroupService(url, token); this.expenseService = new ExpenseService(url, token); this.emailService = new EmailService(url, token); this.depositService = new DepositService(url, token); this.customFieldService = new CustomFieldService(url, token); this.taskService = new TaskService(url, token); this.contactService = new ContactService(url, token); }