Esempio n. 1
0
        public static BEWSConsultarCIPResponseMod1 ConsultarCIPsMod1(BEWSConsultarCIPRequestMod1 request)
        {
            BEWSConsultarCIPResponseMod1 response = new BEWSConsultarCIPResponseMod1();

            using (var proxy = new WSCrypto())
            {
                proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                proxy.Proxy             = WebProxy.GetDefaultProxy();
                proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                request.CIPS            = request.CIPS.Trim();
                request.Firma           = proxy.Signer(request.CIPS, ByteUtil.FileToByteArray(PrivatePath));
                request.CIPS            = proxy.EncryptText(request.CIPS, ByteUtil.FileToByteArray(PublicPathContraparte));
                using (var proxyCIP = new Service())
                {
                    response = proxyCIP.ConsultarCIPMod1(request);
                    if (response != null)
                    {
                        if (!String.IsNullOrEmpty(response.XML))
                        {
                            response.XML = proxy.DecryptText(response.XML, ByteUtil.FileToByteArray(PrivatePath));
                        }
                    }
                }
            }
            return(response);
        }
Esempio n. 2
0
        public static BEpaymentResponse GenerarCIP(BEGenRequest paymentRequest)
        {
            BEWSGenCIPRequestMod1 solicitud = new BEWSGenCIPRequestMod1();

            solicitud.CodServ = ConfigurationManager.AppSettings["PE_MERCHAND_ID"];
            bl_helper hlp = new bl_helper();

            solicitud.Xml = hlp.convertToXml(ref paymentRequest).Replace("BEGenRequest", "SolPago");

            BEWSGenCIPResponseMod1 response = new BEWSGenCIPResponseMod1();

            using (var proxy = new WSCrypto())
            {
                proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                proxy.Proxy             = WebProxy.GetDefaultProxy();
                proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                solicitud.Xml           = solicitud.Xml.Trim();
                solicitud.Firma         = proxy.Signer(solicitud.Xml, ByteUtil.FileToByteArray(PrivateKey));
                solicitud.Xml           = proxy.EncryptText(solicitud.Xml, ByteUtil.FileToByteArray(PublicKey));
                using (var proxyCIP = new Service())
                {
                    response = proxyCIP.GenerarCIPMod1(solicitud);
                    if (response != null)
                    {
                        if (!String.IsNullOrEmpty(response.Xml))
                        {
                            response.Xml = proxy.DecryptText(response.Xml, ByteUtil.FileToByteArray(PrivateKey));
                        }
                    }
                }
            }
            BEpaymentResponse paymentResponse = new BEpaymentResponse();
            XmlElement        element         = default(XmlElement);

            if ((response != null))
            {
                XmlDocument xml = new XmlDocument();
                xml.InnerXml = response.Xml;
                element      = (XmlElement)xml.SelectSingleNode("ConfirSolPago");
                XmlElement elementchild           = (XmlElement)element.SelectSingleNode("CIP");
                XmlElement elementchildCIP        = (XmlElement)elementchild.SelectSingleNode("NumeroOrdenPago");
                XmlElement elementchildMerchandID = (XmlElement)elementchild.SelectSingleNode("MerchantID");
                XmlElement elementchildtoken      = (XmlElement)element.SelectSingleNode("Token");

                paymentResponse.NumeroCip  = elementchildCIP.InnerText;
                paymentResponse.IdComercio = elementchildMerchandID.InnerText;
                paymentResponse.Token      = elementchildtoken.InnerText;
                paymentResponse.Estado     = response.Estado;
                paymentResponse.Mensaje    = response.Mensaje;
                paymentResponse.Xml        = response.Xml;
            }
            else
            {
                return(null);
            }
            return(paymentResponse);
        }
Esempio n. 3
0
        public static BEWSElimCIPResponseMod1 EliminarCIPMod1(BEWSElimCIPRequestMod1 request)
        {
            BEWSElimCIPResponseMod1 response = new BEWSElimCIPResponseMod1();

            using (var proxy = new WSCrypto())
            {
                proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                proxy.Proxy             = WebProxy.GetDefaultProxy();
                proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                request.CIP             = request.CIP.Trim();
                request.Firma           = proxy.Signer(request.CIP, ByteUtil.FileToByteArray(PrivatePath));
                request.CIP             = proxy.EncryptText(request.CIP, ByteUtil.FileToByteArray(PublicPathContraparte));
                using (var proxyCIP = new Service())
                {
                    response = proxyCIP.EliminarCIPMod1(request);
                }
            }
            return(response);
        }
Esempio n. 4
0
        public static BEWSElimCIPResponseMod1 EliminarCIP(BEWSElimCIPRequestMod1 request)
        {
            request.CodServ = ConfigurationManager.AppSettings["PE_MERCHAND_ID"];
            BEWSElimCIPResponseMod1 response = new BEWSElimCIPResponseMod1();

            using (var proxy = new WSCrypto())
            {
                proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                proxy.Proxy             = WebProxy.GetDefaultProxy();
                proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                request.CIP             = request.CIP.Trim();
                request.Firma           = proxy.Signer(request.CIP, ByteUtil.FileToByteArray(PrivateKey));
                request.CIP             = proxy.EncryptText(request.CIP, ByteUtil.FileToByteArray(PublicKey));
                using (var proxyCIP = new Service())
                {
                    response = proxyCIP.EliminarCIPMod1(request);
                }
            }
            return(response);
        }
Esempio n. 5
0
        public static BEWSActualizaCIPResponseMod1 ActualizarCIP(BEWSActualizaCIPRequestMod1 request)
        {
            request.CodServ = ConfigurationManager.AppSettings["PE_MERCHAND_ID"];
            BEWSActualizaCIPResponseMod1 response = new BEWSActualizaCIPResponseMod1();

            using (var proxy = new WSCrypto())
            {
                proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                proxy.Proxy             = WebProxy.GetDefaultProxy();
                proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                request.CIP             = request.CIP.Trim();
                request.Firma           = proxy.Signer(request.CIP, ByteUtil.FileToByteArray(PrivateKey));
                request.CIP             = proxy.EncryptText(request.CIP, ByteUtil.FileToByteArray(PublicKey));
                using (var proxyCIP = new Service())
                {
                    response = proxyCIP.ActualizarCIPMod1(request);
                    //if (response != null)
                    //    if (!String.IsNullOrEmpty(response.XML))
                    //        response.XML = proxy.DecryptText(response.XML, ByteUtil.FileToByteArray(PrivatePath));
                }
            }
            return(response);
        }
Esempio n. 6
0
        public static BEWSConsultarCIPResponseMod1 ConsultarCIP(BEWSConsultarCIPRequestMod1 request)
        {
            request.CodServ = ConfigurationManager.AppSettings["PE_MERCHAND_ID"];
            BEWSConsultarCIPResponseMod1 response = new BEWSConsultarCIPResponseMod1();

            try
            {
                using (var proxy = new WSCrypto())
                {
                    proxy.Credentials       = System.Net.CredentialCache.DefaultNetworkCredentials;
                    proxy.Proxy             = WebProxy.GetDefaultProxy();
                    proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                    request.CIPS            = request.CIPS.Trim();
                    request.Firma           = proxy.Signer(request.CIPS, ByteUtil.FileToByteArray(PrivateKey));
                    request.CIPS            = proxy.EncryptText(request.CIPS, ByteUtil.FileToByteArray(PublicKey));
                    using (var proxyCIP = new Service())
                    {
                        response = proxyCIP.ConsultarCIPMod1(request);
                        if (response != null)
                        {
                            if (!String.IsNullOrEmpty(response.XML))
                            {
                                response.XML = proxy.DecryptText(response.XML, ByteUtil.FileToByteArray(PrivateKey));
                            }
                        }
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Mensaje = ex.Message;
                response.Estado  = "-1";
                return(response);
            }
        }