Example #1
0
        public async Task <Response> GenerateOtp(OtpGenerationRequest otpGenerationRequest)
        {
            var otp             = otpGenerator.GenerateOtp();
            var generateMessage = GenerateMessage(otpGenerationRequest.GenerationDetail, otp);

            var sendOtp = await smsClient.Send(otpGenerationRequest.Communication.Value, generateMessage, otpGenerationRequest.GenerationDetail.GetTemplateID());

            if (sendOtp.ResponseType == ResponseType.Success)
            {
                return(await otpRepository.Save(otp, otpGenerationRequest.SessionId));
            }

            return(sendOtp);
        }
Example #2
0
 public string CreateOtp(string userId, DateTime date)
 {
     return(_otpGenerator.GenerateOtp(userId, date));
 }