using System; using System.Web.Mvc; using adMoto.Payments.Core; using adMoto.Payments.Core.Data; using adMoto.Payments.Core.Interfaces; using Elmah; namespace adMoto.Payments.Web.Controllers { // ReSharper disable InconsistentNaming public class eCardController : Controller // ReSharper restore InconsistentNaming { private readonly IRepository _eCardRepository; public eCardController() { _eCardRepository = new Repository(new DataContext()); } public eCardController(IRepository eCardRepository) { _eCardRepository = eCardRepository; } public ActionResult Status() { var content = new ContentResult(); try { if (System.Web.HttpContext.Current != null) ErrorSignal.FromCurrentContext().Raise(new Exception(), System.Web.HttpContext.Current); var potwierdzenie = new PotwierdzeniaEcard(); potwierdzenie.MERCHANTNUMBER = Request["MERCHANTNUMBER"]; potwierdzenie.ORDERNUMBER = Convert.ToInt32(Request["ORDERNUMBER"]); potwierdzenie.COMMTYPE = Request["COMMTYPE"]; potwierdzenie.CURRENTSTATE = Request["CURRENTSTATE"]; potwierdzenie.PREVIOUSSTATE = Request["PREVIOUSSTATE"]; potwierdzenie.PAYMENTTYPE = Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTTYPE"])); potwierdzenie.EVENTTYPE = Convert.ToBoolean(Convert.ToInt32(Request["EVENTTYPE"])); potwierdzenie.PAYMENTNUMBER = Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTNUMBER"])); potwierdzenie.APPROVALCODE = Request["APPROVALCODE"]; potwierdzenie.VALIDATIONCODE = Request["VALIDATIONCODE"]; potwierdzenie.BIN = Request["BIN"]; potwierdzenie.AUTHTIME = Convert.ToDateTime(Request["AUTHTIME"]); potwierdzenie.TYPE = Request["TYPE"]; potwierdzenie.WITHCVC = Request["WITHCVC"]; _eCardRepository.Insert(potwierdzenie); content.Content = "OK"; } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); content.Content = "FALSE " + ex.Message + " " + ex.GetType(); } return content; } } }