public static async Task <string> SpectaFinal(SpectaProcess2 spectaProcess) { string IsSuccessful = ""; _apiService = new ApiRequest(); try { var response = await _apiService.Post <SpectaProcess2>(spectaProcess, "", URLConstants.SpectaAPILiveBaseUrl, "Process", "FinishQuickLoan"); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var resp = JsonConvert.DeserializeObject <ProcessStatus>(content); IsSuccessful = resp.status.ToString(); } return(IsSuccessful); } catch (Exception ex) { return(IsSuccessful); } }
private async void btnConfirm_Clicked(object sender, EventArgs e) { var pd = await ProgressDialog.Show("Sending Request. Please Wait..."); try { if (IsEntryValidated() == true) { SpectaProcess.otp = otp; SpectaProcess.isTermsAccepted = IsAcceptLicence.ToString(); var processModel = new SpectaProcess2() { firstName = SpectaProcess.firstName, lastName = SpectaProcess.lastName, dateOfBirth = SpectaProcess.dateOfBirth, isTermsAccepted = SpectaProcess.isTermsAccepted, acctNo = SpectaProcess.acctNo, accomodationType = SpectaProcess.accomodationType, address = SpectaProcess.address, bvn = SpectaProcess.bvn, channelId = SpectaProcess.channelId, eligibleAmt = SpectaProcess.eligibleAmt, email = SpectaProcess.email, empAddress = SpectaProcess.empAddress, empName = SpectaProcess.empName, gender = SpectaProcess.gender, howLongInResidence = SpectaProcess.howLongInResidence, isCustomer = SpectaProcess.isCustomer == "Yes" ? SpectaProcess.isCustomer = "1" : SpectaProcess.isCustomer = "0", jobChangeCount = SpectaProcess.jobChangeCount, loanPurpose = SpectaProcess.loanPurpose, maritalStatus = SpectaProcess.maritalStatus, numberOfDependants = SpectaProcess.numberOfDependants, otp = SpectaProcess.otp, phoneNumber = SpectaProcess.phoneNumber, reqAmt = SpectaProcess.reqAmt, salaryAmt = SpectaProcess.salaryAmt, Salary_Act_No = SpectaProcess.Salary_Act_No == null ? SpectaProcess.Salary_Act_No = SpectaProcess.acctNo : SpectaProcess.Salary_Act_No, tenor = SpectaProcess.tenor }; var response = await SpectaService.SpectaFinal(processModel); if (!string.IsNullOrEmpty(response)) { if (response == "1") { // it is successful. Give a MessageDialog.Show("SUCCESS", "Your Loan application was successful.", DialogType.Success, "OK", null); Application.Current.MainPage = new AnimationNavigationPage(new Dashboard.Dashboard()); } else { MessageDialog.Show("OOPS", "Sorry, we are unable to place your request at the moment.\n Kindly try again later or contact our customer care", DialogType.Success, "OK", null); return; // Unsuccessful } } } } catch (Exception ex) { await pd.Dismiss(); // catch any exception } }