Exemplo n.º 1
0
        private HttpsWebRequestsFunction MaquetarPaqueteSoap(HttpsWebRequestsFunction httpwebrequestFunction)
        {
            httpwebrequestFunction._companyId = "860504882";
            httpwebrequestFunction._accountid = "860504882_01";
            httpwebrequestFunction._Username  = "******";
            httpwebrequestFunction._userId    = "UsernameToken-1";
            EncodingFacturacionElectronica coding = new EncodingFacturacionElectronica();

            httpwebrequestFunction._Password = coding.SHA256Encrypt("F935Cjm9262@");
            //httpwebrequestFunction._Password = coding.SHA256Encrypt("TranserFac@1"); //"Tys860504882@1";
            httpwebrequestFunction._HttpWebRequestFunction = "UploadRequest";
            httpwebrequestFunction._create      = coding.getCreate();
            httpwebrequestFunction._nonce       = coding.getNonce(httpwebrequestFunction._FileName);
            httpwebrequestFunction._soapEnviado = GetSoapEnvio(httpwebrequestFunction);
            return(httpwebrequestFunction);
        }
Exemplo n.º 2
0
        private HttpsWebRequestsFunction maquetarSoapFactura(HttpsWebRequestsFunction httpwebrequestFunction)
        {
            string estado = string.Empty;

            httpwebrequestFunction._companyId = "860504882";
            httpwebrequestFunction._accountid = "860504882_01";
            httpwebrequestFunction._Username  = "******";
            httpwebrequestFunction._userId    = "UsernameToken-1";
            EncodingFacturacionElectronica coding = new EncodingFacturacionElectronica();

            httpwebrequestFunction._Password = coding.SHA256Encrypt("F935Cjm9262@");
            //httpwebrequestFunction._Password = coding.SHA256Encrypt("TranserFac@1");
            httpwebrequestFunction._HttpWebRequestFunction = "DownloadRequest";
            httpwebrequestFunction._create = coding.getCreate();
            httpwebrequestFunction._nonce  = coding.getNonce(httpwebrequestFunction._FileName);
            string documentType = "FE";

            if (httpwebrequestFunction._FileName.Contains("NC"))
            {
                documentType = "NC";
            }
            else
            {
                if (httpwebrequestFunction._FileName.Contains("ND"))
                {
                    documentType = "ND";
                }
            }
            switch (documentType)
            {
            case "NC":
            {
                httpwebrequestFunction._documentType = "NC";
                break;
            }

            case "ND":
            {
                httpwebrequestFunction._documentType = "ND";
                break;
            }

            case "FV":
            {
                httpwebrequestFunction._documentType = "FV";
                break;
            }

            default:
            {
                httpwebrequestFunction._documentType = "FE";
                break;
            }
            }
            httpwebrequestFunction._documentPrefix = httpwebrequestFunction._FileName.Substring(0, 4);
            httpwebrequestFunction._documentNumber = httpwebrequestFunction._FileName;
            httpwebrequestFunction._resourceType   = "PDF";
            httpWebSend xmlsend = new httpWebSend();

            httpwebrequestFunction._soapEnviado = xmlsend.getSoapEnvio(httpwebrequestFunction);

            //httpSendXmlDocument httpsSendXmlDocument = new httpSendXmlDocument(vgl);


            ////HttpWebResponseFunction httpWebResponseFunction = new HttpWebResponseFunction("Upload");

            //httpwebrequestFunction._httpWebResponseXml = httpsSendXmlDocument.httpsSendXmlDocument(httpwebrequestFunction._soapEnviado);
            //httpwebrequestFunction._RequestXmlf = httpsSendXmlDocument._vgp.httpwebrequestFunction._RequestXmlf;
            //httpwebrequestFunction._soapRecibido = httpwebrequestFunction._httpWebResponseXml;
            ////_vgp.informaciondian.INDI_XMLREC_BL = vgl.httpwebrequestFunction._soapRecibido;
            //httpWebRequestFunctionDownloadXML httpWebRequestFunctionDownloadXml = new httpWebRequestFunctionDownloadXML(_vgp);
            //httpWebRequestFunctionDownloadXml.httpwebRequestFunctionDownloadxml(vgl.httpwebrequestFunction._soapRecibido);
            return(httpwebrequestFunction);
        }
Exemplo n.º 3
0
        /*VERSION PRODUCCION*/
        private void procesarFactura(LogReporteDian infoFactura)
        {
            //console.Ih("",false);
            console.Ih("=> Procesar factura : " + infoFactura.LODI_LLAVE_V2 + " Fecha : " + infoFactura.LODI_FECREGISTRO_DT, false);
            validarDirectorio(infoFactura.LODI_LLAVE_V2);
            console.Ih("    * Generando informacion Dian");
            int recordProcessed = generarInfoDian(infoFactura.LODI_LLAVE_V2, infoFactura.LODI_OFICINA_NB, infoFactura.LODI_TRANSACCION_NB);
            ICollection <InformacionDian> ICInformacionDian = new List <InformacionDian>();

            console.Ih("    * LeerInformacionDian       ");
            ICInformacionDian = LeerInformacionDian(infoFactura.LODI_LLAVE_V2);
            if (ICInformacionDian.Count > 0)
            {
                foreach (var item in ICInformacionDian)
                {
                    HttpsWebRequestsFunction httpwebrequestFunction = new HttpsWebRequestsFunction();
                    httpwebrequestFunction._FacturaXml = item.INDI_XMLENV_CB;
                    httpwebrequestFunction._Numdoc     = infoFactura.LODI_LLAVE_V2;
                    console.Ih("    * Procesando Anexos         ");
                    if (procesarAnexos(infoFactura))
                    {
                        console.Ih("    * comprimirAdjuntos         ");
                        long sizeAnexo = comprimirAdjuntos(infoFactura.LODI_LLAVE_V2, item);
                        if (sizeAnexo <= 2300000)
                        {
                            console.Ih("    * comprimirFactura          ");
                            httpwebrequestFunction._FileName = infoFactura.LODI_LLAVE_V2 + ".zip";
                            if (comprimirFactura(infoFactura.LODI_LLAVE_V2, item.INDI_XMLENV_CB))
                            {
                                httpwebrequestFunction._FileData = GetdataXmlAnexos(infoFactura.LODI_LLAVE_V2);
                            }
                        }
                        else
                        {
                            console.Ih("    * Los Anexos sobrepasan la capacidad. Se envia sin Anexos");
                            httpwebrequestFunction._FileName = infoFactura.LODI_LLAVE_V2 + ".xml";
                            using (StreamWriter writer = new StreamWriter("c:\\transer\\ws\\facturacion\\" + infoFactura.LODI_LLAVE_V2 + "\\anexos\\" + infoFactura.LODI_LLAVE_V2 + ".xml"))
                            {
                                writer.WriteLine(item.INDI_XMLENV_CB);
                            }
                            EncodingFacturacionElectronica encoding = new EncodingFacturacionElectronica();
                            httpwebrequestFunction._FileData = encoding.Base64Encode(item.INDI_XMLENV_CB);
                        }
                    }
                    else
                    {
                        console.Ih("    * La Factura no tiene Anexos");
                        httpwebrequestFunction._FileName = infoFactura.LODI_LLAVE_V2 + ".xml";
                        using (StreamWriter writer = new StreamWriter("c:\\transer\\ws\\facturacion\\" + infoFactura.LODI_LLAVE_V2 + "\\anexos\\" + infoFactura.LODI_LLAVE_V2 + ".xml"))
                        {
                            writer.WriteLine(item.INDI_XMLENV_CB);
                        }
                        EncodingFacturacionElectronica encoding = new EncodingFacturacionElectronica();
                        httpwebrequestFunction._FileData = encoding.Base64Encode(item.INDI_XMLENV_CB);
                    }
                    console.Ih("=> Maquetando Paquete Soap      ");
                    httpwebrequestFunction = MaquetarPaqueteSoap(httpwebrequestFunction);
                    console.Ih("=> Enviando Factura             ");
                    httpwebrequestFunction = EnviarFactura(httpwebrequestFunction);
                    console.Ih("=> Procesando Respuesta         ");
                    string statusFactura = procesarNewXMLRecibido(httpwebrequestFunction, infoFactura);
                }
            }
            else
            {
                //"No hay informacion asociada a la factura....
            }
        }
Exemplo n.º 4
0
        private HttpsWebRequestsFunction maquetarSoapCufe(HttpsWebRequestsFunction httpwebrequestFunction)
        {
            string estado = string.Empty;

            httpwebrequestFunction._companyId = "860504882";
            httpwebrequestFunction._accountid = "860504882_01";
            httpwebrequestFunction._Username  = "******";
            httpwebrequestFunction._userId    = "UsernameToken-1";
            EncodingFacturacionElectronica coding = new EncodingFacturacionElectronica();

            httpwebrequestFunction._Password = coding.SHA256Encrypt("F935Cjm9262@");
            //httpwebrequestFunction._Password = coding.SHA256Encrypt("TranserFac@1");
            httpwebrequestFunction._HttpWebRequestFunction = "DownloadRequest";
            httpwebrequestFunction._create = coding.getCreate();
            httpwebrequestFunction._nonce  = coding.getNonce(httpwebrequestFunction._FileName);
            string documentType = "FE";

            if (httpwebrequestFunction._FileName.Contains("NC"))
            {
                documentType = "NC";
            }
            else
            {
                if (httpwebrequestFunction._FileName.Contains("ND"))
                {
                    documentType = "ND";
                }
            }
            switch (documentType)
            {
            case "NC":
            {
                httpwebrequestFunction._documentType = "NC";
                break;
            }

            case "ND":
            {
                httpwebrequestFunction._documentType = "ND";
                break;
            }

            case "FV":
            {
                httpwebrequestFunction._documentType = "FV";
                break;
            }

            default:
            {
                httpwebrequestFunction._documentType = "FE";
                break;
            }
            }
            httpwebrequestFunction._documentPrefix = httpwebrequestFunction._FileName.Substring(0, 4);
            httpwebrequestFunction._documentNumber = httpwebrequestFunction._FileName;
            httpwebrequestFunction._resourceType   = "SIGNED_XML";
            httpWebSend xmlsend = new httpWebSend();

            httpwebrequestFunction._soapEnviado = xmlsend.getSoapEnvio(httpwebrequestFunction);
            return(httpwebrequestFunction);
        }