예제 #1
0
        public async Task <IActionResult> ResendOtp([FromBody] RequestResendOtp payload)
        {
            await _otpService.ResendOtp(payload);

            return(StatusCode(StatusCodes.Status200OK,
                              new Response(true, HttpStatusCode.OK, Messages.Misc_Success)));
        }
예제 #2
0
        public async Task ResendOtp(RequestResendOtp payload)
        {
            var wallet = await _walletRepository.GetByWalletIdentifier(payload.WalletId);

            if (wallet == default)
            {
                throw new NotFoundException();
            }

            await GenerateAndSendOtpAsync(payload.MobileNumber.ToString(), wallet);
        }
예제 #3
0
        public async Task <TokenResponse> ResendOtpAsync(RequestResendOtp payload, string authToken)
        {
            var authTokenDetails = _tokenService.GetDetailsFromToken(authToken);

            if (!await ValidateOtpCreationAsync(payload.MobileNumber))
            {
                throw new ValidationException(Messages.Token_OTPThreshold);
            }

            var wallet = await _walletRepository.GetAsync(Guid.Parse(authTokenDetails.WalletId));

            if (wallet == default)
            {
                throw new NotFoundException(Messages.Wallet_NotFound);
            }

            var otp = await GenerateAndSendOtpAsync(payload.MobileNumber);

            return(new TokenResponse()
            {
                Token = _tokenService.GenerateToken(wallet.Id.ToString(), otp)
            });
        }
예제 #4
0
 public async Task <IActionResult> ResendOtp([FromBody] RequestResendOtp payload)
 {
     return(StatusCode(StatusCodes.Status200OK,
                       new Response(await _otpService.ResendOtpAsync(payload, Request.Headers["Authorization"]), true, HttpStatusCode.OK, Messages.Misc_Success)));
 }