public static async Task <bool> VerifyRegistrationStatus(UserAlreadyExist model) { bool IsExisting = false; try { _apiService = new ApiRequest(); var response = await _apiService.Post <UserAlreadyExist>(model, "", URLConstants.SwitchApiBaseUrl, "Switch/CheckIfUserAlreadyExist", "Onboarding"); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var resp = JsonConvert.DeserializeObject <string>(content); if (resp == "true") { IsExisting = true; } else { IsExisting = false; } } } catch (Exception ex) { string log = ex.Message; } return(IsExisting); }
async Task <bool> DoAccountVerification() { bool status = false; var pd = await ProgressDialog.Show("Processing Request..... Please wait."); Random r = new Random(); r.Next(1000, 9999); var otpRequest = new OTPRequestMobile() { mobile = _vm.WalletPhone, Referenceid = "00055" + DateTime.Now.ToString("yymmddHHmmss") + r.Next().ToString(), RequestType = 142, Translocation = GlobalStaticFields.GetUserLocation, email = _vm.Email }; // lets check if the user exist before now. var user = new UserAlreadyExist() { Phone = _vm.WalletPhone, UserEmail = _vm.Email }; var userResponse = await OnBoardingService.VerifyRegistrationStatus(user); if (userResponse == true) // value should be compared against true. this condition was changed on purpose for test { await pd.Dismiss(); MessageDialog.Show("OOPS", "Sorry, It appears that you already onboarded. Kindly review your details and try again, or contact our switch support.", DialogType.Error, "DISMISS", null); } else { var otpresponse = await OnBoardingService.IsOtpSent(otpRequest); if (otpresponse) { await pd.Dismiss(); MessageDialog.Show("SUCCESS", $"An OTP has been sent to your mobile number {phone} and Email {_vm.Email}", DialogType.Success, "OK", null); status = true; } } return(status); }