public ReturnObject CreatePendingEmail(TransferData transferData) { logger.Info("Create pending email"); string address = transferData.To; string toEmail = _walletBusiness.FindEmailByAddressAndNetworkName(address, transferData.Symbol()); if (toEmail == null) { return new ReturnObject { Status = Status.STATUS_ERROR, Message = "Cannot find email address of user!!" } } ; var email = new EmailQueue { ToEmail = toEmail, SignInUrl = EmailConfig.SIGN_IN_URL, Amount = transferData.Amount(), Template = EmailTemplate.Received, // SentOrReceived = EmailConfig.SentOrReceived_Received, NetworkName = transferData.Symbol(), Subject = EmailConfig.SUBJECT_SENT_OR_RECEIVED, Status = Status.STATUS_PENDING, IsProcessing = 0, Version = 0 }; var result = _sendMailBusiness.CreateEmailQueueAsync(email); return(result.Result); } }
public void CreateEmailTest() { Assert.AreEqual(Status.STATUS_SUCCESS, _mailBusiness.CreateEmailQueueAsync(new EmailQueue { ToEmail = "*****@*****.**", Subject = "Unit test subject", Status = Status.STATUS_PENDING, Template = EmailTemplate.Received, SignInUrl = "google.com.vn", Amount = 1, // SentOrReceived = EmailConfig.SentOrReceived_Sent, NetworkName = "EOS" }).Result.Status); }
public ReturnObject UpdateBalanceDeposit(string toAddress, decimal addedBalance, string networkName) { try { // userID = ""; if (_connectionDb.State != ConnectionState.Open) { _connectionDb.Open(); } var wallet = FindByAddressAndNetworkName(toAddress, networkName); if (wallet == null) { return(new ReturnObject { Status = Status.STATUS_ERROR, Message = "Update fail, Address not exists" }); } if (!wallet.Currency.Equals(networkName)) { return(new ReturnObject { Status = Status.STATUS_ERROR, Message = "Not same network" }); } // wallet.Balance += addedBalance; // wallet.Version += 1; // var result = walletRepository.Update(wallet); var result = UpdateBalance(addedBalance, wallet.Id, wallet.Version); if (result.Status == Status.STATUS_ERROR) { return(result); } else { User user = userBusiness.GetUserById(wallet.UserId); // userID = user.Id; if (user != null) { portfolioHistoryBusiness.InsertWithPrice(user.Id); //send mail: EmailQueue email = new EmailQueue() { ToEmail = user.Email, NetworkName = wallet.Currency, Amount = addedBalance, Template = EmailTemplate.Received, Subject = EmailConfig.SUBJECT_SENT_OR_RECEIVED, // Content = networkName + "+" + addedBlance }; result = sendMailBusiness.CreateEmailQueueAsync(email).Result; } } return(result); } catch (Exception e) { // userID = ""; return(new ReturnObject { Status = Status.STATUS_ERROR, Message = e.Message }); } }