public override void Submit()
        {
            string redirectUrl = _configHelper.GetConfigEntry("paymentGatewayUrl");

            string returnUrl = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved, "?Agency=Produbanco");
            string acquirerId;
            // = GetConfigEntry("paymentGatewayAcquiredId"); //// The IDACQUIRER for production is = 18
            string storeId; // = GetConfigEntry("paymentGatewayStoreId"); //2482
            string orderNumber = _orderNumber;
            string amount      =
                (string.Format(getPriceFormat(_orderAmount), _orderAmount).Replace(".", "").Replace(",", ""));
            string vPOSPublicKey       = string.Empty; // GetConfigEntry("paymentGatewayVPOSCRYPTOPublicKey");
            string herbalifePrivateKey = string.Empty; // GetConfigEntry("paymentGatewayHerbalifeSignaturePrivateKey");
            string vectorId;                           // = GetConfigEntry("paymentGatewayVectorId"); //vectorId

            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
            {
                storeId    = _configHelper.GetConfigEntry("paymentGatewayStoreId"); //2482
                acquirerId = _configHelper.GetConfigEntry("paymentGatewayAcquiredId");
                vectorId   = _configHelper.GetConfigEntry("paymentGatewayVectorId");
            }
            else
            {
                redirectUrl = _configHelper.GetConfigEntry("paymentGatewayBetaUrl");
                storeId     = _configHelper.GetConfigEntry("paymentGatewayBetaStoreId"); //2482
                acquirerId  = _configHelper.GetConfigEntry("paymentGatewayBetaAcquiredId");
                vectorId    = _configHelper.GetConfigEntry("paymentGatewayBetaVectorId");
            }

            var colorList = new List <string>();

            colorList = GenerateHash(vPOSPublicKey, herbalifePrivateKey, acquirerId, storeId, orderNumber, vectorId,
                                     amount, returnUrl);

            // Post and redirect to Produbanco website
            HttpContext.Current.Response.Clear();

            var sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""frmSolicitudPago""].submit()'>");
            sb.AppendFormat("<form name='frmSolicitudPago' action='{0}' method='post'>", redirectUrl);
            //https://servicios.alignet.com/VPOS/MM/transactionStart20.do
            sb.AppendFormat("<input type='hidden' name='IDACQUIRER' value='{0}'>", acquirerId);
            sb.AppendFormat("<input type='hidden' name='IDCOMMERCE' value='{0}'>", storeId);
            sb.AppendFormat("<input type='hidden' name='SESSIONKEY' value='{0}'>", colorList[0]);
            sb.AppendFormat("<input type='hidden' name='XMLREQ' value='{0}'>", colorList[1]);
            sb.AppendFormat("<input type='hidden' name='DIGITALSIGN' value='{0}'>", colorList[2]);
            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");

            string response = sb.ToString();

            LogMessage(PaymentGatewayLogEntryType.Request, OrderNumber, _distributorId, _gatewayName,
                       PaymentGatewayRecordStatusType.Unknown, response);

            HttpContext.Current.Response.Write(response);
            HttpContext.Current.Response.End();
        }
        public override void Submit()
        {
            try
            {
                SendPendingEmail();
                string returnUrlApproved = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved);
                string returnUrlDeclined = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlDeclined);

                string merchant = _configHelper.GetConfigEntry("merchant");
                string user     = _configHelper.GetConfigEntry("user");
                string password = _configHelper.GetConfigEntry("password");

                string xmlrequest;
                string dynamicUrlRequest;
                //  Create the service

                xmlrequest = GenerateXmlRequest(returnUrlApproved, returnUrlDeclined);

                //string xmlresponse = Servicio1.doService("1.1.0", "payOrder", merchant, user, password, xmlrequest);
                string xmlresponse = OrderProvider.SendBPagServiceRequest("1.1.0", "payOrder", merchant, user, password,
                                                                          xmlrequest);

                LogMessage(PaymentGatewayLogEntryType.Request, OrderNumber, _distributorId, _gatewayName,
                           PaymentGatewayRecordStatusType.Unknown, xmlresponse);
                //    string xmlresponse = OrderProvider.SendBPagServiceRequest("1.1.0", "payOrder", merchant, "Herbalife_WS", "123456", xmlrequest);

                dynamicUrlRequest = GetDynamicURL(xmlresponse);

                if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
                {
                    ServicePointManager.ServerCertificateValidationCallback +=
                        (sender, certificate, chain, sslPolicyErrors) => true;
                }

                HttpContext.Current.Response.Clear();

                var sb = new StringBuilder();
                sb.Append("<html>");
                sb.AppendFormat(@"<body onload='document.forms[""form""].submit()'>");
                sb.AppendFormat("<form name='form' action='{0}' method='post'>", dynamicUrlRequest);
                sb.Append("</form>");
                sb.Append("</body>");

                sb.Append("</html>");

                string response = sb.ToString();
                LogMessage(PaymentGatewayLogEntryType.Request, OrderNumber, _distributorId, _gatewayName,
                           PaymentGatewayRecordStatusType.Unknown, response);

                HttpContext.Current.Response.Write(response);
                HttpContext.Current.Response.End();
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format(
                        "Itau Electronic Transfer Payment Gateway Invoker exception for: order number {0}, DS ID {1} {2}",
                        OrderNumber, _distributorId, ex.Message));
            }
        }
        public override void Submit()
        {
            string xmlrequest  = string.Empty;
            string redirectUrl = _configHelper.GetConfigEntry("paymentGatewayUrl");
            string merchantID;
            string orderNumber = _orderNumber;
            string amount      = _orderAmount.ToString().Replace(",", string.Empty);
            string serviPagPublicKey;
            string herbalifePrivateKey;

            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
            {
                merchantID          = _configHelper.GetConfigEntry("paymentGatewayCanaldePago"); //CanaldePago
                serviPagPublicKey   = ResolveUrl("\\App_data\\PaymentKeysServiPag\\paymentGatewayServiPagPublic.key");
                herbalifePrivateKey =
                    ResolveUrl("\\App_data\\PaymentKeysServiPag\\paymentGatewayHerbalifePrivate.key");
            }
            else
            {
                merchantID        = _configHelper.GetConfigEntry("BetapaymentGatewayCanaldePago"); //CanaldePago
                serviPagPublicKey =
                    ResolveUrl("\\App_data\\PaymentKeysServiPag\\BETA_paymentGatewayServiPagPublic.key");
                herbalifePrivateKey =
                    ResolveUrl("\\App_data\\PaymentKeysServiPag\\BETA_paymentGatewayHerbalifePrivate.key");
            }

            xmlrequest = GenerateXmlRequest(merchantID, orderNumber, herbalifePrivateKey);

            // Post and redirect to Produbanco website
            HttpContext.Current.Response.Clear();
            var sb = new StringBuilder();

            sb.AppendFormat(@"<html><body onload='document.forms[""form""].submit()'>");
            sb.AppendFormat("<form name='form' action='{0}' method='post'>", redirectUrl);
            sb.AppendFormat("<input type='hidden' name='xml' value='{0}' >", HttpUtility.HtmlEncode(xmlrequest));
            //HttpContext.Current.Server.HtmlEncode(xmlrequest));
            sb.AppendFormat("</form></body></html>");
            string response = sb.ToString();

            LogMessage(
                PaymentGatewayLogEntryType.Request,
                OrderNumber,
                _distributorId,
                _gatewayName,
                PaymentGatewayRecordStatusType.Unknown,
                response);
            HttpContext.Current.Response.Write(response);
            HttpContext.Current.Response.End();
        }
Пример #4
0
        public override void Submit()
        {
            string xmlrequest;

            try
            {
                string redirectUrl = _configHelper.GetConfigEntry("paymentGatewayUrl");
                string key         = _configHelper.GetConfigEntry("paymentGatewayEncryptionKey");
                string password    = _configHelper.GetConfigEntry("paymentGatewayPassword");
                string returnUrl   = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved);

                xmlrequest = GenerateXmlRequest(returnUrl, key, password);

                if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
                {
                    System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
                }

                HttpContext.Current.Response.Clear();

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat(@"<html><body onload='document.forms[""form""].submit()'>");
                sb.AppendFormat("<form name='form' action='{0}' method='post'>", redirectUrl);
                sb.AppendFormat("<input type='hidden' name='CHAVE' value='{0}' >", key);
                sb.AppendFormat("<input type='hidden' name='SENHA' value='{0}' >", password);
                sb.AppendFormat("<input type='hidden' name='ORDEM' value='{0}' >", HttpUtility.HtmlEncode(xmlrequest)); //HttpContext.Current.Server.HtmlEncode(xmlrequest));
                sb.AppendFormat("</form></body></html>");


                string response = sb.ToString();
                PaymentGatewayInvoker.LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, response);

                HttpContext.Current.Response.Write(response);


                HttpContext.Current.Response.End();
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(string.Format("Itau Electronic Transfer Payment Gateway Invoker exception for: order number {0}, DS ID {1}, {2} ", this.OrderNumber, this._distributorId, ex.Message));
            }
        }
        public override void Submit()
        {
            string redirectUrl = _configHelper.GetConfigEntry("paymentGatewayUrl");

            string returnUrl  = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved, "?Agency=Payclub");
            string acquirerId = _configHelper.GetConfigEntry("paymentGatewayAcquirerId"); //acquirerId
            string storeId    = _configHelper.GetConfigEntry("paymentGatewayCommerceId"); //commerceId
            string localId    = _configHelper.GetConfigEntry("paymentGatewayLocalId");    //localId
            string vectorId;                                                              // = "mV6VoYVJ54A="; // GetConfigEntry("paymentGatewayVectorId"); //vectorId
            string orderNumber = _orderNumber;
            string amount      = _orderAmount.ToString().Replace(",", string.Empty);
            string payClubPublicKey;    // = ResolveUrl("\\App_data\\PaymentKeysPayclub\\PUBLICA_CIFRADO_INTERDIN.pem");
            string herbalifePrivateKey; //= ResolveUrl("\\App_data\\PaymentKeysPayclub\\PRIVADA_FIRMA_HERBALIFE.pem");

            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
            {
                acquirerId          = _configHelper.GetConfigEntry("paymentGatewayAcquirerId"); //acquirerId
                storeId             = _configHelper.GetConfigEntry("paymentGatewayCommerceId"); //commerceId
                localId             = _configHelper.GetConfigEntry("paymentGatewayLocalId");    //localId
                vectorId            = "mV6VoYVJ54A=";                                           // GetConfigEntry("paymentGatewayVectorId"); //vectorId
                payClubPublicKey    = ResolveUrl("\\App_data\\PaymentKeysPayclub\\PUBLICA_CIFRADO_INTERDIN.pem");
                herbalifePrivateKey = ResolveUrl("\\App_data\\PaymentKeysPayclub\\PRIVADA_FIRMA_HERBALIFE.pem");
            }
            else
            {
                acquirerId          = _configHelper.GetConfigEntry("BetapaymentGatewayAcquirerId"); //acquirerId
                storeId             = _configHelper.GetConfigEntry("BetapaymentGatewayCommerceId"); //commerceId
                localId             = _configHelper.GetConfigEntry("BetapaymentGatewayLocalId");    //localId
                vectorId            = "6pukFwMTOIA=";                                               // GetConfigEntry("paymentGatewayVectorId"); //vectorId
                payClubPublicKey    = ResolveUrl("\\App_data\\PaymentKeysPayclub\\BETA_PUBLICA_CIFRADO_INTERDIN.pem");
                herbalifePrivateKey = ResolveUrl("\\App_data\\PaymentKeysPayclub\\BETA_PRIVADA_FIRMA_HERBALIFE.pem");
            }

            var dataList = new List <string>();

            dataList = GenerateHash(payClubPublicKey, herbalifePrivateKey, acquirerId, storeId, orderNumber, amount,
                                    returnUrl, vectorId, localId);

            // Post and redirect to Produbanco website
            HttpContext.Current.Response.Clear();
            var sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""frmSolicitudPago""].submit()'>");
            sb.AppendFormat("<form name='frmSolicitudPago' action='{0}' method='post'>", redirectUrl);
            //http://as400web:10100/webmpi/VPOS
            sb.AppendFormat("<input type='hidden' name='TRANSACCIONID' value='{0}'>", orderNumber);
            sb.AppendFormat("<input type='hidden' name='XMLREQUEST' value='{0}'>", dataList[0]);
            sb.AppendFormat("<input type='hidden' name='XMLDIGITALSIGN' value='{0}'>", dataList[1]);
            sb.AppendFormat("<input type='hidden' name='XMLACQUIRERID' value='{0}'>", acquirerId);
            sb.AppendFormat("<input type='hidden' name='XMLMERCHANTID' value='{0}'>", storeId);
            sb.AppendFormat("<input type='hidden' name='XMLGENERATEKEY' value='{0}'>", dataList[2]);
            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");
            string response = sb.ToString();

            LogMessage(PaymentGatewayLogEntryType.Request, OrderNumber, _distributorId, _gatewayName,
                       PaymentGatewayRecordStatusType.Unknown, response);
            HttpContext.Current.Response.Write(response);
            HttpContext.Current.Response.End();
        }
        private List <string> GenerateHash(string vPOSPublicKey, string herbalifePrivateKey, string acquirerId, string storeId, string orderNumber, string vectorId, string amount, string returnUrl)
        {
            var    cipheredDataList = new List <string>();
            string R1;
            string R2;

            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat") || RootUrl.Contains("10.36.158.182") || RootUrl.Contains("10.36.173.61"))
            {
                R1 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\paymentGatewayVpaymentVisaCRYPTOPublicKey.txt");
                R2 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\paymentGatewayHerbalifeSignaturePrivateKey.txt");
            }
            else
            {
                R1 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\BetapaymentGatewayVpaymentVisaCRYPTOPublicKey.txt");
                R2 = ResolveUrl("\\App_data\\PaymentsKeysVpaymentVisa\\BetapaymentGatewayHerbalifeSignaturePrivateKey.txt");
            }


            var srVposLlaveCifradoPublica   = new StreamReader(R1);
            var srComercioLlaveFirmaPrivada = new StreamReader(R2);

            SessionInfo     myCart      = SessionInfo.GetSessionInfo(this._distributorId, this._locale);
            OrderTotals_V01 totals      = myCart.ShoppingCart.Totals as OrderTotals_V01;
            var             hasDiscount = OrderProvider.HasVATDiscount(totals);

            var oVposBean = new VPOSBean
            {
                acquirerId              = acquirerId,
                commerceId              = storeId,
                purchaseCurrencyCode    = "858",
                purchaseAmount          = amount,
                purchaseOperationNumber = orderNumber,
                reserved10              = hasDiscount ? "6" : "0",
                reserved11              = hasDiscount ? orderNumber.Substring(3): string.Empty,
                reserved12              = hasDiscount ?
                                          (string.Format(
                                               this.getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)),
                                               (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", ""))
                                          .Replace(",", "") : string.Empty
            };


            VPOSTax oVPOSTax;
            var     aTaxes = new ArrayList();

            oVPOSTax = new VPOSTax
            {
                Name   = "IVA",
                Amount =
                    (string.Format(
                         this.getPriceFormat((null != totals ? totals.TaxAmount : 0)),
                         (null != totals ? totals.TaxAmount : 0)).Replace(".", "")).Replace(
                        ",", "")
            };

            aTaxes.Add(oVPOSTax);
            oVPOSTax = new VPOSTax {
                Name = "Servicio", Amount = "0"
            };

            aTaxes.Add(oVPOSTax);
            oVPOSTax = new VPOSTax
            {
                Name   = "Monto Grava IVA",
                Amount =
                    (string.Format(
                         this.getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)),
                         (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", ""))
                    .Replace(",", "")
            };
            //oVPOSTax.Amount = totalplustax;
            aTaxes.Add(oVPOSTax);

            oVPOSTax = new VPOSTax {
                Name = "Monto No Grava IVA", Amount = "0"
            };
            aTaxes.Add(oVPOSTax);
            oVposBean.taxes = aTaxes;

            var oVposSend = new VPOSSend(srVposLlaveCifradoPublica, srComercioLlaveFirmaPrivada, vectorId);

            oVposSend.execute(ref oVposBean);

            cipheredDataList.Add(oVposBean.cipheredSessionKey);
            cipheredDataList.Add(oVposBean.cipheredXML);
            cipheredDataList.Add(oVposBean.cipheredSignature);

            return(cipheredDataList);
        }
        public override void Submit()
        {
            try
            {
                string returnUrlApproved = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved);
                string returnUrlDeclined = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlDeclined);

                string merchant = _configHelper.GetConfigEntry("merchant");
                string user     = _configHelper.GetConfigEntry("user");
                string password = _configHelper.GetConfigEntry("password");

                string xmlrequest;
                string dynamicUrlRequest;

                //  Create the service
                xmlrequest = GenerateXmlRequest(returnUrlApproved, returnUrlDeclined);

                //string xmlresponse = Servicio1.doService("1.1.0", "payOrder", merchant, user, password, xmlrequest);
                string xmlresponse = OrderProvider.SendBPagServiceRequest("1.1.0", "payOrder", merchant, user, password,
                                                                          xmlrequest);
                //    string xmlresponse = OrderProvider.SendBPagServiceRequest("1.1.0", "payOrder", merchant, "Herbalife_WS", "123456", xmlrequest);

                dynamicUrlRequest = GetDynamicURL(xmlresponse);

                if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
                {
                    ServicePointManager.ServerCertificateValidationCallback +=
                        (sender, certificate, chain, sslPolicyErrors) => true;
                }

                HttpContext.Current.Response.Clear();

                var sb = new StringBuilder();
                sb.Append("<html>");
                sb.Append("<SCRIPT TYPE=\"text/javascript\">");
                sb.Append("function popup(");
                sb.Append("mylink");
                sb.Append(", windowname) {");
                sb.Append(" if (! window.focus)return true;");
                sb.Append(" var href;");
                sb.Append(" if (typeof(mylink) == 'string') href=mylink;");
                sb.Append(" else");
                sb.Append(" href=mylink.href;");
                sb.Append(" window.open(href, windowname, 'width=800,height=400,scrollbars=yes,menubar=yes');");

                sb.Append(" return false;");
                sb.Append(" }");
                sb.Append(" </SCRIPT>");

                sb.AppendFormat("<body onLoad=\"popup('");
                sb.AppendFormat(dynamicUrlRequest);
                sb.Append(" ', 'ad')");
                sb.Append("\"");

                sb.AppendFormat("<form name='form' action='{0}' method='post'>", dynamicUrlRequest);
                sb.Append("</form>");

                sb.Append("</body>");
                sb.Append("</html>");

                string response = sb.ToString();

                LogMessage(PaymentGatewayLogEntryType.Request, OrderNumber, _distributorId, _gatewayName,
                           PaymentGatewayRecordStatusType.Unknown, response);

                //Task# 6818: Bankslip Deferred Payments
                SessionInfo _sessionInfo  = null;
                string      _locale       = HLConfigManager.Configurations.Locale;
                var         member        = ((MembershipUser <DistributorProfileModel>)Membership.GetUser()).Value;
                string      DistributorID = (null != member) ? member.Id : string.Empty;

                if (!string.IsNullOrEmpty(DistributorID))
                {
                    _sessionInfo = SessionInfo.GetSessionInfo(DistributorID, _locale);
                    if (_sessionInfo != null)
                    {
                        _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitted;
                        _sessionInfo.OrderNumber = OrderNumber;
                    }
                    else
                    {
                        LoggerHelper.Error(
                            string.Format(
                                "BankSlipBoldCronPaymentGatewayInvoker, Session is null. Order Number  : {0} ",
                                OrderNumber));
                    }
                }

                HttpContext.Current.Response.Write(response);
                //HttpContext.Current.Response.End();
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format(
                        "Bank Slip Bradesco Transfer Payment Gateway Invoker exception for: order number {0}, DS ID {1}  {2}",
                        OrderNumber, _distributorId, ex.Message));
            }
        }
        public override void Submit()
        {
            string redirectUrl                        = _configHelper.GetConfigEntry("paymentGatewayUrl");
            string redirectUrlProcessId               = _configHelper.GetConfigEntry("paymentGatewayProcessIdUrl");
            string returnUrl                          = string.Concat(RootUrl, _config.PaymentGatewayReturnUrlApproved);
            string retuntMyHlUrl                      = string.Format("{0}?Agency=ocapayment&OrderId={1}", returnUrl, this.OrderNumber);
            string processId                          = string.Empty;
            string SaleRequestString                  = "?Nrocom={0}&Nroterm={1}&Moneda={2}&Importe={3}&Plan={4}&Tcompra={5}&Urlresponse={6}&Info={7}&Tconn={8}&ConsFinal={9}&Importegrbd={10}&Nrofactura={11}";
            string PresentacionRequestString          = "<request><Idtrn>{0}</Idtrn><Nrocom>{1}</Nrocom><Nroterm>{2}</Nroterm><Moneda>{3}</Moneda><Importe>{4}</Importe><Plan>{5}</Plan><Info>{6}</Info><Urlresponse>{7}</Urlresponse><Tconn>{8}</Tconn></request>";
            string PresentacionSerializeRequestString = "A1={0}&A2={1}&A3={2}&A4={3}&A5={4}&A6={5}&A7={6}&A8={7}&A9={8}";
            var    payment = HttpContext.Current.Session[PaymentInformation] as CreditPayment_V01;

            HttpContext.Current.Session.Remove(PaymentInformation);
            string installments = (null != payment)
                          ? (payment.PaymentOptions as PaymentOptions_V01).NumberOfInstallments.ToString()
                          : null;

            if (string.IsNullOrEmpty(installments))
            {
                throw new ApplicationException("No Credit Card Installment Value was found. Unable to proceed");
            }
            string          nrocom;
            string          nroterm;
            string          orderNumber = this._orderNumber;
            string          amount      = (string.Format(this.getPriceFormat(this._orderAmount), this._orderAmount).Replace(".", "").Replace(",", ""));
            SessionInfo     myCart      = SessionInfo.GetSessionInfo(this._distributorId, this._locale);
            OrderTotals_V01 totals      = myCart.ShoppingCart.Totals as OrderTotals_V01;
            var             hasDiscount = OrderProvider.HasVATDiscount(totals);
            string          consFinal   = hasDiscount ? "1" : "0";
            string          importegrbd = hasDiscount ?
                                          (string.Format(
                                               this.getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)),
                                               (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", ""))
                                          .Replace(",", "") : string.Empty;
            string factura = hasDiscount ? orderNumber.Substring(3) : string.Empty;

            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat") || RootUrl.Contains("10.36.158.182") || RootUrl.Contains("http://10.36.173.61"))
            {
                nrocom  = _configHelper.GetConfigEntry("paymentGatewayNrocom");
                nroterm = _configHelper.GetConfigEntry("paymentGatewayNroterm");
            }
            else
            {
                // redirectUrl = GetConfigEntry("paymentGatewayBetaUrl");
                nrocom  = _configHelper.GetConfigEntry("paymentGatewayBetaNrocom");
                nroterm = _configHelper.GetConfigEntry("paymentGatewayBetaNroterm");
            }

            System.Net.ServicePointManager.ServerCertificateValidationCallback = (ssender, certificate, chain, sslPolicyErrors) => true;
            string postData = SetSaleTransactionData(SaleRequestString, nrocom, nroterm, "858", amount, installments,
                                                     "0", retuntMyHlUrl, orderNumber, "0", consFinal, importegrbd, factura);

            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, "before processid"); //remove
            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, postData);
            processId = getOcaTransactionId(postData).Trim();

            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, "after processid");//remove

            string postPresentationData = SetPresentacionTransactionData(PresentacionRequestString, processId, nrocom, nroterm, "858", amount, installments,
                                                                         orderNumber, retuntMyHlUrl, "0");

            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, postPresentationData);


            string postPresentationSerializeData = SetPresentacionTransactionData(PresentacionSerializeRequestString, processId, nrocom, nroterm, "858", amount, installments,
                                                                                  orderNumber, returnUrl, "0", true);

            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, postPresentationSerializeData);

            // Post and redirect to Produbanco website
            HttpContext.Current.Response.Clear();

            var sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""frmSolicitudPago""].submit()'>");
            sb.AppendFormat("<form name='frmSolicitudPago' action='{0}' method='post'>", redirectUrl);
            sb.AppendFormat("<input type='hidden' name='Idtrn' value='{0}'>", processId);
            sb.AppendFormat("<input type='hidden' name='Info' value='{0}'>", postPresentationSerializeData);
            sb.AppendFormat("<input type='hidden' name='Urlresponse' value='{0}'>", retuntMyHlUrl);
            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");

            string response = sb.ToString();

            LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, response);

            HttpContext.Current.Response.Write(response);
            HttpContext.Current.Response.End();
        }
        private List <string> GenerateHash(string vPOSPublicKey,
                                           string herbalifePrivateKey,
                                           string acquirerId,
                                           string storeId,
                                           string orderNumber,
                                           string vectorId,
                                           string amount,
                                           string returnUrl)
        {
            var    cipheredDataList = new List <string>();
            string R1; // = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayVPOSCRYPTOPublicKey.txt");
            string R2;

            // = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayHerbalifeSignaturePrivateKey.txt");
            if (RootUrl.Contains("local") || RootUrl.Contains("qa") || RootUrl.Contains("uat"))
            {
                R1 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayVPOSCRYPTOPublicKey.txt");
                R2 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\paymentGatewayHerbalifeSignaturePrivateKey.txt");
            }
            else
            {
                R1 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\BetapaymentGatewayVPOSCRYPTOPublicKey.txt");
                R2 = ResolveUrl("\\App_data\\PaymentsKeysProdubanco\\BetapaymentGatewayHerbalifeSignaturePrivateKey.txt");
            }

            var srVPOSLlaveCifradoPublica   = new StreamReader(R1);
            var srComercioLlaveFirmaPrivada = new StreamReader(R2);

            MyHLShoppingCart myCart;


            SessionInfo sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale);

            myCart = sessionInfoMyCart.ShoppingCart
                     ?? ShoppingCartProvider.GetShoppingCart(this._distributorId, this._locale);

            var oVPOSBean = new VPOSBean();

            oVPOSBean.acquirerId              = acquirerId;
            oVPOSBean.commerceId              = storeId;
            oVPOSBean.purchaseCurrencyCode    = "840";
            oVPOSBean.purchaseAmount          = amount;
            oVPOSBean.purchaseOperationNumber = orderNumber;

            OrderTotals_V01 totals = myCart.Totals as OrderTotals_V01;
            VPOSTax         oVPOSTax;
            var             aTaxes = new ArrayList();

            oVPOSTax        = new VPOSTax();
            oVPOSTax.Name   = "IVA";
            oVPOSTax.Amount =
                (string.Format(getPriceFormat((null != totals ? totals.TaxAmount : 0)),
                               (null != totals ? totals.TaxAmount : 0)).Replace(".", "")).Replace(",", "");
            // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34.

            aTaxes.Add(oVPOSTax);
            oVPOSTax        = new VPOSTax();
            oVPOSTax.Name   = "Servicio";
            oVPOSTax.Amount = "0";

            //string totalplustax = string.Empty;
            //totalplustax = (string.Format(getPriceFormat((null != myCart.Totals ? myCart.Totals.DiscountedItemsTotal + ((null != pHCharge ? pHCharge.Amount : 0) + (null != freightCharge ? freightCharge.Amount : 0)) : 0)), (null != myCart.Totals ? myCart.Totals.DiscountedItemsTotal + ((null != pHCharge ? pHCharge.Amount : 0) + (null != freightCharge ? freightCharge.Amount : 0)) : 0)).ToString().Replace(".", "")).Replace(",", ""); // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34.

            aTaxes.Add(oVPOSTax);
            oVPOSTax      = new VPOSTax();
            oVPOSTax.Name = "Monto Grava IVA";
            //oVPOSTax.Amount = totalplustax;
            oVPOSTax.Amount =
                (string.Format(getPriceFormat((null != totals ? totals.TaxableAmountTotal : 0)),
                               (null != totals ? totals.TaxableAmountTotal : 0)).Replace(".", "")).Replace
                    (",", "");
            // Only positive values are accepted.Value without formatting.Two last digits are cents. Eg. 1234 = 12.34.
            aTaxes.Add(oVPOSTax);

            oVPOSTax        = new VPOSTax();
            oVPOSTax.Name   = "Monto No Grava IVA";
            oVPOSTax.Amount = (string.Format(getPriceFormat((null != totals ? totals.AmountDue - totals.TaxAmount - totals.TaxableAmountTotal : 0)),
                                             (null != totals ? totals.AmountDue - totals.TaxAmount - totals.TaxableAmountTotal : 0)).Replace(".", "")).Replace(",", "");
            aTaxes.Add(oVPOSTax);
            oVPOSBean.taxes = aTaxes;

            var oVPOSSend = new VPOSSend(srVPOSLlaveCifradoPublica, srComercioLlaveFirmaPrivada, vectorId);

            oVPOSSend.execute(ref oVPOSBean);

            cipheredDataList.Add(oVPOSBean.cipheredSessionKey);
            cipheredDataList.Add(oVPOSBean.cipheredXML);
            cipheredDataList.Add(oVPOSBean.cipheredSignature);

            return(cipheredDataList);
        }