public static async Task <string> UpgradeAccountForT24(UpgradeAccountForT24 upgradeAccountForT24) { string responseData = string.Empty; try { _apiService = new ApiRequest(); var response = await _apiService.Post <UpgradeAccountForT24>(upgradeAccountForT24, "", URLConstants.SwitchApiBaseUrl, "Switch/UpgradeSwitchProfileForT24Acct", "OnboardingAccountPINVerificationPage"); if (response.IsSuccessStatusCode) { responseData = await response.Content.ReadAsStringAsync(); } } catch (Exception ex) { string log = ex.Message; } return(responseData); }
async void DoAccountCreation() { string password = _crypto.Encrypt(Pin); try { if (Pin != PinTracker) { MessageDialog.Show("OOPS", "PIN and Confirm PIN Mismatch. Kindly review and try again.", DialogType.Error, "OK", null); return; } else { var key = await Microsoft.AppCenter.AppCenter.GetInstallIdAsync(); DateTime _dob = _vm.DateOfBirth; var model = new SwitchUser() { UserEmail = _vm.Email, Password = password, Gender = _vm.Gender == "Male" ? "M" : "F", DateOfBirth = _dob, FirstName = _vm.Firstname.Trim(), LastName = _vm.Lastname.Trim(), MiddleName = "N/A", Title = _vm.Gender == "Male" ? "Mr" : "Mrs", TPIN = password, PhoneNumber = _vm.WalletPhone, RefferedBy = _vm.ReferralCode, ReferralCode = GlobalStaticFields.RandomString(8), Device = GlobalStaticFields.Device(), IMEI = GlobalStaticFields.DeviceIMEI(), OS = GlobalStaticFields.DeviceOS(), UniqueKey = key?.ToString() ?? Guid.NewGuid().ToString(), AddressLine1 = string.Empty, AddressLine2 = string.Empty, Nationality = 0, AccessLocation = GlobalStaticFields.GetUserLocation, AccountType = "", CustomerTimeZone = DateTime.Now.ToString("yymmddHHmmss"), HomeAddress = "", IsTPIN = false, SignupVerificationCode = "", SecurityQuestionAndAnswers = _qanda //new List<SecurityQuestionViewModel> {_qanda } }; var pd = await ProgressDialog.Show("Sending Request..... Please wait."); var response = await OnBoardingService.DoSwitchAccountCreation(model); if (!string.IsNullOrEmpty(response)) { var dt = JsonConvert.DeserializeObject <NewStatusMessage>(response); if (dt.Status == true) { MessageDialog.Show("SUCCESS", "Account registration was successful.", DialogType.Success, "OK", null); var upgradeModel = new UpgradeAccountForT24() { BVN = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.BVN != null || g.BVN != String.Empty)?.BVN ?? "", CUSNUM = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.CustomerId != null || g.CustomerId != String.Empty)?.CustomerId ?? "", HomeAddress = "", NUBAN = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.nuban != null || g.nuban != string.Empty)?.nuban ?? "", PhoneNumber = _vm.PhoneNumber }; var upgraded = await OnBoardingService.UpgradeAccountForT24(upgradeModel); if (!string.IsNullOrEmpty(upgraded)) { if (upgraded.Contains("true")) { string message = $"Dear Customer You have successfully Onboarded on Switch. kindly ignore this message if it was you, or report to the nearest Sterling bank office if otherwise."; DoLogin(_vm.Email, password); // loguser in and navigate to dashboard. SendMail(message, _vm.Email); // send mail to the specified email address // registration was successful await pd.Dismiss(); } } } else { await pd.Dismiss(); MessageDialog.Show("OOPS", "Sorry, an error occured at our end. Kindly try again later.", DialogType.Error, "OK", null); return; } } else { await pd.Dismiss(); MessageDialog.Show("OOPS", "Sorry, we are unable to create your account at the moment. Kindly try again.", DialogType.Error, "OK", null); return; } } } catch (Exception ex) { string log = ex.Message; } }