public TeamDaze.BLL.DTO.BvnSearchResp BvnSearch(string bvn) { NibssRepository restobj = new NibssRepository(); var resp = restobj.BvnSearch(bvn); return(resp); }
protected void btnVerifyBVN_Click(object sender, EventArgs e) { formone.Visible = false; formtwo.Visible = true; if (cardBVN.Text == "" || txtCardNumber.Text == "" || txtCVV.Text == "" || txtPin.Text == "") { Response.Write("<script language='javascript'>alert('Please Fill All Fields');</script>"); return; } try { NibssRepository nibss = new NibssRepository(); string EndpointUrl = $"{BaseUrl}/api/nibss/searchbvn?bvn={cardBVN.Text}"; string responseString = ""; // var bvnSearchResponse = await new ApiRequest(EndpointUrl).MakeHttpClientRequest(null, ApiRequest.Verbs.GET, null); //if (bvnSearchResponse.StatusCode == System.Net.HttpStatusCode.OK) if (true) { // DefaultApiReponse<BvnSearchResp> response = Newtonsoft.Json.JsonConvert.DeserializeObject<DefaultApiReponse<BvnSearchResp>>(responseString); var response = nibss.BvnSearch(cardBVN.Text); //Session["BvnSearchResp"] = response.Object; Session["BvnSearchResp"] = response; Random rnd = new Random(); string Otp = rnd.Next(0, 9999).ToString("D4"); //string phoneNo = response.Object.PhoneNumber1; string phoneNo = response.PhoneNumber2; OtpRequest otpRequest = new OtpRequest { Bvn = cardBVN.Text, Otp = Otp }; EndpointUrl = $"{BaseUrl}/api/otp"; // var r = await new ApiRequest(EndpointUrl).MakeHttpClientRequest(otpRequest, ApiRequest.Verbs.POST, null); //if (r.StatusCode == System.Net.HttpStatusCode.OK) if (true) { // responseString = await r.Content.ReadAsStringAsync(); //EmailSender.SendMail(response.Email, Otp); mailTrxn.SendMailAlerts(response.Email, "Your otp is" + Otp, "Team Daze OTP"); } } else { Alertdiv.InnerText = "Unable To Get BVN From NiBSS"; Alertdiv.Visible = true; return; } } catch (Exception ex) { // new ErrorLog(); TeamDaze.BLL.DAL.ErrorLog loggger = new ErrorLog(ex.ToString()); Response.Write("<script language='javascript'>alert('an error occured, kindly try again');</script>"); return; } }
public async Task <IApiResponse <BvnSearchResp> > BVNSearch(string bvn) { var result = nibssRepository.BvnSearch(bvn); return(await HandleApiOperationAsync(async() => { return new DefaultApiReponse <BvnSearchResp> { Object = result }; })); }