public ActionResult Confirm_Global(string vpc_OrderInfo, string vpc_3DSECI, string vpc_AVS_Street01, string vpc_Merchant, string vpc_Card, string vpc_AcqResponseCode, string AgainLink, string vpc_AVS_Country, string vpc_AuthorizeId, string vpc_3DSenrolled, string vpc_RiskOverallResult, string vpc_ReceiptNo, string vpc_TransactionNo, string vpc_AVS_StateProv, string vpc_Locale, string vpc_TxnResponseCode, string vpc_VerToken, string vpc_Amount, string vpc_BatchNo, string vpc_Version, string vpc_AVSResultCode, string vpc_VerStatus, string vpc_Command, string vpc_Message, string Title, string vpc_3DSstatus, string vpc_SecureHash, string vpc_AVS_PostCode, string vpc_CSCResultCode, string vpc_MerchTxnRef, string vpc_VerType, string vpc_VerSecurityLevel, string vpc_3DSXID, string vpc_AVS_City) { string log = "[Date]=[" + DateTime.Now + "]|[vpc_OrderInfo]=[" + vpc_OrderInfo + "]|[vpc_3DSECI]=[" + vpc_3DSECI + "]|[vpc_AVS_Street01]=[" + vpc_AVS_Street01 + "]|[vpc_Merchant]=[" + vpc_Merchant + "]|[vpc_Card]=[" + vpc_Card + "]|[vpc_AcqResponseCode]=[" + vpc_AcqResponseCode + "]|"; log += "[AgainLink]=[" + AgainLink + "]|[vpc_AVS_Country]=[" + vpc_AVS_Country + "]|[vpc_AuthorizeId]=[" + vpc_AuthorizeId + "]|[vpc_3DSenrolled]=[" + vpc_3DSenrolled + "]|[vpc_RiskOverallResult]=[" + vpc_RiskOverallResult + "]|"; log += "[vpc_ReceiptNo] =[" + vpc_ReceiptNo + "]|[vpc_TransactionNo]=[" + vpc_TransactionNo + "]|[vpc_TxnResponseCode]=[" + vpc_TxnResponseCode + "]|[vpc_MerchTxnRef]=[" + vpc_MerchTxnRef + "]|[vpc_AVSResultCode]=[" + vpc_AVSResultCode + "]|"; Utils.WriteLogToFile(log); AppoinmentView appointment = new AppoinmentView(); appointment = _appoinmentBusiness.GetByCode(vpc_OrderInfo); bool status = false; if (appointment != null && appointment.ID != 0) { if (vpc_TxnResponseCode == "0") { status = true; if (!appointment.IsPayment) { if (_appoinmentBusiness.UpdatePayment(appointment.ID)) { _appoinmentBusiness.Save(); } } } else { status = false; if (_appoinmentBusiness.UpdateStatus(appointment.ID, -1)) { _appoinmentBusiness.Save(); } } } ViewBag.StatusPayment = status; return(View(appointment)); }
public ActionResult Confirm(string vpc_AdditionData, string vpc_Amount, string vpc_Command, string vpc_CurrencyCode, string vpc_Locale, string vpc_MerchTxnRef, string vpc_Merchant, string vpc_OrderInfo, string vpc_TransactionNo, string vpc_TxnResponseCode, string vpc_Version, string vpc_SecureHash) { Utils.WriteLogToFile("[Date]=[" + DateTime.Now + "]|[vpc_AdditionData]=[" + vpc_AdditionData + "]|[vpc_Amount]=[" + vpc_Amount + "]|[vpc_Command]=[" + vpc_Command + "]|[vpc_CurrencyCode]=[" + vpc_CurrencyCode + "]|[vpc_Locale]=[" + vpc_Locale + "]|[vpc_MerchTxnRef]=[" + vpc_MerchTxnRef + "]|[vpc_Merchant]=[" + vpc_Merchant + "]|[vpc_OrderInfo]=[" + vpc_OrderInfo + "]|[vpc_TransactionNo]=[" + vpc_TransactionNo + "]|[vpc_TxnResponseCode]=[" + vpc_TxnResponseCode + "]|[vpc_Version]=[" + vpc_Version + "]|[vpc_SecureHash]=[" + vpc_SecureHash + "]"); AppoinmentView appointment = new AppoinmentView(); appointment = _appoinmentBusiness.GetByCode(vpc_OrderInfo); bool status = false; if (appointment != null && appointment.ID != 0) { if (vpc_TxnResponseCode == "0") { status = true; if (!appointment.IsPayment) { if (_appoinmentBusiness.UpdatePayment(appointment.ID)) { _appoinmentBusiness.Save(); } } } else { status = false; if (_appoinmentBusiness.UpdateStatus(appointment.ID, -1)) { _appoinmentBusiness.Save(); } } } ViewBag.StatusPayment = status; return(View(appointment)); }
public bool Add(AppoinmentView model) { return(_appoinment.Add(model)); }
public ActionResult Payment(PaymentParam model) { try { HttpCookie reqCookies = Request.Cookies["MemberLoginCookie"]; ResponseMemberLogin login = JsonConvert.DeserializeObject <ResponseMemberLogin>(reqCookies.Value.ToString().UrlDecode()); if (login == null || login.ID == 0) { return(Json(new PaymentResult { Status = -1, Uri = "" })); } double reduce = 0; var doctor = _doctorBusiness.GetByID(model.DoctorID); if (doctor != null && doctor.ID != 0) { if (model.PCode != "") { var promotion = _promotionBusiness.ApplyPromotion(model.PCode); if (promotion != null && promotion.ID != 0) { if (promotion.DoctorApply == "" || promotion.DoctorApply == null) { if (promotion.Type == 1) { reduce = promotion.AmountReduced; } else { reduce = (doctor.Price * promotion.PercentReduced) / 100; } } else { if (promotion.DoctorApply.Contains(doctor.ID.ToString())) { if (promotion.Type == 1) { reduce = promotion.AmountReduced; } else { reduce = (doctor.Price * promotion.PercentReduced) / 100; } } } } } AppoinmentView appoinment = new AppoinmentView(); appoinment.Amount = doctor.Price - reduce; appoinment.Code = $"{DateTime.Now.ToString("ddMMyy")}{RandomUtils.RandomString(6, 8, true, true, false)}"; appoinment.Date = model.Date; appoinment.Doctor = doctor.ID; appoinment.IsPayment = false; appoinment.Patient = login.ID; appoinment.Price = doctor.Price; appoinment.Reduce = reduce; appoinment.Status = 0; appoinment.Time = model.Time; if (_appoinmentBusiness.Add(appoinment)) { _appoinmentBusiness.Save(); if (model.TypePay == 1) { string uri = CreateRequestPaymentPort((appoinment.Amount * 100).ToString(), appoinment.Code, login.ID.ToString()); return(Json(new PaymentResult { Status = 1, Uri = uri })); } if (model.TypePay == 2) { string uri = CreateRequestPaymentPortGlobal((appoinment.Amount * 100).ToString(), appoinment.Code, login.ID.ToString()); return(Json(new PaymentResult { Status = 1, Uri = uri })); } } } return(Json(new PaymentResult { Status = -1, Uri = "" })); } catch (Exception) { return(Json(new PaymentResult { Status = -1, Uri = "" })); } }