Skip to content

Commit 810bcf8

Browse files
authored
Merge pull request reingart#130 from tryton-ar/main
WSFEv1: fix issues reingart#124 and reingart#131
2 parents 3062f15 + 9abc619 commit 810bcf8

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

iibb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ def ConsultarContribuyentes(self, fecha_desde, fecha_hasta, cuit_contribuyente):
126126
self.xml.contribuyentes.contribuyente.cuitContribuyente = cuit_contribuyente
127127

128128
xml = self.xml.as_xml()
129-
self.CodigoHash = md5(xml).hexdigest()
129+
self.CodigoHash = md5(xml.encode('utf-8')).hexdigest()
130130
nombre = "DFEServicioConsulta_%s.xml" % self.CodigoHash
131131

132132
# guardo el xml en el archivo a enviar y luego lo re-abro:
133-
with open(os.path.join(tempfile.gettempdir(), nombre), "wb") as archivo:
133+
with open(os.path.join(tempfile.gettempdir(), nombre), "w") as archivo:
134134
archivo.write(xml)
135135

136136
if not self.testing:
@@ -147,6 +147,7 @@ def ConsultarContribuyentes(self, fecha_desde, fecha_hasta, cuit_contribuyente):
147147
self.CodigoError = str(self.xml.codigoError)
148148
self.MensajeError = (
149149
str(self.xml.mensajeError)
150+
.encode("ascii", "replace")
150151
)
151152
if "numeroComprobante" in self.xml:
152153
self.NumeroComprobante = str(self.xml.numeroComprobante)

wsaa.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def create_tra(service=SERVICE, ttl=2400):
112112
def sign_tra_new(tra, cert=CERT, privatekey=PRIVATEKEY, passphrase=""):
113113
"Sign Digital transactions with cryptography versions >= 39 in python 3"
114114
# Leer privatekey y cert
115-
if not privatekey.startswith(b"-----BEGIN RSA PRIVATE KEY-----"):
115+
if not privatekey.startswith((
116+
b"-----BEGIN RSA PRIVATE KEY-----",
117+
b"-----BEGIN PRIVATE KEY-----",
118+
b"-----BEGIN ENCRYPTED PRIVATE KEY-----")):
116119
privatekey = open(privatekey).read()
117120
if isinstance(privatekey, str):
118121
privatekey = privatekey.encode("utf-8")
@@ -155,7 +158,10 @@ def sign_tra_old(tra, cert=CERT, privatekey=PRIVATEKEY, passphrase=""):
155158
"Legacy method for signing python 2.7 digital transactions on python 2.7"
156159

157160
# Leer privatekey y cert
158-
if not privatekey.startswith(b"-----BEGIN RSA PRIVATE KEY-----"):
161+
if not privatekey.startswith((
162+
b"-----BEGIN RSA PRIVATE KEY-----",
163+
b"-----BEGIN PRIVATE KEY-----",
164+
b"-----BEGIN ENCRYPTED PRIVATE KEY-----")):
159165
privatekey = open(privatekey).read()
160166
if isinstance(privatekey, str):
161167
privatekey = privatekey.encode("utf-8")

wsfev1.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ def CAESolicitarX(self):
814814
"FchVtoPago": f.get("fecha_venc_pago"),
815815
"MonId": f["moneda_id"],
816816
"MonCotiz": f["moneda_ctz"],
817+
"CanMisMonExt": f.get("cancela_misma_moneda_ext"),
818+
"CondicionIVAReceptorId": f.get("condicion_iva_receptor_id"),
817819
"PeriodoAsoc": {
818820
"FchDesde": f["periodo_cbtes_asoc"].get("fecha_desde"),
819821
"FchHasta": f["periodo_cbtes_asoc"].get("fecha_hasta"),
@@ -1043,6 +1045,8 @@ def CAEARegInformativo(self):
10431045
"FchVtoPago": f.get("fecha_venc_pago"),
10441046
"MonId": f["moneda_id"],
10451047
"MonCotiz": f["moneda_ctz"],
1048+
"CanMisMonExt": f.get("cancela_misma_moneda_ext"),
1049+
"CondicionIVAReceptorId": f.get("condicion_iva_receptor_id"),
10461050
"PeriodoAsoc": {
10471051
"FchDesde": f["periodo_cbtes_asoc"].get("fecha_desde"),
10481052
"FchHasta": f["periodo_cbtes_asoc"].get("fecha_hasta"),

0 commit comments

Comments
 (0)