Fix get folios
This commit is contained in:
parent
49d5838822
commit
94f5df0723
|
@ -15,7 +15,7 @@ psycopg2-binary
|
||||||
cryptography
|
cryptography
|
||||||
xmlsec
|
xmlsec
|
||||||
|
|
||||||
# escpos
|
# python-escpos
|
||||||
# pyusb
|
# pyusb
|
||||||
# pyserial
|
# pyserial
|
||||||
# qrcode
|
# qrcode
|
||||||
|
|
|
@ -327,7 +327,7 @@ class PACComercioDigital(object):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def client_balance(self, data):
|
def client_balance(self, data, rfc=''):
|
||||||
url = self.URL['saldo']
|
url = self.URL['saldo']
|
||||||
host = url.split('/')[2]
|
host = url.split('/')[2]
|
||||||
headers = {
|
headers = {
|
||||||
|
|
|
@ -412,15 +412,12 @@ class PACFinkok(object):
|
||||||
Se pueden usar las credenciales de relleser o las credenciales del emisor
|
Se pueden usar las credenciales de relleser o las credenciales del emisor
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
rfc (str): El RFC del emisor
|
|
||||||
|
|
||||||
Kwargs:
|
|
||||||
auth (dict): Credenciales del emisor
|
auth (dict): Credenciales del emisor
|
||||||
|
rfc (str): El RFC del emisor
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int Cantidad de timbres restantes
|
int Cantidad de timbres restantes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not auth:
|
if not auth:
|
||||||
auth = AUTH['RESELLER']
|
auth = AUTH['RESELLER']
|
||||||
|
|
||||||
|
@ -432,8 +429,8 @@ class PACFinkok(object):
|
||||||
'reseller_password': auth['pass'],
|
'reseller_password': auth['pass'],
|
||||||
'taxpayer_id': rfc,
|
'taxpayer_id': rfc,
|
||||||
}
|
}
|
||||||
|
|
||||||
result = self._get_result(client, 'get', args)
|
result = self._get_result(client, 'get', args)
|
||||||
|
|
||||||
if self.error:
|
if self.error:
|
||||||
log.error(self.error)
|
log.error(self.error)
|
||||||
return ''
|
return ''
|
||||||
|
@ -441,6 +438,7 @@ class PACFinkok(object):
|
||||||
success = bool(result.users)
|
success = bool(result.users)
|
||||||
if not success:
|
if not success:
|
||||||
self._error = result.message or 'RFC no existe'
|
self._error = result.message or 'RFC no existe'
|
||||||
|
log.error(self.error)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return result.users.ResellerUser[0].credit
|
return result.users.ResellerUser[0].credit
|
||||||
|
|
|
@ -612,12 +612,12 @@ def xml_cancel(xml, auth, cert, name):
|
||||||
return data, result
|
return data, result
|
||||||
|
|
||||||
|
|
||||||
def get_client_balance(auth):
|
def get_client_balance(auth, rfc=''):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
return '-d'
|
return '-d'
|
||||||
|
|
||||||
pac = PACS[auth['pac']]()
|
pac = PACS[auth['pac']]()
|
||||||
balance = pac.client_balance(auth)
|
balance = pac.client_balance(auth, rfc)
|
||||||
if pac.error:
|
if pac.error:
|
||||||
balance = 'p/e'
|
balance = 'p/e'
|
||||||
|
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ class Emisor(BaseModel):
|
||||||
return 's/e'
|
return 's/e'
|
||||||
|
|
||||||
auth = Configuracion.get_({'fields': 'pac_auth'})
|
auth = Configuracion.get_({'fields': 'pac_auth'})
|
||||||
result = utils.get_client_balance(auth)
|
result = utils.get_client_balance(auth, obj.rfc)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue