Esempio n. 1
0
        private UserEntity Map_Request_Model(SignupModel request, TokenDetailsEntity token)
        {
            UserEntity mDBEntity = new UserEntity();

            mDBEntity.USERID                   = request.Email;
            mDBEntity.FIRSTNAME                = request.FirstName;
            mDBEntity.LASTNAME                 = request.LastName;
            mDBEntity.EMAILID                  = EncryptDecrypt.EncryptStringAES(request.Email);
            mDBEntity.PASSWORD                 = EncryptDecrypt.EncryptStringAES(request.Password);;
            mDBEntity.ISDCODE                  = request.ISDCode;
            mDBEntity.MOBILENUMBER             = request.ContactNo;
            mDBEntity.COMPANYNAME              = request.CompanyName;
            mDBEntity.TOKEN                    = token.Token;
            mDBEntity.TOKENEXPIRY              = token.TokenExpiry;
            mDBEntity.NOTIFICATIONSUBSCRIPTION = request.NotificationSubscription;
            mDBEntity.SHIPMENTPROCESS          = request.ShipmentProcess;
            mDBEntity.SHIPPINGEXPERIENCE       = request.ShippingExperience;
            mDBEntity.USERTYPE                 = 2;
            mDBEntity.ISTEMPPASSWORD           = 0;
            mDBEntity.ACCOUNTSTATUS            = 0;
            mDBEntity.ISTERMSAGREED            = 1;
            mDBEntity.COUNTRYCODE              = request.COUNTRYCODE;
            mDBEntity.COUNTRYNAME              = request.CountryName;
            mDBEntity.COUNTRYID                = request.UACountryId;
            _userRepository.Save(mDBEntity);
            return(mDBEntity);
        }
        public void SaveLogic_Is_Mail_Send()
        {
            //
            // Arrange
            bool       isSent     = true;
            UserEntity userEntity = new UserEntity()
            {
                USERID = "*****@*****.**"
            };
            TokenDetailsEntity tokenEntity = new TokenDetailsEntity()
            {
                Token = "fU9A9IKR1kgwQR+HutPBTovLJKH+WbZX"
            };

            _userRepository
            .Setup(m => m.GenerateToken("USER_ACTIVATION_TOKEN_EXPIRY"))
            .Returns(tokenEntity);
            _sendMail
            .Setup(m => m.Sendmail(userEntity, tokenEntity.Token))
            .Returns(isSent);

            //
            // Act
            bool response = _userManagementService.SendMail(userEntity, tokenEntity);

            //
            // Assert
            Assert.True(response);
        }
Esempio n. 3
0
        public dynamic SaveLogic(SignupModel model)
        {
            TokenDetailsEntity tokenEntity = _userRepository.GenerateToken("USER_ACTIVATION_TOKEN_EXPIRY");
            UserEntity         mDBEntity   = Map_Request_Model(model, tokenEntity);

            SendMail(mDBEntity, tokenEntity);
            return(mDBEntity);
        }
Esempio n. 4
0
        public TokenDetailsEntity GenerateToken(string ConfigName)
        {
            byte[] time  = BitConverter.GetBytes(DateTime.UtcNow.ToBinary());
            byte[] key   = Guid.NewGuid().ToByteArray();
            string token = Convert.ToBase64String(time.Concat(key).ToArray());


            string             ConfigValue = GetUMConfigValue(ConfigName);
            TokenDetailsEntity tobj        = new TokenDetailsEntity();

            tobj.Token       = token;
            tobj.TokenExpiry = DateTime.UtcNow.AddHours(int.Parse(ConfigValue));
            return(tobj);
        }
Esempio n. 5
0
 public dynamic SendMail(UserEntity mDBEntity, TokenDetailsEntity tokenEntity)
 {
     return(_mail.Sendmail(mDBEntity, tokenEntity.Token));
 }