| 1 | using System;
|
|---|
| 2 | using System.Web.Mvc;
|
|---|
| 3 | using adMoto.Payments.Core;
|
|---|
| 4 | using adMoto.Payments.Core.Data;
|
|---|
| 5 | using adMoto.Payments.Core.Interfaces;
|
|---|
| 6 | using adMoto.Payments.Web.Exceptions;
|
|---|
| 7 | using Elmah;
|
|---|
| 8 |
|
|---|
| 9 | namespace adMoto.Payments.Web.Controllers
|
|---|
| 10 | {
|
|---|
| 11 | // ReSharper disable InconsistentNaming
|
|---|
| 12 | public class eCardController : Controller
|
|---|
| 13 | // ReSharper restore InconsistentNaming
|
|---|
| 14 | {
|
|---|
| 15 | private readonly IRepository<PotwierdzeniaEcard> _eCardRepository;
|
|---|
| 16 |
|
|---|
| 17 | public eCardController()
|
|---|
| 18 | {
|
|---|
| 19 | _eCardRepository = new Repository<PotwierdzeniaEcard>(new DataContext());
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | public eCardController(IRepository<PotwierdzeniaEcard> eCardRepository)
|
|---|
| 23 | {
|
|---|
| 24 | _eCardRepository = eCardRepository;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | public ActionResult Status()
|
|---|
| 28 | {
|
|---|
| 29 | var content = new ContentResult();
|
|---|
| 30 |
|
|---|
| 31 | try
|
|---|
| 32 | {
|
|---|
| 33 | if (System.Web.HttpContext.Current != null)
|
|---|
| 34 | ErrorSignal.FromCurrentContext().Raise(new ConfirmationLogger(), System.Web.HttpContext.Current);
|
|---|
| 35 |
|
|---|
| 36 | var potwierdzenie = new PotwierdzeniaEcard();
|
|---|
| 37 | potwierdzenie.MERCHANTNUMBER = Request["MERCHANTNUMBER"] ?? Request.Form["MERCHANTNUMBER"];
|
|---|
| 38 | potwierdzenie.ORDERNUMBER = Request["ORDERNUMBER"] != null ? Convert.ToInt32(Request["ORDERNUMBER"]) : Convert.ToInt32(Request.Form["ORDERNUMBER"]);
|
|---|
| 39 | potwierdzenie.COMMTYPE = Request["COMMTYPE"] ?? Request.Form["COMMTYPE"];
|
|---|
| 40 | potwierdzenie.CURRENTSTATE = Request["CURRENTSTATE"] ?? Request.Form["CURRENTSTATE"];
|
|---|
| 41 | potwierdzenie.PREVIOUSSTATE = Request["PREVIOUSSTATE"] ?? Request.Form["PREVIOUSSTATE"];
|
|---|
| 42 | potwierdzenie.PAYMENTTYPE = Request["PAYMENTTYPE"] != null ? Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTTYPE"])) : Convert.ToBoolean(Convert.ToInt32(Request.Form["PAYMENTTYPE"]));
|
|---|
| 43 | potwierdzenie.EVENTTYPE = Request["EVENTTYPE"] != null ? Convert.ToBoolean(Convert.ToInt32(Request["EVENTTYPE"])) : Convert.ToBoolean(Convert.ToInt32(Request.Form["EVENTTYPE"]));
|
|---|
| 44 | potwierdzenie.PAYMENTNUMBER = Request["PAYMENTNUMBER"] != null ? Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTNUMBER"])) : Convert.ToBoolean(Convert.ToInt32(Request.Form["PAYMENTNUMBER"]));
|
|---|
| 45 | potwierdzenie.APPROVALCODE = Request["APPROVALCODE"] ?? Request.Form["APPROVALCODE"];
|
|---|
| 46 | potwierdzenie.VALIDATIONCODE = Request["VALIDATIONCODE"] ?? Request.Form["VALIDATIONCODE"];
|
|---|
| 47 | potwierdzenie.BIN = Request["BIN"] ?? Request.Form["BIN"];
|
|---|
| 48 | potwierdzenie.AUTHTIME = Request["AUTHTIME"] != null ? Convert.ToDateTime(Request["AUTHTIME"]) : Convert.ToDateTime(Request.Form["AUTHTIME"]);
|
|---|
| 49 | potwierdzenie.TYPE = Request["TYPE"] ?? Request.Form["TYPE"];
|
|---|
| 50 | potwierdzenie.WITHCVC = Request["WITHCVC"] ?? Request.Form["WITHCVC"];
|
|---|
| 51 | potwierdzenie.DATATRANSMISJI = DateTime.Now;
|
|---|
| 52 |
|
|---|
| 53 | _eCardRepository.Insert(potwierdzenie);
|
|---|
| 54 |
|
|---|
| 55 | content.Content = "OK";
|
|---|
| 56 | }
|
|---|
| 57 | catch (Exception ex)
|
|---|
| 58 | {
|
|---|
| 59 | if (System.Web.HttpContext.Current != null)
|
|---|
| 60 | ErrorSignal.FromCurrentContext().Raise(ex);
|
|---|
| 61 | content.Content = "FALSE " + ex.Message + " " + ex.GetType();
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | return content;
|
|---|
| 65 | }
|
|---|
| 66 | }
|
|---|
| 67 | } |
|---|