private void LicenseApproved() { checkVRNwithICEcashResponse response = new checkVRNwithICEcashResponse(); ObjToken = objfrmQuote.CheckParterTokenExpire(); if (ObjToken != null) { parternToken = ObjToken.Response.PartnerToken; } List <VehicleLicQuote> obj = new List <VehicleLicQuote>(); obj.Add(new VehicleLicQuote { VRN = txtLicVrn.Text, IDNumber = "ABCDEFGHIJ1", ClientIDType = "1", LicFrequency = "3" }); ResultRootObject quoteresponse = IcServiceobj.LICQuote(obj, ObjToken.Response.PartnerToken); response.result = quoteresponse.Response.Result; if (response.result == 0) { response.message = quoteresponse.Response.Quotes[0].Message; } else { if (quoteresponse.Response.Quotes != null) { List <VehicleLicQuoteUpdate> objLicQuoteUpdate = new List <VehicleLicQuoteUpdate>(); foreach (var item in quoteresponse.Response.Quotes.ToList()) { objLicQuoteUpdate.Add(new VehicleLicQuoteUpdate { PaymentMethod = Convert.ToInt32("1"), Status = "1", DeliveryMethod = Convert.ToInt32("1"), LicenceID = Convert.ToInt32(item.LicenceID) }); } ResultRootObject quoteresponseNew = IcServiceobj.LICQuoteUpdate(objLicQuoteUpdate, ObjToken.Response.PartnerToken); response.result = quoteresponseNew.Response.Result; if (response.result == 0) { response.message = quoteresponse.Response.Quotes[0].Message; } else { if (quoteresponse.Response.Quotes != null) { var LicenceID = quoteresponse.Response.Quotes[0].LicenceID; // ResultRootObject quoteresponseResult = IcServiceobj.LICResult(LicenceID, ObjToken.Response.PartnerToken); } } } } }
public JsonResult getPolicyDetailsFromICEcash(string regNo, string PaymentTerm, string SumInsured, int CoverTypeId, int VehicleType, bool VehilceLicense, bool RadioLicense, string firstName, string lastName, string email, string address, string phone, string nationalId, string radioLicensePaymentTerm, string zinaraLicensePaymentTerm, int vehilceUsage) { checkVRNwithICEcashResponse response = new checkVRNwithICEcashResponse(); JsonResult json = new JsonResult(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; //json.Data = ""; try { Insurance.Service.ICEcashService ICEcashService = new Insurance.Service.ICEcashService(); var tokenObject = new ICEcashTokenResponse(); #region get ICEcash token string patnerToken = SummaryDetailService.GetLatestToken(); if (patnerToken == "") { tokenObject = ICEcashService.getToken(); SummaryDetailService.UpdateToken(tokenObject); } CustomerModel model = new CustomerModel { FirstName = firstName, LastName = lastName, EmailAddress = email, PhoneNumber = phone, AddressLine1 = address, NationalIdentificationNumber = nationalId, AddressLine2 = "" }; Session["CustomerDataModal"] = model; #endregion List <RiskDetailModel> objVehicles = new List <RiskDetailModel>(); //objVehicles.Add(new RiskDetailModel { RegistrationNo = regNo }); objVehicles.Add(new RiskDetailModel { RegistrationNo = regNo, PaymentTermId = Convert.ToInt32(PaymentTerm) }); if (patnerToken != "") { DateTime Cover_StartDate = DateTime.Now; int numOfMonth = 12; if (PaymentTerm == "1") { numOfMonth = 12; } else { numOfMonth = Convert.ToInt32(PaymentTerm); } DateTime Cover_EndDate = DateTime.Now.AddMonths(numOfMonth); ResultRootObject quoteresponse = new ResultRootObject(); // ResultRootObject quoteresponse = ICEcashService.RequestQuote(tokenObject.Response.PartnerToken, regNo, SumInsured, make, model, Convert.ToInt32(PaymentTerm), Convert.ToInt32(VehicleYear), CoverTypeId, VehicleUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate); VehicleService vehicleSerive = new VehicleService(); //var product = vehicleSerive.GetVehicleTypeByProductId(VehicleType); //var tempVehicleType = VehicleType; //if (product != null) // tempVehicleType = product.VehicleTypeId; // quoteresponse = ICEcashService.TPILICQuoteWebUser(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, radioLicensePaymentTerm, zinaraLicensePaymentTerm); //if (VehilceLicense) // quoteresponse = ICEcashService.TPILICQuoteWebUser(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, radioLicensePaymentTerm, zinaraLicensePaymentTerm); //else // quoteresponse = ICEcashService.RequestQuote(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1"); if (VehilceLicense && RadioLicense) { quoteresponse = ICEcashService.TPILICQuote(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, zinaraLicensePaymentTerm, radioLicensePaymentTerm); } else if (VehilceLicense) { quoteresponse = ICEcashService.TPILICQuoteZinaraOnly(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, zinaraLicensePaymentTerm); } else { quoteresponse = ICEcashService.RequestQuote(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1"); } // Invalid Partner Token. if (quoteresponse.Response != null && (quoteresponse.Response.Message.Contains("Partner Token has expired") || quoteresponse.Response.Message.Contains("Invalid Partner Token"))) { tokenObject = ICEcashService.getToken(); SummaryDetailService.UpdateToken(tokenObject); patnerToken = tokenObject.Response.PartnerToken; // tokenObject = (ICEcashTokenResponse)Session["ICEcashToken"]; //tokenObject = service.CheckSessionExpired(); if (VehilceLicense && RadioLicense) { quoteresponse = ICEcashService.TPILICQuote(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, zinaraLicensePaymentTerm, radioLicensePaymentTerm); } else if (VehilceLicense) { quoteresponse = ICEcashService.TPILICQuoteZinaraOnly(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1", VehilceLicense, RadioLicense, zinaraLicensePaymentTerm); } else { quoteresponse = ICEcashService.RequestQuote(patnerToken, regNo, SumInsured, "", "", Convert.ToInt32(PaymentTerm), Convert.ToInt32(DateTime.Now.Year), CoverTypeId, vehilceUsage, tokenObject.PartnerReference, Cover_StartDate, Cover_EndDate, "1"); } } response.result = quoteresponse.Response.Result; if (response.result == 0) { response.message = quoteresponse.Response.Quotes[0].Message; } else { response.Data = quoteresponse; } response.result = quoteresponse.Response.Result; } Session["CustomerDataModal"] = null; json.Data = response; } catch (Exception ex) { response.message = "Error occured."; json.Data = new ResultResponse(); } return(json); }