public ResponseEBL reversalEBL(string amount, string rrn, string version)
        {
            string      acquirer = "EBL";
            ResponseEBL cres     = new ResponseEBL();

            try
            {
                bool log_Debug = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["log_Debug"]);

                log.Info(string.Format("Request received from {0}", this.GetClientIP()));

                //VALIDATE THE REQUEST
                if (log_Debug)
                {
                    log.Info(string.Format("REQ.REVERSAL Channel:{0}, Amount:{1}, RRN:{2}, Version:{3}", acquirer, amount, rrn, version));
                }

                string errMsg = null;
                bool   valid  = Utils.validReversalRequest(acquirer, amount, rrn, version, ref errMsg);

                if (!valid)
                {
                    throw new Exception(errMsg);
                }

                //TRIGGER ARCUS DLL THROUGH A FRIEND ;)
                ArcComHelper.CArcusDll dll = new ArcComHelper.CArcusDll();
                Hashtable hsh = dll.execReversal(amount, rrn, log_Debug);

                //ASSIGN VARIABLES TO RESPONSE CONTRACT CLASS
                cres.Amount          = (string)hsh["amount"];
                cres.Cashback        = (string)hsh["cashBack"];
                cres.AuthCode        = (string)hsh["authCode"];
                cres.RespCode        = (string)hsh["respCode"];
                cres.CardExpiry      = (string)hsh["cardExpiry"];
                cres.Currency        = (string)hsh["currency"];
                cres.Msg             = (string)hsh["msg"];
                cres.Pan             = (string)hsh["pan"];
                cres.Tid             = (string)hsh["tid"];
                cres.MID             = (string)hsh["tid"];
                cres.RRN             = (string)hsh["rrn"];
                cres.TransactionType = (string)hsh["transType"];
                cres.PaymentDetails  = (string)hsh["payDetails"];

                if (log_Debug)
                {
                    log.Info(
                        string.Format("RES.REVERSAL Channel:{0}, Amount:{1}, RRN:{2}, RspCode:{3}, AuthCode:{4}, PAN:{5}, Msg:{6}, Version:{7}",
                                      acquirer, amount, cres.RRN, cres.RespCode, cres.AuthCode, cres.Pan, cres.Msg, version));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);

                cres.Msg = ex.Message;
            }

            return(cres);
        }
        public ResponseEBL execSaleEBL(RequestEBL creq)
        {
            ResponseEBL res = null;

            try
            {
                var jsonString = JsonConvert.SerializeObject(creq);
                log.Info(
                    "Request------" + jsonString);
                if (creq != null)
                {
                    res = this.saleEBL(creq.Amount, creq.CashBack, creq.TillNO, creq.TransKey, "100.1.0");
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }

            return(res);
        }
        public ResponseEBL saleEBL(string amount, string cashBack, string tillNO, string transKey, string version)
        {
            string      acquirer = "EBL";
            ResponseEBL cres     = new ResponseEBL();

            try
            {
                bool log_Debug = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["log_Debug"]);

                log.Info(string.Format("Request received from {0}", this.GetClientIP()));


                //VALIDATE THE REQUEST
                if (log_Debug)
                {
                    log.Info(string.Format("REQ.SALE Channel:{0}, Amount:{1}, Cashback:{2}, TillNo:{3}, TransKey:{4}, Version:{5}", acquirer, amount, cashBack, tillNO, transKey, version));
                }

                string errMsg = null;
                bool   valid  = Utils.validSaleRequest(acquirer, amount, cashBack, tillNO, transKey, version, ref errMsg);
                if (!valid)
                {
                    throw new Exception(errMsg);
                }

                //Check Comports
                //  utilies.Comports.Start();

                //TRIGGER ARCUS DLL THROUGH A FRIEND ;) =======================================================
                ArcComHelper.CArcusDll arcusHelper = new ArcComHelper.CArcusDll();
                Hashtable hsh = arcusHelper.execSale(amount, cashBack, tillNO, transKey, log_Debug);

                //assign data to the response contract class
                cres.Amount           = (string)hsh["amount"];
                cres.Cashback         = (string)hsh["cashBack"];
                cres.AuthCode         = (string)hsh["authCode"];
                cres.RespCode         = (string)hsh["respCode"];
                cres.CardExpiry       = (string)hsh["cardExpiry"];
                cres.Currency         = (string)hsh["currency"];
                cres.Msg              = (string)hsh["msg"];
                cres.Pan              = (string)hsh["pan"];
                cres.Tid              = (string)hsh["tid"];
                cres.MID              = (string)hsh["tid"];
                cres.RRN              = (string)hsh["rrn"];
                cres.TransactionType  = (string)hsh["transType"];
                cres.PaymentDetails   = (string)hsh["payDetails"];
                cres.Rfu              = (string)hsh["rfu"];
                cres.TransactionID    = (string)hsh["transactionID"];
                cres.HoldersName      = getname((string)hsh["slip"]);
                cres.ResponseCodeHost = (string)hsh["responseCodeHost"];
                cres.ProviderCode     = (string)hsh["providerCode"];
                cres.PathParameters   = (string)hsh["pathParameters"];
                cres.Hash             = (string)hsh["hash"];
                cres.FileNameResult   = (string)hsh["fileNameResult"];
                cres.FileNameReport   = (string)hsh["fileNameReport"];
                cres.FileName         = (string)hsh["fileName"];
                cres.EncData          = (string)hsh["encData"];
                cres.DateTimeHost     = (string)hsh["dateTimeHost"];
                cres.DateTimeCRM      = (string)hsh["dateTimeCRM"];
                cres.CRMID            = (string)hsh["cRMID"];
                cres.CommodityCode    = (string)hsh["commodityCode"];
                cres.CardType         = (string)hsh["cardType"];
                cres.CardEntryMode    = (int)hsh["cardEntryMode"];
                cres.BIN              = (string)hsh["bIN"];


                if (log_Debug)
                {
                    log.Info(
                        string.Format("RES.SALE Channel:{0}, Amount:{1}, Cashback:{2}, TillNo:{3}, TransKey:{4}, RspCode:{5}, AuthCode:{6}, RRN:{7}, PAN:{8}, Msg:{9}, Version:{10}",
                                      acquirer, amount, cashBack, tillNO, transKey, cres.RespCode, cres.AuthCode, cres.RRN, cres.Pan, cres.Msg, version));
                }
            }
            catch (Exception e)
            {
                log.Error(e);
                cres.Msg = e.Message;
            }

            return(cres);
        }