Exemple #1
0
        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);
        }
    }
Exemple #2
0
        public void ParseValidTransferAction(Action action, PackedTransaction packedTransaction,
                                             GetBlockResponse blockResponse)
        {
            TransferData transferData = JsonHelper.DeserializeObject <TransferData>(action.Data.ToString());

            if (String.IsNullOrEmpty(transferData.Quantity))
            {
                return;
            }
            if (transferData.Symbol() == CryptoCurrency.VAKA)
            {
                // If receiver doesn't exist in wallet table then stop
                if (!_walletBusiness.CheckExistedAndUpdateByAddress(transferData.To, transferData.Amount(),
                                                                    transferData.Symbol()))
                {
                    return;
                }

                // Save to table in db
                _vakacoinBusiness.CreateDepositTransaction(packedTransaction.Id, (int)blockResponse.BlockNum,
                                                           transferData.Symbol(), transferData.Amount(), transferData.From, transferData.To, 0,
                                                           Status.STATUS_SUCCESS);

                //create pending email
                var createEmailResult = CreatePendingEmail(transferData);
                if (createEmailResult.Status == Status.STATUS_SUCCESS)
                {
                    logger.Info("Create pending email success");
                }
                else
                {
                    logger.Error("Create Pending email error!!!" + createEmailResult.Message);
                }

                logger.Info(String.Format("{0} was received {1}", transferData.To, transferData.Quantity));
            }
        }