Example #1
0
        public ActionResult RedirectPrintOffer(Policy policy)
        {
            policy.isMobile = false;
            var PolicyId = SavePolicyHelper.SavePolicy(policy, _ps, _us, _iss, _pis, _acs);

            var pNumber = _ps.GetPolicyNumberByPolicyId(PolicyId);

            return(RedirectToAction("PolicyDetails", new { policyNumber = pNumber }));
        }
Example #2
0
        public async System.Threading.Tasks.Task <ActionResult> CreateQuote(Policy policy)
        {
            var result      = SavePolicyHelper.SavePolicy(policy, _ps, _us, _iss, _pis, _acs);
            var quoteNumber = _ps.GetPolicyById(result).Policy_Number;

            if (result != 0)
            {
                return(Json(new { success = true, responseText = quoteNumber, numberQuote = quoteNumber }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, responseText = "Fail." }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index(Policy p)
        {
            ViewBag.IsPaid = false;
            PaymentModel model = new PaymentModel();

            p.isMobile = false;
            var PolicyId = SavePolicyHelper.SavePolicy(p, _ps, _us, _iss, _pis, _acs);

            var policy = _ps.GetPolicyById(PolicyId);

            model.mainInsured  = _pis.GetAllInsuredByPolicyId(policy.ID).First();
            model.PolicyNumber = policy.Policy_Number;
            var additionalCharges = _acs.GetAdditionalChargesByPolicyId(PolicyId);

            model.additionalCharge1 = "Без доплаток";
            model.additionalCharge2 = "Без доплаток";
            if (additionalCharges.Count >= 1 && additionalCharges[0] != null)
            {
                model.additionalCharge1 = _acs.GetAdditionalChargeName(additionalCharges[0].ID);
            }
            if (additionalCharges.Count >= 2 && additionalCharges[1] != null)
            {
                model.additionalCharge2 = _acs.GetAdditionalChargeName(additionalCharges[1].ID);
            }

            model.clientId = "180000069";                   //Merchant Id defined by bank to user
            model.amount   = p.Total_Premium.ToString();
            //   "9.95";                         //Transaction amount
            model.oid     = "";                                                                          //Order Id. Must be unique. If left blank, system will generate a unique one.
            model.okUrl   = ConfigurationManager.AppSettings["webpage_url"] + "/Payment/PaymentSuccess"; //URL which client be redirected if authentication is successful
            model.failUrl = ConfigurationManager.AppSettings["webpage_url"] + "/Payment/PaymentFail";    //URL which client be redirected if authentication is not successful
            model.rnd     = DateTime.Now.ToString();                                                     //A random number, such as date/time

            model.currency        = "807";                                                               //Currency code, 949 for TL, ISO_4217 standard
            model.instalmentCount = "";                                                                  //Instalment count, if there is no instalment should left blank
            model.transactionType = "Auth";                                                              //Transaction type
            model.storekey        = "SKEY3545";                                                          //Store key value, defined by bank.
            model.hashstr         = model.clientId + model.oid + model.amount + model.okUrl + model.failUrl + model.transactionType + model.instalmentCount + model.rnd + model.storekey;
            System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();
            model.hashbytes  = System.Text.Encoding.GetEncoding("ISO-8859-9").GetBytes(model.hashstr);
            model.inputbytes = sha.ComputeHash(model.hashbytes);

            model.hash              = Convert.ToBase64String(model.inputbytes); //Hash value used for validation
            model.retaining_risk    = "No Deductible";
            model.retaining_risk_mk = "Без франшиза";
            model.Pat = policy;
            return(View(model));
        }
Example #4
0
        public IHttpActionResult CreateQuote(AddPolicyMobileViewModel addPolicy)
        {
            if (addPolicy == null)
            {
                throw new Exception("Internal error: Empty Policy");
            }
            int result = SavePolicyHelper.SavePolicyFromMobile(addPolicy, _ps, _us, _iss, _pis, _acs);

            if (result != -1)
            {
                return(Ok(new { QuoteID = result }));
            }
            else
            {
                throw new Exception("Internal error: Not saved");
            }
        }