diff --git a/.coveragerc b/.coveragerc index 9075ae653..08f00ace8 100644 --- a/.coveragerc +++ b/.coveragerc @@ -8,7 +8,7 @@ omit = *receb1* *recem* *recet* - *recex1* + *formatos* *rg3685* *setup_win* *sired* diff --git a/conf/rece.ini b/conf/rece.ini index c2df91123..e0405d031 100644 --- a/conf/rece.ini +++ b/conf/rece.ini @@ -42,6 +42,12 @@ ENTRADA=entrada.txt SALIDA=salida.txt ##URL=https://servicios1.afip.gov.ar/wsfe/service.asmx +[WSFEXv1] +CUIT=20267565393 +ENTRADA=entrada.txt +SALIDA=salida.txt +##URL=https://servicios1.afip.gov.ar/wsfe/service.asmx + [WSCT] CUIT=20267565393 ENTRADA=entrada.txt diff --git a/formatos/formato_dbf.py b/formatos/formato_dbf.py index 652d7898a..fee231482 100644 --- a/formatos/formato_dbf.py +++ b/formatos/formato_dbf.py @@ -40,7 +40,7 @@ # definición del formato del archivo de intercambio: -from formato_txt import ( +from .formato_txt import ( A, N, I, diff --git a/recex1.py b/recex1.py index 8dc6af060..ba95958f7 100644 --- a/recex1.py +++ b/recex1.py @@ -203,7 +203,7 @@ def autorizar(ws, entrada, salida): print("DIF:", detalle["qty"] * detalle["precio"] - detalle["importe"]) print("id:", encabezado["id"]) - if not DEBUG or not sys.stdout.isatty() or input("Facturar?") == "S": + if not DEBUG or not sys.stdout.isatty() : ws.LanzarExcepcion = False cae = ws.Authorize(id=encabezado["id"]) dic = ws.factura @@ -277,7 +277,7 @@ def depurar_xml(client): f.write(client.xml_request) f.close() f = open("response-%s.xml" % fecha, "w") - f.write(client.xml_response) + f.write(client.xml_response.decode()) f.close() @@ -302,7 +302,7 @@ def main(): print(" /dbf: lee y almacena la información en tablas DBF") print() print("Ver rece.ini para parámetros de configuración (URL, certificados, etc.)") - sys.exit(0) + return config = abrir_conf(CONFIG_FILE, DEBUG) cert = config.get("WSAA", "CERT") @@ -380,10 +380,10 @@ def main(): print("AppServerStatus", ws.AppServerStatus) print("DbServerStatus", ws.DbServerStatus) print("AuthServerStatus", ws.AuthServerStatus) - sys.exit(0) + return if "/formato" in sys.argv: - from .formatos.formato_dbf import definir_campos + from .formatos import formato_dbf print("Formato:") for msg, formato in [ @@ -406,10 +406,10 @@ def main(): else: filename = "%s.dbf" % msg.lower()[:8] print("==== %s (%s) ====" % (msg, filename)) - claves, campos = definir_campos(formato) + claves, campos = formato_dbf.definir_campos(formato) for campo in campos: print(" * Campo: %s" % (campo,)) - sys.exit(0) + return # obteniendo el TA from .wsaa import WSAA @@ -531,7 +531,7 @@ def main(): }, open(salida, "w"), ) - sys.exit(0) + return if "/get" in sys.argv: print("Recuperar comprobante:") @@ -568,7 +568,7 @@ def main(): }, open(salida, "w"), ) - sys.exit(0) + return if "/ctz" in sys.argv: i = sys.argv.index("/ctz") @@ -579,7 +579,7 @@ def main(): ctz = ws.GetParamCtz(moneda_id) print("Cotizacion: ", ctz) print(ws.ErrMsg) - sys.exit(0) + return if "/monctz" in sys.argv: i = sys.argv.index("/monctz") @@ -590,7 +590,7 @@ def main(): ctz = ws.GetParamMonConCotizacion(fecha) print("\n".join(ctz)) print(ws.ErrMsg) - sys.exit(0) + return f_entrada = f_salida = None try: @@ -608,7 +608,7 @@ def main(): f_salida.close() if XML: depurar_xml(ws.client) - sys.exit(0) + return except Exception as e: print(str(e).encode("ascii", "ignore")) diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_ayuda.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_ayuda.yaml new file mode 100644 index 000000000..b96b59912 --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_ayuda.yaml @@ -0,0 +1,64 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:40.4021028-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:40 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf64a26f900950900750865d52c42385dbc95a43983acc515382474d61ae18b44e; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_ctz.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_ctz.yaml new file mode 100644 index 000000000..6b22b1291 --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_ctz.yaml @@ -0,0 +1,122 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=20267565393DOL\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1372' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetPARAM_Ctz"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: Homologacion - efa2021-08-02T04:15:50.5584178-03:002.1.0.0101.2110202107300OK0Ok + headers: + Cache-Control: + - no-cache + Content-Length: + - '792' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:50 GMT + Expect-CT: + - enforce + Expires: + - '-1' + MicrosoftOfficeWebServer: + - 5.0_Pub + Pragma: + - no-cache + Set-Cookie: + - TS01983a04=01439f1ddfad39ffa4e6c70c81bf4f927c339353d20a995bb9bf48622472413a07bd41b5fe; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:51.0115457-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:51 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf10529dc4f351a4a62a34068169642647072507e9224fe9cd0fda17744fbab63c; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_dummy.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_dummy.yaml new file mode 100644 index 000000000..71b8042b0 --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_dummy.yaml @@ -0,0 +1,118 @@ +interactions: +- request: + body: "\n\n\n + \ \n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '269' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXDummy"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: Homologacion - efa2021-08-02T04:15:42.5896168-03:002.1.0.0OKOKOK + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '626' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:42 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf4fc723fe7263fd190b19e9de46ee9cae8a944b7c09d0403aef5d64b15e84e7f0; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:43.0427447-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:43 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf3d0139d521942f88fa3004ff0fb240a60cfeb40afbc3bd8836ea80094f86638b; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_formato.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_formato.yaml new file mode 100644 index 000000000..c782e510f --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_formato.yaml @@ -0,0 +1,64 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIyMTQxMTU2MDQiIGdlbl90aW1lPSIxNjI0MzIyNzY5IiBleHBfdGltZT0iMTYyNDM2NjAyOSIvPgogICAgPG9wZXJhdGlvbiB0eXBlPSJsb2dpbiIgdmFsdWU9ImdyYW50ZWQiPgogICAgICAgIDxsb2dpbiBlbnRpdHk9IjMzNjkzNDUwMjM5IiBzZXJ2aWNlPSJ3c2ZleCIgdWlkPSJTRVJJQUxOVU1CRVI9Q1VJVCAyMDI2NzU2NTM5MywgQ049cmVpbmdhcnQyMDE5cHViIiBhdXRobWV0aG9kPSJjbXMiIHJlZ21ldGhvZD0iMjIiPgogICAgICAgICAgICA8cmVsYXRpb25zPgogICAgICAgICAgICAgICAgPHJlbGF0aW9uIGtleT0iMjAyNjc1NjUzOTMiIHJlbHR5cGU9IjQiLz4KICAgICAgICAgICAgPC9yZWxhdGlvbnM+CiAgICAgICAgPC9sb2dpbj4KICAgIDwvb3BlcmF0aW9uPgo8L3Nzbz4KeUvSFAaZuBLaMdtAhCs5ooLrkDqKsoL64GZpdAvHmxv1Q/zPAP6Et3py/yc8JR1Xo7JsrSFUBsxlaKzUelWSSC24R0kCp+wG5QHiF7kw0SLCnRu3CraK7+LkNuHIyPc5uZmLpXO3EiCE1ZxSraKDMYc3lNdmpDpGlh0mMv1d0gw=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:23:25.0286571-03:002.1.0.01000Usuario + no autorizado a realizar esta operacion. ValidacionDeToken: No validaron las + fechas del token GenTime, ExpTime, NowUTC: 1624322769 (6/22/2021 12:45:39 + AM), 1624366029 (6/22/2021 12:47:09 PM), 8/2/2021 7:23:25 AM0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '915' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:23:25 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf01f5500da17cad179dd06df50a023ad6d599a50754a3148fde37f400d5fc2885; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_get.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_get.yaml new file mode 100644 index 000000000..f5b01eda1 --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_get.yaml @@ -0,0 +1,119 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539321728\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1423' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetCMP"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:47.9959014-03:002.1.0.000000000001020Comprobante + inexistente0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '978' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:47 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf9acb767a80bed84268b126c025ecc172be8420ede52c5e4c504c003224053902; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:48.4334042-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:48 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf498ca19e6334a083c23f2d04068a470b6cd92137305d7f0647fac390d1cdc001; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_monctz.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_monctz.yaml new file mode 100644 index 000000000..c2a8362fe --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_monctz.yaml @@ -0,0 +1,123 @@ +interactions: +- request: + body: "\n\n\n + \ \n + \ PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539320210802\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1413' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetPARAM_MON_CON_COTIZACION"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: Homologacion - efa2021-08-02T04:15:53.1209342-03:002.1.0.00022.21107/30/20210077.21107/30/20210099.21107/30/202101010.21107/30/202101111.21107/30/202101212.21107/30/202101414.21107/30/202101515.21107/30/202101616.21107/30/202101818.21107/30/202101919.21107/30/202102121.21107/30/202102323.21107/30/202102424.21107/30/202102525.21107/30/202102626.21107/30/202102727.21107/30/202102828.21107/30/202102929.21107/30/202103030.21107/30/202103131.21107/30/202103232.21107/30/202103333.21107/30/202103434.21107/30/202103535.21107/30/202103636.21107/30/202104040.21107/30/202104141.21107/30/202104242.21107/30/202104343.21107/30/202104444.21107/30/202104545.21107/30/202104646.21107/30/202104747.21107/30/202104949.21107/30/202105151.21107/30/202105252.21107/30/202105353.21107/30/202105454.21107/30/202105555.21107/30/202105656.21107/30/202105757.21107/30/202105959.21107/30/202106060.21107/30/202106161.21107/30/202106262.21107/30/202106363.21107/30/202106464.21107/30/2021DOL101.21107/30/20210OK0Ok + headers: + Cache-Control: + - no-cache + Content-Length: + - '8093' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:53 GMT + Expect-CT: + - enforce + Expires: + - '-1' + MicrosoftOfficeWebServer: + - 5.0_Pub + Pragma: + - no-cache + Set-Cookie: + - TS01983a04=01439f1ddf9c3cf63f89a15381c25fdf0add2f730138c8fade6c813c73f0fb4cf81c892912; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:53.5740621-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:53 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf9aa83b01d36ef3c7104d94c242f91319433e2a9bf4a1287b90583280d0168cd9; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_prueba.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_prueba.yaml new file mode 100644 index 000000000..610dd698f --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_prueba.yaml @@ -0,0 +1,172 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=20267565393721\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1399' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetLast_CMP"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:09:01.056949-03:002.1.0.027201709070OK0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '797' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:09:01 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddfa7b80c09aa959060d65ad311eee9b0e4d5bf25a29893645e3bb77061449e1ca3; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=20267565393\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1348' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetLast_ID"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:09:01.4632016-03:002.1.0.09888888888883440OK0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '752' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:09:01 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddfc82ad92008878c6074982aaf8eca22ee55b77dc082256169ae3d1baa643393de; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:09:01.9007044-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:09:01 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddfd21c1ae5280a44c6ac6efd1ec52b98d5e333f259c2a808c948550177b627611b; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_wsfexv1_recex1/test_main_ult.yaml b/tests/cassettes/test_wsfexv1_recex1/test_main_ult.yaml new file mode 100644 index 000000000..c5bc6f0ab --- /dev/null +++ b/tests/cassettes/test_wsfexv1_recex1/test_main_ult.yaml @@ -0,0 +1,118 @@ +interactions: +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=20267565393721\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '1399' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXGetLast_CMP"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:45.4021348-03:002.1.0.027201709070OK0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '798' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:45 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddfc695762df18bff95617eff149b6da1c8603995673c697471a23f2e5076ec5a08; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: "\n\n\n + \ \n PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgc3JjPSJDTj13c2FhaG9tbywgTz1BRklQLCBDPUFSLCBTRVJJQUxOVU1CRVI9Q1VJVCAzMzY5MzQ1MDIzOSIgZHN0PSJjbj13c2ZleCxvPWFmaXAsYz1hciIgdW5pcXVlX2lkPSIzNDYzNTI0MTU0IiBnZW5fdGltZT0iMTYyNzg4NzkzMyIgZXhwX3RpbWU9IjE2Mjc5MzExOTMiLz4KICAgIDxvcGVyYXRpb24gdHlwZT0ibG9naW4iIHZhbHVlPSJncmFudGVkIj4KICAgICAgICA8bG9naW4gZW50aXR5PSIzMzY5MzQ1MDIzOSIgc2VydmljZT0id3NmZXgiIHVpZD0iU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPXJlaW5nYXJ0MjAyMSIgYXV0aG1ldGhvZD0iY21zIiByZWdtZXRob2Q9IjIyIj4KICAgICAgICAgICAgPHJlbGF0aW9ucz4KICAgICAgICAgICAgICAgIDxyZWxhdGlvbiBrZXk9IjIwMjY3NTY1MzkzIiByZWx0eXBlPSI0Ii8+CiAgICAgICAgICAgIDwvcmVsYXRpb25zPgogICAgICAgIDwvbG9naW4+CiAgICA8L29wZXJhdGlvbj4KPC9zc28+Cg==SZ1fyhMT8/62JmbcMZsvdnqAIcy9h2e86ymG5LLcRUzevrWbd9kktHaz89qgK7w0B2JrWfxBQ15s48TpI9sG/zdwIOFs6vOYo2rb/jsAz769kgfwvuMO5n9cnfjKVbqg4+Ur903NgcRocMN4GKo0Sn7G9CJADSgbgiOQCktg6v4=2026756539398888888888834520210802217281S99999AAXX999999A225203Joao + Da Silva0Rua + 76 km 34.5 AlagoasPJ54482221-lDOL19.8Observaciones + comerciales250.0Sin observaciones19212342011111111130 + diasFOBFlete a Bordo1PRO1Producto + Tipo 1 Exportacion MERCOSUR ISO 90012.01150.050.0250.0\n\n" + headers: + accept-encoding: + - gzip, deflate + content-length: + - '2619' + content-type: + - text/xml; charset="UTF-8" + soapaction: + - '"http://ar.gov.afip.dif.fexv1/FEXAuthorize"' + user-agent: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) + method: POST + uri: https://wswhomo.afip.gov.ar/wsfexv1/service.asmx + response: + body: + string: "Homologacion - efa2021-08-02T04:15:45.8552627-03:002.1.0.01667El + tipo de cambio no podr\xE1 ser inferior al 20% ni superior en un 100% del + que suministra AFIP como orientativo de acuerdo a la cotizaci\xF3n oficial. + Ver Metodo FEXGetPARAM_Ctz.0Ok\r\n" + headers: + Cache-Control: + - private, max-age=0 + Content-Length: + - '872' + Content-Type: + - text/xml; charset=utf-8 + Date: + - Mon, 02 Aug 2021 07:15:45 GMT + Expect-CT: + - enforce + MicrosoftOfficeWebServer: + - 5.0_Pub + Set-Cookie: + - TS01983a04=01439f1ddf33d10caebc8aa54948267fde91abdbbef7c4b9eef1e6604ba98f74431c8ff3c7; + Path=/ + Strict-Transport-Security: + - nosniff + X-AspNet-Version: + - 2.0.50727 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Powered-By: + - ASP.NET + X-Xss-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_wsfexv1_recex1.py b/tests/test_wsfexv1_recex1.py new file mode 100644 index 000000000..35889cea5 --- /dev/null +++ b/tests/test_wsfexv1_recex1.py @@ -0,0 +1,85 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +"""Test para recex1""" + +__author__ = "Mariano Reingart (reingart@gmail.com)" +__copyright__ = "Copyright (C) 2010-2021 Mariano Reingart" +__license__ = "LGPL-3.0-or-later" +__version__ = "3.38c" + +import pytest +import shutil +import sys +import time + +from pyafipws import wsfexv1 +from pyafipws import recex1 +from pyafipws.wsaa import WSAA + +HOMO = wsfexv1.HOMO +CONFIG_FILE = "conf/rece.ini" + +# entrada.txt required for testing +shutil.copy('tests/txt/entrada_recex1.txt','entrada.txt') + +pytestmark =[pytest.mark.vcr, pytest.mark.dontusefix, pytest.mark.freeze_time('2021-08-02')] + + +def test_main_ayuda(): + sys.argv = [] + sys.argv.append('/ayuda') + sys.argv.append('/debug') + recex1.main() + + +def test_main_prueba(): + sys.argv = [] + sys.argv.append('/prueba') + recex1.main() + +def test_main_dummy(): + sys.argv = [] + sys.argv.append('/dummy') + recex1.main() + +def test_main_formato(): + sys.argv = [] + sys.argv.append('/formato') + recex1.main() + +def test_main_ult(): + sys.argv = [] + sys.argv.append('/ult') + sys.argv.append('21') + sys.argv.append('7') + recex1.main() + +def test_main_get(): + sys.argv = [] + sys.argv.append('/get') + sys.argv.append('21') + sys.argv.append('7') + sys.argv.append('28') + recex1.main() + +def test_main_ctz(): + sys.argv = [] + sys.argv.append('/ctz') + sys.argv.append('DOL') + recex1.main() + +def test_main_monctz(): + sys.argv = [] + sys.argv.append('/monctz') + sys.argv.append('') + recex1.main() \ No newline at end of file diff --git a/tests/txt/entrada_recex1.txt b/tests/txt/entrada_recex1.txt new file mode 100644 index 000000000..dcd0537e9 --- /dev/null +++ b/tests/txt/entrada_recex1.txt @@ -0,0 +1,4 @@ +020210802210007000000281S203Joao Da Silva Rua 76 km 34.5 Alagoas PJ54482221-l 000000000025000DOL0019800000Observaciones comerciales Sin observaciones 30 dias FOBFlete a Bordo 1 988888888888345 +1PRO1 000002000000010001500000000000000025000000050000000Producto Tipo 1 Exportacion MERCOSUR ISO 9001 +299999AAXX999999A225 +301900020000123420111111111