Пример #1
0
        public Account WithDrawlReqAdmin(Payment payment)
        {
            var wallet = _db.Wallets.Where(m => m.Account_Id == payment.Account_Id && m.Currency == payment.Currency).ToList();

            if (wallet.Count > 0)
            {
                if (wallet.Select(x => x.Balance).FirstOrDefault().GetValueOrDefault() < payment.Amount.GetValueOrDefault())
                {
                    ExchangeException.Throw(ErrorCode.INSUFFICIANT_BALANCE, null);
                }
            }
            else
            {
                ExchangeException.Throw(ErrorCode.INSUFFICIANT_BALANCE, null);
            }
            Payment p = new Payment()
            {
                Account_Id       = payment.Account_Id,
                Amount           = payment.Amount,
                AmountSent       = Convert.ToDecimal(payment.Amount),
                Currency         = payment.Currency,
                Fee              = payment.Fee,
                ToWalletAddress  = payment.ToWalletAddress,
                TransectionId    = "",
                PaymentType      = "WITHDRAW",
                PaymentDate      = DateTime.UtcNow,
                PaymentStatus_Id = (int)1,
                StatusMessage    = "Withdrawal Requested",
                Source           = "CRYPTO"
            };

            //_db.Payments.Add(p);
            _db.Notifications.Add(new Notification()
            {
                IsViewed = false, NotificationDetails = "Crypto Withdraw is Requested", NotificationHeading = "Withdraw Request", RedirectAction = "WithDrawals", RedirectController = "Admin", NotificationType = "Desktop Notification"
            });
            //wallet.FirstOrDefault().Balance -= payment.Amount.Value;
            _db.Configuration.ValidateOnSaveEnabled = false;
            _db.SaveChanges();
            try
            {
                string _email = _db.Accounts.Where(x => x.AccountId == payment.Account_Id).Select(x => x.Email).FirstOrDefault();
                SMTPMailClient.SendRawEmail("clientservice @nanopips.com", "Withdraw Request from " + _email + " of " + payment.Amount + " " + payment.Currency + " to address " + payment.ToWalletAddress + " has been made. Need approval !", "New Withdrawl Request");
                SMTPMailClient.SendRawEmail(_email, "Thank you for contacting NanoPips. Please allow up to 24 hours for support to respond to your inquiry. ", "New Withdrawal Request");
            }
            catch (Exception ex)
            {
                ExchangeException.Throw(ex.Message);
            }
            return(_db.Accounts.Find(payment.Account_Id));
        }
Пример #2
0
 public bool AddressAuthorize(string cur, long id, string email)
 {
     try
     {
         var    list       = _db.AddressBooks.Where(x => x.Account_Id == id).ToList();
         string listString = "";
         for (int i = 0; i < list.Count; i++)
         {
             listString += list[i].Address + " , ";
         }
         SMTPMailClient.SendRawEmail("*****@*****.**", "Customer Id: " + id + " Whitelist Addresses: " + listString + "might be change.", "WhiteList Address Alert");
         SMTPMailClient.SendRawEmail(email, "Customer Whitelist Addresses: " + listString + "changed their whitelist address.", "WhiteList Address Alert");
         return(true);
     }
     catch (Exception) { return(false); }
 }
Пример #3
0
        public Account WireWithDrawlReqAdmin(Payment payment)
        {
            var wallet = _db.Wallets.Where(m => m.Account_Id == payment.Account_Id && m.Currency == payment.Currency).ToList();

            if (wallet.Count > 0)
            {
                if (wallet.Select(x => x.Balance).FirstOrDefault().GetValueOrDefault() < payment.FiatAmount.GetValueOrDefault())
                {
                    ExchangeException.Throw(ErrorCode.INSUFFICIANT_BALANCE, null);
                }
            }
            else
            {
                ExchangeException.Throw(ErrorCode.INSUFFICIANT_BALANCE, null);
            }
            //_db.Payments.Add(payment);
            _db.Notifications.Add(new Notification()
            {
                IsViewed = false, NotificationDetails = "Fiat Withdraw is Requested", NotificationHeading = "Withdraw Request", RedirectAction = "WithDrawals", RedirectController = "Admin", NotificationType = "Desktop Notification"
            });
            //wallet.FirstOrDefault().Balance -= payment.FiatAmount.Value;
            _db.Configuration.ValidateOnSaveEnabled = false;
            _db.SaveChanges();
            try
            {
                string _email = _db.Accounts.Where(x => x.AccountId == payment.Account_Id).Select(x => x.Email).FirstOrDefault();
                SMTPMailClient.SendRawEmail("clientservice @nanopips.com",
                                            "Withdraw Request from " + _email + " <br/> " +
                                            "Amount:  " + payment.FiatAmount + " " + payment.Currency + " <br/> " +
                                            "Date: " + payment.PaymentDate + " <br/> " +
                                            "BankName:  " + payment.BankName + " <br/> " +
                                            "ABA Routing #, IBN #,SWIFT Code:  " + payment.IBAN + " <br/> " +
                                            "Address:  " + payment.BankAddress + " <br/>  " +
                                            "Full Name:  " + payment.BankAccountTitle + " <br/> " +
                                            "Account Number:  " + payment.BankAccountNumber + " <br/> " +
                                            ((payment.Reason != null) ? ("Reason:  " + payment.Reason + "<br/>") : " <br/> "), "New Withdrawal Request");
                SMTPMailClient.SendRawEmail(_email, "Thank you for contacting NanoPips. Please allow up to 24 hours for support to respond to your inquiry. ", "New Withdrawal Request");
            }
            catch (Exception ex)
            {
                ExchangeException.Throw(ex.Message);
            }
            return(_db.Accounts.Find(payment.Account_Id));
        }