-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cumulative updates f/ develop (python3 conversion)
* 2to3 -w file.py * python -m black file.py * iconv -f iso-8859-1 -t utf-8 < file_new.py > file.py
- Loading branch information
Showing
6 changed files
with
231 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,9 @@ | |
from builtins import next | ||
|
||
__author__ = "Mariano Reingart <[email protected]>" | ||
__copyright__ = "Copyright (C) 2017 Mariano Reingart" | ||
__copyright__ = "Copyright (C) 2017-2022 Mariano Reingart" | ||
__license__ = "GPL 3.0" | ||
__version__ = "3.04e" | ||
__version__ = "3.05a" | ||
|
||
import csv | ||
import datetime | ||
|
@@ -42,6 +42,7 @@ | |
abrir_conf, | ||
norm, | ||
SoapFault, | ||
safe_console, | ||
) | ||
from configparser import SafeConfigParser | ||
from pyafipws.padron import TIPO_CLAVE, PROVINCIAS | ||
|
@@ -54,6 +55,7 @@ | |
|
||
|
||
class WSSrPadronA4(BaseWS): | ||
<<<<<<< HEAD | ||
"Interfaz para el WebService de Consulta Padrón Contribuyentes Alcance 4" | ||
_public_methods_ = [ | ||
"Consultar", | ||
|
@@ -97,6 +99,7 @@ class WSSrPadronA4(BaseWS): | |
"nro_doc", | ||
"tipo_persona", | ||
"estado", | ||
"es_sucesion", | ||
"impuestos", | ||
"actividades", | ||
"direccion", | ||
|
@@ -125,6 +128,7 @@ def inicializar(self): | |
self.tipo_persona = "" # FISICA o JURIDICA | ||
self.tipo_doc = self.nro_doc = 0 | ||
self.estado = "" # ACTIVO | ||
self.es_sucesion = "" | ||
self.denominacion = "" | ||
self.direccion = self.localidad = self.provincia = self.cod_postal = "" | ||
self.domicilios = [] | ||
|
@@ -274,6 +278,7 @@ def Consultar(self, id_persona): | |
self.nro_doc = data.get("idPersona") | ||
self.cuit = self.nro_doc | ||
self.estado = data.get("estadoClave") | ||
self.es_sucesion = data.get("esSucesion") | ||
if not "razonSocial" in data: | ||
self.denominacion = ", ".join( | ||
[data.get("apellido", ""), data.get("nombre", "")] | ||
|
@@ -320,6 +325,7 @@ def main(): | |
global CONFIG_FILE | ||
|
||
DEBUG = "--debug" in sys.argv | ||
safe_console() | ||
|
||
if "--constancia" in sys.argv: | ||
padron = WSSrPadronA5() | ||
|
@@ -427,6 +433,7 @@ def main(): | |
print("Denominacion:", padron.denominacion) | ||
print("Tipo:", padron.tipo_persona, padron.tipo_doc, padron.nro_doc) | ||
print("Estado:", padron.estado) | ||
print("Es Sucesion:", padron.es_sucesion) | ||
print("Direccion:", padron.direccion) | ||
print("Localidad:", padron.localidad) | ||
print("Provincia:", padron.provincia) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,9 @@ | |
from builtins import str | ||
|
||
__author__ = "Mariano Reingart ([email protected])" | ||
__copyright__ = "Copyright (C) 2011-2021 Mariano Reingart" | ||
__copyright__ = "Copyright (C) 2011-2023 Mariano Reingart" | ||
__license__ = "LGPL-3.0-or-later" | ||
__version__ = "3.10a" | ||
__version__ = "3.11a" | ||
|
||
import datetime | ||
import decimal | ||
|
@@ -44,6 +44,7 @@ class WSFEXv1(BaseWS): | |
"GetCMP", | ||
"AgregarPermiso", | ||
"AgregarCmpAsoc", | ||
"AgregarActividad", | ||
"GetParamMon", | ||
"GetParamTipoCbte", | ||
"GetParamTipoExpo", | ||
|
@@ -67,6 +68,7 @@ class WSFEXv1(BaseWS): | |
"GetParametro", | ||
"GetLastCMP", | ||
"GetLastID", | ||
"GetParamActividades", | ||
"Dummy", | ||
"Conectar", | ||
"SetTicketAcceso", | ||
|
@@ -192,6 +194,7 @@ def CrearFactura( | |
"cbtes_asoc": [], | ||
"permisos": [], | ||
"detalles": [], | ||
"actividades": [], | ||
} | ||
self.factura = fact | ||
|
||
|
@@ -237,6 +240,12 @@ def AgregarCmpAsoc( | |
) | ||
return True | ||
|
||
def AgregarActividad(self, actividad_id=0, **kwarg): | ||
"Agrego actividad a una factura (interna)" | ||
act = {"actividad_id": actividad_id} | ||
self.factura["actividades"].append(act) | ||
return True | ||
|
||
@inicializar_y_capturar_excepciones | ||
def Authorize(self, id): | ||
"Autoriza la factura cargada en memoria" | ||
|
@@ -304,6 +313,16 @@ def Authorize(self, id): | |
} | ||
for d in f["detalles"] | ||
], | ||
"Actividades": f["actividades"] | ||
and [ | ||
{ | ||
"Actividad": { | ||
"Id": a["actividad_id"], | ||
} | ||
} | ||
for a in f["actividades"] | ||
] | ||
or None, | ||
}, | ||
) | ||
|
||
|
@@ -748,23 +767,57 @@ def GetParamPtosVenta(self, sep="|"): | |
res = ret["FEXGetPARAM_PtoVentaResult"].get("FEXResultGet") | ||
ret = [] | ||
for pu in res: | ||
u = pu["ClsFEXResponse_PtoVenta"] | ||
p = pu["ClsFEXResponse_PtoVenta"] | ||
try: | ||
r = { | ||
"nro": u.get("Pve_Nro"), | ||
"baja": u.get("Pve_FchBaj"), | ||
"bloqueado": u.get("Pve_Bloqueado"), | ||
"nro": p.get("Pve_Nro"), | ||
"baja": p.get("Pve_FchBaj"), | ||
"bloqueado": p.get("Pve_Bloqueado"), | ||
} | ||
except Exception as e: | ||
print(e) | ||
ret.append(r) | ||
return [ | ||
(u"%(nro)s\tBloqueado:%(bloqueado)s\tFchBaja:%(baja)s" % r).replace( | ||
("%(nro)s\tBloqueado:%(bloqueado)s\tFchBaja:%(baja)s" % r).replace( | ||
"\t", sep | ||
) | ||
for r in ret | ||
] | ||
|
||
@inicializar_y_capturar_excepciones | ||
def GetParamActividades(self, sep="|"): | ||
"Recuperar lista de valores referenciales de códigos de Idiomas" | ||
ret = self.client.FEXGetPARAM_Actividades( | ||
Auth={ | ||
"Token": self.Token, | ||
"Sign": self.Sign, | ||
"Cuit": self.Cuit, | ||
} | ||
) | ||
result = ret["FEXGetPARAM_ActividadesResult"] | ||
self.__analizar_errores(result) | ||
|
||
ret = [] | ||
for u in result.get("FEXResultGet", []): | ||
u = u["ClsFEXResponse_ActividadTipo"] | ||
try: | ||
r = { | ||
"codigo": u.get("Id"), | ||
"ds": u.get("Desc"), | ||
"orden": u.get("Orden"), | ||
} | ||
except Exception as e: | ||
print(e) | ||
|
||
ret.append(r) | ||
if sep: | ||
return [ | ||
("\t%(codigo)s\t%(ds)s\t%(orden)s\t" % it).replace("\t", sep) | ||
for it in ret | ||
] | ||
else: | ||
return ret | ||
|
||
|
||
class WSFEX(WSFEXv1): | ||
"Wrapper para retrocompatibilidad con WSFEX" | ||
|
@@ -936,6 +989,8 @@ def main(): | |
cbteasoc_tipo, cbteasoc_pto_vta, cbteasoc_nro, cbteasoc_cuit | ||
) | ||
|
||
ok = wsfexv1.AgregarActividad(1234) | ||
|
||
##id = "99000000000100" # número propio de transacción | ||
# obtengo el último ID y le adiciono 1 | ||
# (advertencia: evitar overflow y almacenar!) | ||
|
@@ -1039,6 +1094,11 @@ def main(): | |
for r in ret: | ||
print("||%(codigo)s||%(ds)s||" % r) | ||
|
||
print("=== Actividades ===") | ||
ret = wsfexv1.GetParamActividades(sep=False) | ||
for r in ret: | ||
print("||%(codigo)s||%(ds)s||" % r) | ||
|
||
if "--ctz" in sys.argv: | ||
print(wsfexv1.GetParamCtz("DOL")) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,9 @@ | |
from past.builtins import basestring | ||
|
||
__author__ = "Mariano Reingart <[email protected]>" | ||
__copyright__ = "Copyright (C) 2013-2021 Mariano Reingart" | ||
__copyright__ = "Copyright (C) 2013-2022 Mariano Reingart" | ||
__license__ = "LGPL-3.0-or-later" | ||
__version__ = "3.35b" | ||
__version__ = "3.35e" | ||
|
||
LICENCIA = """ | ||
wslpg.py: Interfaz para generar Código de Operación Electrónica para | ||
|
@@ -160,11 +160,11 @@ | |
("nro_ing_bruto_corredor", 15, N), | ||
("comision_corredor", 5, I, 2), # 3.2 | ||
("fecha_precio_operacion", 10, A), # 26/02/2013 | ||
("precio_ref_tn", 8, I, 3), # 4.3 | ||
("precio_ref_tn", 17, I, 3), # 4.3 | ||
("cod_grado_ref", 2, A), | ||
("cod_grado_ent", 2, A), | ||
("factor_ent", 6, I, 3), # 3.3 | ||
("precio_flete_tn", 7, I, 2), # 5.2 | ||
("precio_flete_tn", 17, I, 2), # 5.2 | ||
("cont_proteico", 6, I, 3), # 3.3 | ||
("alic_iva_operacion", 5, I, 2), # 3.2 | ||
("campania_ppal", 4, N), | ||
|
@@ -237,7 +237,7 @@ | |
("tipo_reg", 1, A), # 2: Retencion | ||
("codigo_concepto", 2, A), | ||
("detalle_aclaratorio", 30, A), | ||
("base_calculo", 10, I, 2), # 8.2 | ||
("base_calculo", 17, I, 2), # 8.2 | ||
("alicuota", 6, I, 2), # 3.2 | ||
("nro_certificado_retencion", 14, N), | ||
("fecha_certificado_retencion", 10, A), | ||
|
@@ -252,17 +252,17 @@ | |
("dias_almacenaje", 4, N), | ||
("reservado1", 6, I, 3), | ||
("comision_gastos_adm", 5, I, 2), # 3.2 | ||
("base_calculo", 10, I, 2), # 8.2 | ||
("base_calculo", 17, I, 2), # 8.2 | ||
("alicuota", 6, I, 2), # 3.2 | ||
("importe_iva", 17, I, 2), # 17.2 | ||
("importe_deduccion", 17, I, 2), # 17.2 | ||
("precio_pkg_diario", 11, I, 8), # 3.8, ajustado WSLPGv1.2 | ||
("precio_pkg_diario", 17, I, 8), # 3.8, ajustado WSLPGv1.2 | ||
] | ||
|
||
PERCEPCION = [ | ||
("tipo_reg", 1, A), # P: Percepcion | ||
("detalle_aclaratoria", 50, A), # max 50 por WSLPGv1.8 | ||
("base_calculo", 10, I, 2), # 8.2 | ||
("base_calculo", 17, I, 2), # 8.2 | ||
("alicuota", 6, I, 2), # 3.2 | ||
("importe_final", 19, I, 2), # 17.2 (LPG WSLPGv1.16) | ||
] | ||
|
@@ -348,10 +348,10 @@ | |
("servicios_otros", 7, I, 3), | ||
("servicios_forma_de_pago", 20, A), | ||
# campos para cgAutorizarRetiroTransferencia (WSLPGv1.6): | ||
('cuit_receptor', 11, N), | ||
('fecha', 10, A), # no usado WSLPGv1.8 | ||
('nro_carta_porte_a_utilizar', 13, N), # obligatorio para retiro | ||
('cee_carta_porte_a_utilizar', 10, N), # no usado WSLPGv1.8 | ||
("cuit_receptor", 11, N), | ||
("fecha", 10, A), # no usado WSLPGv1.8 | ||
("nro_carta_porte_a_utilizar", 13, N), # obligatorio para retiro | ||
("cee_carta_porte_a_utilizar", 10, N), # no usado WSLPGv1.8 | ||
# para cgAutorizarPreexistente (WSLPGv1.6): | ||
("tipo_certificado_deposito_preexistente", 1, N), # "R": Retiro "T": Tra. | ||
("nro_certificado_deposito_preexistente", 12, N), | ||
|
@@ -386,18 +386,18 @@ | |
("servicios_otras_percepciones", 10, I, 2), | ||
] | ||
|
||
CTG = [ # para cgAutorizarDeposito (WSLPGv1.6) | ||
('tipo_reg', 1, A), # C: CTG | ||
('nro_ctg', 12, A), | ||
('nro_carta_porte', 13, A), | ||
('porcentaje_secado_humedad', 5, I, 2), | ||
('importe_secado', 10, I, 2), | ||
('peso_neto_merma_secado', 10, I, 2), | ||
('tarifa_secado', 10, I, 2), | ||
('importe_zarandeo', 10, I, 2), | ||
('peso_neto_merma_zarandeo', 10, I, 2), | ||
('tarifa_zarandeo', 10, I, 2), | ||
('peso_neto_confirmado_definitivo', 10, I, 2), | ||
CTG = [ # para cgAutorizarDeposito (WSLPGv1.6) | ||
("tipo_reg", 1, A), # C: CTG | ||
("nro_ctg", 12, A), | ||
("nro_carta_porte", 13, A), | ||
("porcentaje_secado_humedad", 5, I, 2), | ||
("importe_secado", 10, I, 2), | ||
("peso_neto_merma_secado", 10, I, 2), | ||
("tarifa_secado", 10, I, 2), | ||
("importe_zarandeo", 10, I, 2), | ||
("peso_neto_merma_zarandeo", 10, I, 2), | ||
("tarifa_zarandeo", 10, I, 2), | ||
("peso_neto_confirmado_definitivo", 10, I, 2), | ||
] | ||
|
||
DET_MUESTRA_ANALISIS = [ # para cgAutorizarDeposito (WSLPGv1.6) | ||
|
@@ -4593,7 +4593,7 @@ def main(): | |
|
||
if "--lsg" in sys.argv: | ||
print("Anulando COE LSG", coe) | ||
ret = wslpg.AnularLiquidacionSecundaria(coe) | ||
ret = wslpg.AnularLiquidacionSecundaria(pto_emision, nro_orden, coe) | ||
if "--cg" in sys.argv: | ||
print("Anulando COE CG", coe) | ||
ret = wslpg.AnularCertificacion(coe) | ||
|
Oops, something went wrong.