public async Task <IbsresponseRoot> NameInquiryIntrabank(IntraBankNameInquiry intrabankNameInquiry) { var pdd = await ProgressDialog.Show("Name Enquiry. Please wait."); try { string postResponsex = ""; var request = await httpService.PostIBS <IntraBankNameInquiry>(intrabankNameInquiry, "", URLConstants.SwitchApiLiveBaseUrl, "IBSIntegrator/IBSBridgeJSON", "NameEnquiryIntraBank"); if (request.IsSuccessStatusCode) { postResponsex = await request.Content.ReadAsStringAsync(); postResponsex = postResponsex.JsonCleanUp(); var jobj = JsonConvert.DeserializeObject <IbsresponseRoot>(postResponsex); return(jobj); } else { return(new IbsresponseRoot()); } } catch (Exception ex) { await Task.Run(() => (BusinessLogic.Log(ex.ToString(), "exception at name enquiry", "", "", "", "nameenquiry"))); string log = ex.ToString(); return(new IbsresponseRoot()); } finally { await pdd.Dismiss(); } }
private async void ConsumateTransfer() { try { BusinessLogic bl = new BusinessLogic(); var selectedDisplayedAcct = AccountListPicker.SelectedItem; var Nuban = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(k => k.AccountBalanceAccountType.ToLower().Trim() == selectedDisplayedAcct.ToLower().Trim()).nuban; svmx.AmountInputted = txtAmount.Text; svmx.MyAccount = Nuban; if (svmx.IsNewRecipient) { svmx.BeneficiaryAccount = txtToAccount.Text; } else if (svmx.IsExistingRecipient) { svmx.BeneficiaryAccount = svmx.SavedBeneficiaries.beneficiaryNuban; } //sterling to sterling transfer if (svmx.TransferTypeSelected.ToUpper().Trim() == SendMoneyConstantss.ToSterling.ToUpper().Trim()) { var nameVal = new IntraBankNameInquiry() { NUBAN = svmx.BeneficiaryAccount, ReferenceID = Utilities.GenerateReferenceId(), RequestType = "219" }; //await pd.Message = "Name Enqiury. Please wait"; // var pdd = await ProgressDialog.Show("Name Enquiry. Please wait."); var reply = await bl.NameInquiryIntrabank(nameVal); // await pdd.Dismiss(); if (reply != null) { if (reply.IBSResponse.ResponseCode == "00") { svmx.BeneficiaryName = reply.IBSResponse.ResponseText; svmx.NameofBeneficiaryBank = "Sterling Bank"; svmx.AmountFormattedComma = string.Format("{0:n}", Convert.ToInt32(svmx.AmountInputted)); if (SwitchSchedulePayment.IsToggled) { var ScheduleID = svmx.paymentScheduleTypes.FirstOrDefault(x => x.SchedulePaymentText == RepeatSchedule.SelectedItem.Trim()).SchedulePaymenyID; var FrequencyID = ScheduleFrequency(ScheduleDatePicker.Date, scheduleEndDatePicker.Date); svmx.createScheduleDebitPayment = new CreateScheduleDebitPayment { Amount = decimal.Parse(svmx.AmountInputted), bankCode = "0001", BillType = 1, FromAccount = svmx.MyAccount, remarks = txtReference.Text, Scheduled = ScheduleID, ScheduledCount = FrequencyID, StartDate = scheduleDate, ToAccount = svmx.BeneficiaryAccount }; //svmx.createScheduleDebitPayment = s; var msg = RepeatSchedule.SelectedItem.Trim() != "Never" ? RepeatSchedule.SelectedItem.Trim() : string.Empty; MessageDialog.Show("Confimation", $"You have initiated a {msg} schedule payment of {svmx.AmountInputted} to {reply.IBSResponse.ResponseText} of sterling bank to start on {scheduleDate} for " + $"{svmx.createScheduleDebitPayment.ScheduledCount} times {Environment.NewLine} Do you want to continue", DialogType.Info, "Yes", () => { Device.BeginInvokeOnMainThread(() => { if (GlobalStaticFields.Customer.IsTPin) { var SchedulePayTPIN = new PopUps.VerifyPinPage("Confirm schedule payment", svmx.AmountFormattedComma, "NGN", null); SchedulePayTPIN.Validated += SchedulePayTPIN_Validated; } else { CreateScheduleDebitSteringBank(svmx.createScheduleDebitPayment); } }); } , "No", null); } else { svmx.SterlingToSterling = new TransferSterlingToSterling() { Amount = txtAmount.Text, FromAccount = Nuban, ToAccount = svmx.BeneficiaryAccount, PaymentReference = txtReference.Text, ReferenceID = Utilities.GenerateReferenceId(), RequestType = "102" }; svmx.AmountFormattedComma = string.Format("{0:n}", Convert.ToInt32(svmx.AmountInputted)); MessageDialog.Show("Confirmation", $"You have initiated a transfer of NGN {svmx.AmountFormattedComma} to {svmx.BeneficiaryName} of Sterling" + Environment.NewLine + "Do you want to continue?", DialogType.Info, "Yes", () => { Device.BeginInvokeOnMainThread(() => { if (GlobalStaticFields.Customer.IsTPin) { var SendMoneyVerifySterlingTPIN = new PopUps.VerifyPinPage("Confirmation", svmx.AmountFormattedComma, "NGN", null); SendMoneyVerifySterlingTPIN.Validated += SendMoneyVerifyTPIN_Validated; Navigation.PushAsync(SendMoneyVerifySterlingTPIN); } else { ConsumateTransferToSterling(svmx.SterlingToSterling); } //ConsumateTransferToSterling2(); } ); } , "No", null ); } } else { MessageDialog.Show("Info", "Name Enquiry failed at this time. Please try again", DialogType.Info, "OK", null, "", null); } } else { MessageDialog.Show("Info", "Could not verify the name at this time. Please try again", DialogType.Info, "OK", null, "", null); } } else if (svmx.TransferTypeSelected.ToUpper().Trim() == SendMoneyConstantss.ToOtherBank.ToUpper().Trim())//sterling to other banks { try { if (svmx.IsNewRecipient) { svmx.NameofBeneficiaryBank = txtRecipientBank.Text; } else if (svmx.IsExistingRecipient) { svmx.NameofBeneficiaryBank = svmx.SavedBeneficiaries.Bank; svmx.DestinationBankCode = svmx.SavedBeneficiaries.BankCode; } if (string.IsNullOrEmpty(svmx.DestinationBankCode)) { svmx.DestinationBankCode = GetBankCode(txtRecipientBank.Text); } if (string.IsNullOrEmpty(svmx.DestinationBankCode)) { MessageDialog.Show("Error", "Destination bank code error. Please try again", DialogType.Error, "OK", null, "", null); return; } var nameVal = new InterbankNameInquiry() { DestinationBankCode = svmx.DestinationBankCode, ToAccount = svmx.BeneficiaryAccount, ReferenceID = Utilities.GenerateReferenceId(), RequestType = "105" }; var pdNameEnq = await ProgressDialog.Show("Name Enuiry. Please wait."); var nameValResp = await bl.NameInquiryInterbank(nameVal); await pdNameEnq.Dismiss(); if (nameValResp.IBSResponse.ResponseCode == "00") { svmx.BeneficiaryName = nameValResp.IBSResponse.AccountName; if (SwitchSchedulePayment.IsToggled) { var ScheduleID = svmx.paymentScheduleTypes.FirstOrDefault(x => x.SchedulePaymentText == RepeatSchedule.SelectedItem.Trim()).SchedulePaymenyID; var FrequencyID = ScheduleFrequency(ScheduleDatePicker.Date, scheduleEndDatePicker.Date); svmx.createScheduleDebitPayment = new CreateScheduleDebitPayment { Amount = decimal.Parse(svmx.AmountInputted), bankCode = svmx.DestinationBankCode, BillType = 2, FromAccount = svmx.MyAccount, remarks = txtReference.Text, Scheduled = ScheduleID, ScheduledCount = FrequencyID, StartDate = scheduleDate, ToAccount = svmx.BeneficiaryAccount }; var msg = RepeatSchedule.SelectedItem.Trim() != "Never" ? RepeatSchedule.SelectedItem.Trim() : string.Empty; MessageDialog.Show("Confimation", $"You have initiated a {msg} schedule payment of {svmx.AmountInputted} to {svmx.BeneficiaryName} of {svmx.NameofBeneficiaryBank} to start on {scheduleDate} for " + $"{svmx.createScheduleDebitPayment.ScheduledCount} times {Environment.NewLine} Do you want to continue", DialogType.Info, "Yes", () => { Device.BeginInvokeOnMainThread(() => { if (GlobalStaticFields.Customer.IsTPin) { var SchedulePayTPIN = new PopUps.VerifyPinPage("Confirm schedule payment", svmx.AmountFormattedComma, "NGN", null); SchedulePayTPIN.Validated += SchedulePayTPIN_Validated; } else { CreateScheduleDebitSteringBank(svmx.createScheduleDebitPayment); } }); } , "No", null); } else { svmx.OtherBanks = new OtherBanks() { Amount = Convert.ToDouble(txtAmount.Text), ToAccount = svmx.BeneficiaryAccount, DestinationBankCode = svmx.DestinationBankCode, ReferenceID = Utilities.GenerateReferenceId(), RequestType = "101", PaymentReference = txtReference.Text, SessionID = nameValResp.IBSResponse.SessionID, NEResponse = nameValResp.IBSResponse.ResponseCode, BenefiName = nameValResp.IBSResponse.AccountName, FromAccount = Nuban }; svmx.AmountFormattedComma = string.Format("{0:n}", Convert.ToInt32(svmx.AmountInputted)); MessageDialog.Show("Confirmation", $"You have initiated a transfer of {Utilities.GetCurrency("NGN")} {svmx.AmountFormattedComma} to {svmx.BeneficiaryName } of {svmx.NameofBeneficiaryBank}.{Environment.NewLine} You will charged {Utilities.GetCurrency("NGN")}52.50." + Environment.NewLine + "Do you want to continue?", DialogType.Info, "Yes", () => { Device.BeginInvokeOnMainThread(() => { if (GlobalStaticFields.Customer.IsTPin) { var SendMoneyVerifyTPINOtherBanks = new PopUps.VerifyPinPage("Confirmation", svmx.AmountFormattedComma, "NGN", null); SendMoneyVerifyTPINOtherBanks.Validated += SendMoneyVerifyTPINOtherBanks_Validated; Navigation.PushAsync(SendMoneyVerifyTPINOtherBanks); } else { ConsumateTransferToOtherbanks(svmx.OtherBanks); } }); }, "No", null); } } else { MessageDialog.Show("Error", "Error during name enquiry", DialogType.Error, "OK", null, "", null); //await pdd.Dismiss(); } } catch (Exception ex) { string log = ex.ToString(); await BusinessLogic.Log(log, "error at send money", "", "", "", ""); } } else { Device.BeginInvokeOnMainThread(() => { MessageDialog.Show("Info", "Did not find the configured transfer type", DialogType.Error, "OK", null); }); } } catch (Exception ex) { var log = ex; await BusinessLogic.Log(ex.ToString(), "Error at Send money", "", "", "", "SendMoneyLocally"); Device.BeginInvokeOnMainThread(() => { MessageDialog.Show("Info", "Sorry. Error Occured. Please try again", DialogType.Error, "OK", null); }); } //await pdd.Dismiss(); }