private async Task <StatusMessage> _validateOTP(ValOtpRequestMobile request) { try { request.Referenceid = Utilities.GenerateReferenceId(); request.RequestType = "143"; request.Translocation = "0,099"; var loginResponse = await httpService.Post <ValOtpRequestMobile>(request, "", URLConstants.SwitchApiBaseUrl, "Spay/ValOTPRequestMobile", "SetNewPinPage"); if (loginResponse.IsSuccessStatusCode) { var response = await loginResponse.Content.ReadAsStringAsync(); var Message = JsonConvert.DeserializeObject <StatusMessage>(response); return(Message); } else { return(new StatusMessage()); } } catch (Exception ui) { await BusinessLogic.Log(ui.ToString(), "Exception Validating OTP on Forgot Password Page", string.Empty, string.Empty, string.Empty, string.Empty); return(new StatusMessage()); } }
private async void DoOTPVerification() { var pd = await ProgressDialog.Show("Processing Request..... Please wait."); try { Random r = new Random(); r.Next(1000, 9999); var otpRequest = new ValOtpRequestMobile() { mobile = _vm.WalletPhone, otp = Pin, Referenceid = "00055" + DateTime.Now.ToString("yymmddHHmmss") + r.Next().ToString(), RequestType = "143", Translocation = GlobalStaticFields.GetUserLocation }; var response = await OnBoardingService.ValidateOTP(otpRequest); if (!string.IsNullOrEmpty(response)) { var data = JsonConvert.DeserializeObject <StatusMessage>(response); if (data.response == "00") { await pd.Dismiss(); MessageDialog.Show("SUCCESS", "OTP Verification and wallet creation was successful.", DialogType.Success, "OK", null); // before creating the pin, lets set some security questions // Navigation.PushAsync(new AccountPinCreation(_vm)); Navigation.PushAsync(new SecurityQuestionPage(_vm)); } } else { await pd.Dismiss(); MessageDialog.Show("OOPS", "OTP Verification was not successful. Kindly verify and try again", DialogType.Error, "OK", null); return; } await pd.Dismiss(); } catch (Exception ex) { await pd.Dismiss(); string log = ex.Message; } }
public static async Task <bool> ValidateOTP(string OTP) { bool result = false; try { string baseUrl = URLConstants.SwitchApiLiveBaseUrl; string endpoint = "spay/ValOTPRequestMobile"; string url = baseUrl + endpoint; var otpRequest = new ValOtpRequestMobile() { mobile = Customer.PhoneNumber, otp = OTP, Referenceid = Utilities.GenerateReferenceId(), RequestType = "143", Translocation = GetUserLocation }; var apirequest = new ApiRequest(); var request = await apirequest.Post(otpRequest, "", baseUrl, endpoint, "ValidateOTP()"); var response = await request.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(response)) { var json = JsonConvert.DeserializeObject <StatusMessage>(response); if (json.response == "00") { result = true; } else { result = false; } } } catch (Exception ex) { await BusinessLogic.Log(ex.ToString(), " exception response calling end point", "ValOTPRequestMobile", "", "", "ValidateOTP()"); string log = ex.Message; result = false; } return(result); }
public static async Task <string> ValidateOTP(ValOtpRequestMobile valOtpRequestMobile) { string responseData = string.Empty; try { _apiService = new ApiRequest(); var response = await _apiService.Post <ValOtpRequestMobile>(valOtpRequestMobile, "", URLConstants.SwitchApiBaseUrl, "Spay/ValOTPRequestMobile", "OnBoardingOTPVerification"); if (response.IsSuccessStatusCode) { responseData = await response.Content.ReadAsStringAsync(); } } catch (Exception ex) { string log = ex.Message; } return(responseData); }
private async void btnContinue_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtOTP.Text)) { MessageDialog.Show("OOPS", "Please enter the OTP that was sent to your registered email and mobile number", DialogType.Error, "OK", null); return; } if (string.IsNullOrEmpty(txtPin.Text)) { MessageDialog.Show("OOPS", "Please enter your new PIN", DialogType.Error, "OK", null); return; } if (string.IsNullOrEmpty(txtConfirmPin.Text)) { MessageDialog.Show("OOPS", "Please confirm your new PIN", DialogType.Error, "OK", null); return; } if (txtPin.Text != txtConfirmPin.Text) { MessageDialog.Show("OOPS", "Sorry, PIN and Confirm PIN do not match. Kindly review and try again", DialogType.Error, "OK", null); return; } var pd = await ProgressDialog.Show("Sending Request. Please Wait..."); try { var request = new ValOtpRequestMobile(); request.mobile = PhoneNumber; request.otp = txtOTP.Text; var result = await _validateOTP(request); await pd.Dismiss(); if (result.response == "00") { var response = await ChangePassword(); if (response) { MessageDialog.Show("SUCCESS", "Pin Change was Successful. Kindly login with your new PIN", DialogType.Success, "OK", null); await Navigation.PushAsync(new UnProfiledLoginPage()); } else { MessageDialog.Show("OOPS", "Sorry, We are unable to process your request at the moment. Kindly try again later.", DialogType.Error, "OK", null); return; } } else { MessageDialog.Show("OOPS", "Sorry, We are unable to process your request at the moment. Kindly try again later.", DialogType.Error, "OK", null); return; } } catch (Exception ex) { await pd.Dismiss(); MessageDialog.Show("OOPS", "Sorry, An error occured while processing your request. Kindly try again later.", DialogType.Error, "OK", null); string log = ex.Message; } }