public async void DoFixedDeposit() { var accSplitted = Utilities.SplitBeneficiaryDetailsByTab(InvestAccount.Trim()); // string investAccount = accSplitted[0]; if (GlobalStaticFields.Customer.IsTPin) { var ValidateFixDepositWithTPIN = new PopUps.VerifyPinPage("Confirmation", FixedDepositDataModel.InvestAmount, "NGN", null); ValidateFixDepositWithTPIN.Validated += ValidateFixDepositWithTPIN_Validated; await Navigation.PushAsync(ValidateFixDepositWithTPIN); } else { await NewMethod(); } }
private async Task NewMethod() { var pd = await ProgressDialog.Show("Sending Request. Please Wait..."); try { var accSplitted = Utilities.SplitBeneficiaryDetailsByTab(InvestAccount.Trim()); string investAccount = accSplitted[0]; string currencyCode = "NGN"; string capitalAcct = investAccount; string InvestAcct = investAccount.Trim(); string InterestAcct = investAccount; string t = FixedDepositDataModel.Tenure; var t2 = t.Split(' '); var day = t2[1]; var day2 = t2[2]; var dd = day2.Substring(0, 1); string tenure = $"{day}{dd}"; var deposit = new FixedDepositModel() { ReferenceID = Utilities.GenerateReferenceId(), amount = Convert.ToDecimal(FixedDepositDataModel.InvestAmount), RequestType = 926.ToString(), changeperiod = tenure, payinacct = capitalAcct ?? "", payoutacct3 = InvestAcct ?? capitalAcct, payoutacct2 = InterestAcct ?? capitalAcct, payoutacct1 = InvestAcct ?? capitalAcct, customerid = GlobalStaticFields.Customer.CustomerId, currency = currencyCode, rate = FixedDepositDataModel.Rate, effectivedate = DateTime.Now.ToString("yyyy-MM-dd") }; var request = await apirequest.PostIBS <FixedDepositModel>(deposit, "", URLConstants.SwitchApiLiveBaseUrl, "IBSIntegrator/IBSBridge", "FixedDepositPage"); // modify this line var response = ""; string arrangementId = ""; if (request.IsSuccessStatusCode) { response = await request.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(response) && !response.Contains("Unable to connect to the remote server") && !response.Contains("Connection refused")) { arrangementId = GetXMlString(response); var invest = new SaveInvestment() { amount = FixedDepositDataModel.InvestAmount, customerid = GlobalStaticFields.Customer.CustomerId, Ref = arrangementId }; if (arrangementId == "x011") { await pd.Dismiss(); MessageDialog.Show("OOPS", "Sorry, we are unable to process your request at the moment. Kindly try again later", DialogType.Error, "DISMISS", null); return; } var resp = await apirequest.Post <SaveInvestment>(invest, "", URLConstants.SwitchApiLiveBaseUrl, "Switch/SaveInvest", "FixedDepositPage"); if (resp.IsSuccessStatusCode) { await pd.Dismiss(); var res = await resp.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(res)) { MessageDialog.Show("SUCCESS", $"Your Fixed Deposit placement worth of {FixedDepositDataModel.InvestAmount} was successful.", PopUps.DialogType.Success, "OK", null); // may need further check await Navigation.PushAsync(new AllInvestments.AllInvestments()); } } } else { await pd.Dismiss(); MessageDialog.Show("Internal Error", "Sorry, we are unable to process your request at the moment. Please try again later...", PopUps.DialogType.Error, "OK", null); return; } } } catch (Exception ex) { await pd.Dismiss(); await BusinessLogic.Log(ex.ToString(), "exception response buying fixed deposit for user " + GlobalStaticFields.Customer.Email, "/api/IBSIntegrator/IBSBridge", "", ex.ToString(), "Fixed DepositPage"); MessageDialog.Show("OOPS", "Sorry, We are unable to process your request at the moment. Please try again later", DialogType.Error, "DISMISS", null); } await pd.Dismiss(); }