public async Task <IActionResult> ResendOtp([FromBody] RequestResendOtp payload) { await _otpService.ResendOtp(payload); return(StatusCode(StatusCodes.Status200OK, new Response(true, HttpStatusCode.OK, Messages.Misc_Success))); }
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); }
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) }); }
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))); }