Beispiel #1
0
        private HttpsWebRequestsFunction EnviarFactura(HttpsWebRequestsFunction httpwebrequestFunction)
        {
            HttpSendXmlDocument httpsSendXmlDocument = new HttpSendXmlDocument();

            httpwebrequestFunction = httpsSendXmlDocument.httpsSendXmlDocument(httpwebrequestFunction);
            httpwebrequestFunction._soapRecibido = httpwebrequestFunction._httpWebResponseXml;
            return(httpwebrequestFunction);
        }
Beispiel #2
0
        private HttpsWebRequestsFunction EnviarFactura(HttpsWebRequestsFunction httpwebrequestFunction)
        {
            HttpSendXmlDocument httpsSendXmlDocument = new HttpSendXmlDocument();
            bool continuar = true;
            int  intentos  = 0;

            while (continuar)
            {
                httpwebrequestFunction = httpsSendXmlDocument.httpsSendXmlDocument(httpwebrequestFunction);
                if (httpwebrequestFunction._httpWebResponseXml.Contains("error"))
                {
                    intentos++;
                    System.Threading.Thread.Sleep(2000);
                }
                else
                {
                    continuar = false;//<status>
                }
            }

            httpwebrequestFunction._soapRecibido = httpwebrequestFunction._httpWebResponseXml;
            return(httpwebrequestFunction);
        }
Beispiel #3
0
        private string procesarFactura(Vgp vgl)
        {
            controlDirectorio cd = new controlDirectorio();

            cd.validarDirectorio(vgl._LogReporteDian.LODI_LLAVE_V2);
            if (pdbinfodian(vgl._LogReporteDian.LODI_LLAVE_V2, vgl._LogReporteDian.LODI_OFICINA_NB, vgl._LogReporteDian.LODI_TRANSACCION_NB))
            {
                //_vgs._tipoDocumento=
                Anexos anexos = new Anexos(vgl);
                if (anexos.getAnexos(vgl._LogReporteDian.LODI_LLAVE_V2))
                {
                    //vgl.upload.UPLO_FILENAME_V2 = vgl._LogReporteDian.LODI_LLAVE_V2 + ".zip";

                    //18092019vgl._HttpWebRequestFunction._FileName = vgl._LogReporteDian.LODI_LLAVE_V2 + ".zip";
                    vgl._HttpWebRequestFunction._FileName = _newconsecutivo + ".zip";

                    if (anexos.sizeAnexo < 2100000)
                    {
                        //vgl._HttpWebRequestFunction._FileName = _newconsecutivo + ".xml";
                        //18092019anexos.comprimirFacturaAdjuntos(vgl._LogReporteDian.LODI_LLAVE_V2, vgl._InformacionDian.INDI_XMLENV_CB);
                        anexos.comprimirFacturaAdjuntos(vgl._LogReporteDian.LODI_LLAVE_V2, vgl._InformacionDian.INDI_XMLENV_CB);
                        vgl._HttpWebRequestFunction._FileData = anexos.getdataXmlAnexos(_newconsecutivo);
                    }
                    else
                    {
                        ////18092019vgl._HttpWebRequestFunction._FileName = vgl._LogReporteDian.LODI_LLAVE_V2 + ".xml";
                        vgl._HttpWebRequestFunction._FileName = _newconsecutivo + ".xml";

                        _log.cfg(vgl._Directorio + "\\" + vgl._InformacionDian.INDI_NUMDOC_V2 + "\\anexos\\", vgl._InformacionDian.INDI_NUMDOC_V2 + ".xml", vgl._InformacionDian.INDI_XMLENV_CB);
                        EncodingFe encoding = new EncodingFe(vgl);
                        vgl._HttpWebRequestFunction._FileData = encoding.Base64Encode(vgl._InformacionDian.INDI_XMLENV_CB);
                        _log.cfg(vgl._Directorio + "\\" + vgl._InformacionDian.INDI_NUMDOC_V2 + "\\anexos\\", vgl._InformacionDian.INDI_NUMDOC_V2 + ".enc", vgl._HttpWebRequestFunction._FileData);
                    }
                }
                else
                {
                    //18092019vgl._HttpWebRequestFunction._FileName = vgl._LogReporteDian.LODI_LLAVE_V2 + ".xml";
                    vgl._HttpWebRequestFunction._FileName = _newconsecutivo + ".xml";
                    _log.cfg(vgl._Directorio + "\\" + vgl._InformacionDian.INDI_NUMDOC_V2 + "\\anexos\\", vgl._InformacionDian.INDI_NUMDOC_V2 + ".xml", vgl._InformacionDian.INDI_XMLENV_CB);
                    EncodingFe encoding = new EncodingFe(vgl);
                    vgl._HttpWebRequestFunction._FileData = encoding.Base64Encode(vgl._InformacionDian.INDI_XMLENV_CB);
                    _log.cfg(vgl._Directorio + "\\" + vgl._InformacionDian.INDI_NUMDOC_V2 + "\\anexos\\", vgl._InformacionDian.INDI_NUMDOC_V2 + ".enc", vgl._HttpWebRequestFunction._FileData);
                }

                vgl._HttpWebRequestFunction._companyId = "860504882";
                vgl._HttpWebRequestFunction._accountid = "860504882_01";
                vgl._HttpWebRequestFunction._Username  = "******";
                vgl._HttpWebRequestFunction._userId    = "UsernameToken-1";
                EncodingFe conding = new EncodingFe(vgl);
                //PRUEBAS_vgs.upload._Password = conding.SHA256Encrypt("Tys860504882@1"); //"Tys860504882@1";
                //18092019vgl._HttpWebRequestFunction._Password = conding.SHA256Encrypt("F935Cjm9262@"); //"Tys860504882@1";
                vgl._HttpWebRequestFunction._Password               = conding.SHA256Encrypt("TranserFac@1"); //"Tys860504882@1";
                vgl._HttpWebRequestFunction._FacturaXml             = vgl._InformacionDian.INDI_XMLENV_CB;
                vgl._HttpWebRequestFunction._HttpWebRequestFunction = "UploadRequest";
                EncodingFe sha = new EncodingFe(vgl);
                vgl._HttpWebRequestFunction._create = sha.getCreate();
                //PACHO_vgs.upload._nonce = sha.getNonce(_vgs._LogReporteDian.LODI_LLAVE_V2);
                vgl._HttpWebRequestFunction._nonce = sha.getNonce(vgl._HttpWebRequestFunction._FileName);

                httpWebSend xmlsend = new httpWebSend(vgl);
                //string soap = xmlsend.getSoapEnvio(_vgs);
                vgl._HttpWebRequestFunction._soapEnviado = xmlsend.getSoapEnvio(vgl);
                HttpSendXmlDocument httpsSendXmlDocument = new HttpSendXmlDocument(vgl);


                //HttpWebResponseFunction httpWebResponseFunction = new HttpWebResponseFunction("Upload");
                vgl._HttpWebRequestFunction._RequestXmlf = httpsSendXmlDocument._vgp._HttpWebRequestFunction._RequestXmlf;

                vgl._HttpWebRequestFunction._httpWebResponseXml = httpsSendXmlDocument.httpsSendXmlDocument(vgl._HttpWebRequestFunction._soapEnviado);


                vgl._HttpWebRequestFunction._soapRecibido = vgl._HttpWebRequestFunction._httpWebResponseXml;

                //18092019vgl._StatusFactura = procesarXMLRecibido(vgl._HttpWebRequestFunction._soapRecibido);
            }
            else
            {
                _correo.envioCorreoDesarrollador("No existe XML asociado a la factura", "No fue posible generar el XML de la factura : " + _vgp._LogReporteDian.LODI_LLAVE_V2 + "\r\n La ejecucion del procedimiento : pdbInfoDian(vgl._LogReporteDian.LODI_LLAVE_V2, vgl._LogReporteDian.LODI_OFICINA_NB, vgl._LogReporteDian.LODI_TRANSACCION_NB) no logro generar el XML.", _vgp);
            }
            return(vgl._StatusFactura);
        }