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