public void AddOkSetup(Ok_SetupModel ok)
        {
            ok_setup ok2 = _db.ok_setup.Create();

            ok2 = Mapper.Map <Ok_SetupModel, ok_setup>(ok);
            _db.ok_setup.Add(ok2);
            _db.SaveChanges();
        }
Beispiel #2
0
        public IHttpActionResult Code(Policy policy)
        {
            ok_setup Last_Entry = _os.GetLast();

            if (Last_Entry.SSNValidationActive == 1)
            {
                ValidationService validatePremium = new ValidationService();

                if (!validatePremium.validateSSN_Advanced(policy.SSN))
                {
                    return(Json(new { isValid = false, status = "error", message = Resource.Error_EMBG_Val_Advanced }));
                }
            }

            if (!policy.isMobile && policy.IsSamePolicyHolderInsured)
            {
                policy.PolicyHolderName        = policy.Name;
                policy.PolicyHolderLastName    = policy.LastName;
                policy.PolicyHolderSSN         = policy.SSN;
                policy.PolicyHolderEmail       = policy.Email;
                policy.PolicyHolderAddress     = policy.Address;
                policy.PolicyHolderBirthDate   = policy.BirthDate;
                policy.PolicyHolderCity        = policy.City;
                policy.PolicyHolderPostalCode  = policy.PostalCode;
                policy.PolicyHolderPhoneNumber = policy.PhoneNumber;
            }
            if (!policy.isMobile)
            {
                ModelState.Remove("PolicyHolderName");
                ModelState.Remove("PolicyHolderLastName");
                ModelState.Remove("PolicyHolderEmail");
                ModelState.Remove("PolicyHolderAddress");
                ModelState.Remove("PolicyHolderBirthDate");
                ModelState.Remove("PolicyHolderCity");
                ModelState.Remove("PolicyHolderPostalCode");
                ModelState.Remove("PolicyHolderPhoneNumber");
                ModelState.Remove("PolicyHolderSSN");
            }

            if (ModelState.IsValid && policy != null)
            {
                RatingEngineService ratingEngineService = new RatingEngineService();

                Premium Premium = new Premium();
                Premium.PremiumAmount = (int)ratingEngineService.totalPremium(policy);
                return(Ok(new { PremiumAmount = Premium.PremiumAmount }));
            }
            else
            {
                return(BadRequest("Внесете ги сите полиња!"));
            }
        }
Beispiel #3
0
        public IHttpActionResult OK_SETUP_SSN()
        {
            ok_setup Last_Entry = _os.GetLast();
            var      data       = new JObject();

            if (Last_Entry.SSNValidationActive == 0)
            {
                data.Add("message", false);
                return(BadRequest());
            }
            else
            {
                data.Add("message", true);
                return(Json(data));
            }
        }
Beispiel #4
0
        public async Task <HttpResponseMessage> MobilePayment(CreditCardInfoModel paymentModel)
        {
            ok_setup LastEntry = _os.GetLast();

            if (LastEntry.TestPayment == 1)
            {
                if (paymentModel.OrderId.HasValue)
                {
                    try
                    {
                        string quoteNumber = _ps.GetPolicyNumberByPolicyId(paymentModel.OrderId.Value);
                        _ps.UpdatePaymentStatus(quoteNumber);
                        HttpError myCustomError = new HttpError("File successfuly.")
                        {
                            { "Is3DSecure", false }, { "Response", "{'TRANID':'','PAResSyntaxOK':'false','islemtipi':'Auth','refreshtime':'10','lang':'mk','merchantID':'180000069','amount':'500','sID':'1','ACQBIN':'435742','Ecom_Payment_Card_ExpDate_Year':'20','MaskedPan':'429724***4937','clientIp':'88.85.116.22','iReqDetail':'','okUrl':'https://localhost:44375/api/HalkbankPayment/Handle','md':'429724:B1BFD1386EE5C99F997854210EFE15930334DF46EC90BC7994AB81564537D7CE:4274:##180000069','ProcReturnCode':'99','taksit':'','vendorCode':'','paresTxStatus':'-','Ecom_Payment_Card_ExpDate_Month':'02','storetype':'3D_PAY_HOSTING','iReqCode':'','veresEnrolledStatus':'N','Response':'Approved','mdErrorMsg':'N-status/Not enrolled from Directory Server: http://katmai:8080/mdpayacs/vereq','ErrMsg':'Нарачката е веќе платена','PAResVerified':'false','cavv':'','digest':'digest','failUrl':'https://localhost:44375/api/HalkbankPayment/Handle','cavvAlgorithm':'','xid':'C5BphugnaeXHj26RXrVOyR91QFA=','encoding':'UTF-8','currency':'807','oid':'23011','mdStatus':'2','dsId':'1','eci':'','version':'2.0','clientid':'180000069','txstatus':'N','HASH':'UAMehE7tsfURlS4d8udtWa3m+C4=','rnd':'SIUIAvmeELilibPLVdFW','HASHPARAMS':'clientid:oid:AuthCode:ProcReturnCode:Response:mdStatus:cavv:eci:md:rnd:','HASHPARAMSVAL':'1800000692301199Declined2429724:B1BFD1386EE5C99F997854210EFE15930334DF46EC90BC7994AB81564537D7CE:4274:##180000069SIUIAvmeELilibPLVdFW'}" }
                        };
                        return(Request.CreateErrorResponse(HttpStatusCode.OK, myCustomError));
                    }
                    catch
                    {
                        throw new Exception("Internal error: Payment status not changed, Connection to Database timeout");
                    }
                }
                else
                {
                    throw new Exception("Internal error: Empty Policy");
                }
            }
            else if (LastEntry.TestPayment == 0)
            {
                try
                {
                    return(HalkBankPayment(paymentModel));
                }
                catch
                {
                    throw new Exception("Internal error: Can`t access HalkBank Payment api");
                }
            }


            else
            {
                throw new Exception("No valid method for payment.");
            }
        }
Beispiel #5
0
        public async Task <JsonResult> Index(Policy policy)
        {
            string username = System.Web.HttpContext.Current.User.Identity.Name;

            ok_setup Last_Entry = _os.GetLast();

            if (Last_Entry.SSNValidationActive == 1)
            {
                ValidationService validatePremium = new ValidationService();

                if (!validatePremium.validateSSN_Advanced(policy.SSN))
                {
                    return(Json(new { isValid = false, status = "error", message = Resource.Error_EMBG_Val_Advanced }));
                }
            }

            if (policy.IsSamePolicyHolderInsured)
            {
                policy.PolicyHolderName        = policy.Name;
                policy.PolicyHolderLastName    = policy.LastName;
                policy.PolicyHolderSSN         = policy.SSN;
                policy.PolicyHolderEmail       = policy.Email;
                policy.PolicyHolderAddress     = policy.Address;
                policy.PolicyHolderBirthDate   = policy.BirthDate;
                policy.PolicyHolderCity        = policy.City;
                policy.PolicyHolderPostalCode  = policy.PostalCode;
                policy.PolicyHolderPhoneNumber = policy.PhoneNumber;
            }
            else
            {
                ModelState.Remove("PolicyHolderName");
                ModelState.Remove("PolicyHolderLastName");
                ModelState.Remove("PolicyHolderEmail");
                ModelState.Remove("PolicyHolderAddress");
                ModelState.Remove("PolicyHolderBirthDate");
                ModelState.Remove("PolicyHolderCity");
                ModelState.Remove("PolicyHolderPostalCode");
                ModelState.Remove("PolicyHolderPhoneNumber");
                ModelState.Remove("PolicyHolderSSN");
            }

            if (ModelState.IsValid && policy != null)
            {
                RatingEngineService ratingEngineService = new RatingEngineService();
                Premium             Premium             = new Premium();
                Premium.PremiumAmount = (int)ratingEngineService.totalPremium(policy);
                if (_roleAuthorize.IsUser("Broker manager", username))
                {
                    if (Premium.PremiumAmount > 10000)
                    {
                        return(Json(new { isValid = false, status = "error", message = "ThePremiumIsExceeded", PremiumAmount = Premium.PremiumAmount }));
                    }
                }
                else if (_roleAuthorize.IsUser("Broker", username))
                {
                    if (Premium.PremiumAmount > 10000)
                    {
                        return(Json(new { isValid = false, status = "error", message = "ThePremiumIsExceeded", PremiumAmount = Premium.PremiumAmount }));
                    }
                }

                return(Json(new { isValid = true, status = "ok", PremiumAmount = Premium.PremiumAmount }));
            }
            else
            {
                return(Json(new { isValid = false, status = "error", message = InsuredTraveling.Resource.EnterAllData }));
            }
        }