Skip to content

Commit

Permalink
fix code python 3 and add new field id [Ref #5]
Browse files Browse the repository at this point in the history
  • Loading branch information
pisaacode committed Jan 26, 2021
1 parent 6686def commit 98166dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions webpay/normal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def webpay_normal_model(get_normal_transaction):
webpaymodel.commerceCode = get_normal_transaction.detailOutput[0]['commerceCode']
try:
webpaymodel.cardNumber = get_normal_transaction.cardDetail['cardNumber']
except Exception, e:
except Exception as e:
logger.debug("Webpay Normal. Ocurrio un error en cardDetail, buy_order {}, e {}".format(
get_normal_transaction['buyOrder'], e))
webpaymodel.send_signals()
Expand Down Expand Up @@ -61,7 +61,7 @@ def webpay_normal_verificacion(request):
webpaymodel.responseCode))
# Obtenemos la redirecion correcta
urlRedirection = get_normal_transaction['urlRedirection']
except Exception, e:
except Exception as e:
logger.error('Ocurrio un error al consultar Token enviado por Transbank {}. Error {} Traza {}'.format(
token, e, traceback.format_exc()))
# Haremos un response del Token que nos envia Transbank y haremos un
Expand Down
5 changes: 3 additions & 2 deletions webpay/oneclick/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class WebpayOneClickInscription(models.Model):
"""
Modelo para guardar informacion de OneClick
"""
id = models.IntegerField('id')
user = models.CharField(
'Username del usuario del comercio', max_length=100, primary_key=True)
token = models.CharField(
Expand All @@ -26,7 +27,7 @@ class WebpayOneClickInscription(models.Model):
card_number = models.CharField(
'Últimos 4 números de la tarjeta', max_length=4, blank=True)
inscrito = models.BooleanField('Esta inscrito correctamente', default=False)
date_inscription = models.DateTimeField(auto_now=True)
date_inscription = models.DateTimeField(auto_now_add=True)
date_uninscription = models.DateTimeField(null=True, default=None)
custom = models.CharField(max_length=250, blank=True)

Expand Down Expand Up @@ -56,7 +57,7 @@ class WebpayOneClickPayment(models.Model):
"""
Modelo para guardar informacion de los pagos autorizados mediante OneClick.
"""
inscription = models.ForeignKey(WebpayOneClickInscription, blank=False, null=False)
inscription = models.ForeignKey(WebpayOneClickInscription, blank=False, null=False, on_delete=models.CASCADE)
buy_order = models.CharField(
'Orden Compra de la tienda', max_length=42, unique=True)
amount = models.PositiveIntegerField('Monto transacción', default=0)
Expand Down
2 changes: 1 addition & 1 deletion webpay/oneclick/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def webpay_oneclick_finish(request):
logger.debug('Webpay OneClick. Token {} Respuesta {}'.format(
token, get_finish_inscription))
webpay_oneclick_model(token, get_finish_inscription)
except Exception, e:
except Exception as e:
logger.error('Webpay OneClick. Ocurrion un error al consultar Token enviado por Transbank {}. Error {} Traza {}'.format(
token, e, traceback.format_exc()))

Expand Down

0 comments on commit 98166dd

Please sign in to comment.