Exception control in return status
This commit is contained in:
@@ -51,12 +51,10 @@ class BtcpayController(http.Controller):
|
|||||||
""" BTCPay IPN. """
|
""" BTCPay IPN. """
|
||||||
cr, uid, context, env = request.cr, SUPERUSER_ID, request.context, request.env
|
cr, uid, context, env = request.cr, SUPERUSER_ID, request.context, request.env
|
||||||
acquirer = request.env['payment.acquirer'].search([('provider', '=', 'btcpay')])
|
acquirer = request.env['payment.acquirer'].search([('provider', '=', 'btcpay')])
|
||||||
|
try:
|
||||||
#_logger.info('REQUEST JSONREQUEST %s',pprint.pformat(request.jsonrequest))
|
#_logger.info('REQUEST JSONREQUEST %s',pprint.pformat(request.jsonrequest))
|
||||||
invoiceId = request.jsonrequest['data']['id']
|
invoiceId = request.jsonrequest['data']['id']
|
||||||
|
|
||||||
client = BTCPayClient(host=acquirer.location, pem=acquirer.privateKey, tokens=acquirer.token)
|
client = BTCPayClient(host=acquirer.location, pem=acquirer.privateKey, tokens=acquirer.token)
|
||||||
|
|
||||||
self.invoice = client.get_invoice(invoiceId)
|
self.invoice = client.get_invoice(invoiceId)
|
||||||
#_logger.info('SELF INVOICE IPN %s',pprint.pformat(self.invoice))
|
#_logger.info('SELF INVOICE IPN %s',pprint.pformat(self.invoice))
|
||||||
|
|
||||||
@@ -78,6 +76,8 @@ class BtcpayController(http.Controller):
|
|||||||
tx.state = 'pending'
|
tx.state = 'pending'
|
||||||
tx.btcpay_invoiceId =self.invoice['id']
|
tx.btcpay_invoiceId =self.invoice['id']
|
||||||
tx.btcpay_txid =((((self.invoice['cryptoInfo'])[0])['payments'])[0])['id']
|
tx.btcpay_txid =((((self.invoice['cryptoInfo'])[0])['payments'])[0])['id']
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@http.route(['/btcpay/checkout'], type='http', auth='none', csrf=None, website=True)
|
@http.route(['/btcpay/checkout'], type='http', auth='none', csrf=None, website=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user