private void HydrateModel(CreditCardInfoModel model) { // Month logic mCreditCardModel = model; PopulatePrice(); PopulateMonths(); PopulateYears(); PopulateCreditCardType(); }
public ActionResult GetPartialView() { //mCreditCardModel = new CreditCardInfoModel() //TODO: Web Service populate of Owner BXGOwner = (BGO.OwnerWS.Owner)Session["BXGOwner"]; CreditCardInfoModel model = new CreditCardInfoModel(); HydrateModel(model); TempData["CCFormRequestFromMyPoints"] = CurrentPage.Id == Convert.ToInt32(ConfigurationManager.AppSettings["myPointsContentId"]); return(PartialView("CreditCardInfo", model)); }
public HttpResponseMessage HalkBankPayment(CreditCardInfoModel paymenyModel) { Uri uri = new Uri(ConfigurationManager.AppSettings["webpage_apiurl"] + "/api/halkbankpayment/pay"); HttpClient client = new HttpClient(); client.BaseAddress = uri; var mediaType = new MediaTypeHeaderValue("application/json"); var jsonFormatter = new JsonMediaTypeFormatter(); HttpContent content = new ObjectContent <CreditCardInfoModel>(paymenyModel, jsonFormatter); HttpResponseMessage responseMessage = client.PostAsync(uri, content).Result; return(responseMessage); }
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."); } }
// Same as SubmitForm, but with the following changes so that we can use it with Ajax.BeginForm: // * Returns the partial view with the model instead of redirecting to the current page // * Populates the dropdown model properties so the rendere doesn't yell at us // * Deletes the DisplaySaveMyPoints TempData key if it exists, since SubmitForm relies on the My Points page deleting it public ActionResult SubmitAjaxForm(CreditCardInfoModel model) { if (TempData.ContainsKey("DisplaySaveMyPoints")) { TempData.Remove("DisplaySaveMyPoints"); } BXGOwner = (BGO.OwnerWS.Owner)Session["BXGOwner"]; mCreditCardModel = model; PopulateMonths(); PopulateYears(); PopulateCreditCardType(); PopulatePrice(); mCreditCardModel.CreditCardInfoErrors = new List <String>(); ValidateForm(mCreditCardModel); if (ModelState.IsValid) { //redirect to current page to clear the form SavePoints(); } else { TempData.Add("DisplaySaveMyPoints", true); //Add Error processing here } if (cardSuccess) { if (Session["CcformRedirectUrl"] != null) { ClearMessages(); } string path = (string)Session["CcformRedirectUrl"] ?? BGModern.HtmlExtensions.CustomHtmlHelpers.GetFullSitePath(null).ToString() + "/my-points"; Session["CcformRedirectUrl"] = null; return(Json(new{ url = path })); } else { return(PartialView("CreditCardInfo", model)); } }
public ActionResult SubmitForm(CreditCardInfoModel model) { BXGOwner = (BGO.OwnerWS.Owner)Session["BXGOwner"]; mCreditCardModel = model; mCreditCardModel.CreditCardInfoErrors = new List <String>(); ValidateForm(mCreditCardModel); if (ModelState.IsValid) { //redirect to current page to clear the form SavePoints(); return(RedirectToCurrentUmbracoPage()); } else { TempData.Add("DisplaySaveMyPoints", true); //Add Error processing here return(CurrentUmbracoPage()); } }
private Boolean ValidateForm(CreditCardInfoModel model) { bool bValid = true; List <RuleViolation> Violations = GetCreditCardViolations(); if (Violations.Count != 0) { bValid = false; } //Add violations to model state here... this might need to be moved to better location foreach (var vi in Violations) { ModelState.AddModelError(vi.PropertyName, vi.ErrorMessage); model.CreditCardInfoErrors.Add(vi.ErrorMessage); } return(bValid); }