mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] website_sale_signifyd: retry when cannot find case_id
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
from odoo.http import Controller, request, route
|
from odoo.http import Controller, request, route
|
||||||
from odoo.http import Response
|
from odoo.exceptions import MissingError
|
||||||
|
|
||||||
|
|
||||||
class SignifydWebhooks(Controller):
|
class SignifydWebhooks(Controller):
|
||||||
@@ -18,11 +18,11 @@ class SignifydWebhooks(Controller):
|
|||||||
case = self._get_case(case_id)
|
case = self._get_case(case_id)
|
||||||
if case:
|
if case:
|
||||||
case.update_case_info(vals)
|
case.update_case_info(vals)
|
||||||
return Response({'response': 'success'}, status=200, mimetype='application/json')
|
return {'response': 'success'}
|
||||||
if case_id == 1:
|
if case_id == 1:
|
||||||
# Special case when verifying webhook.
|
# Special case when verifying webhook.
|
||||||
return Response({'response': 'success'}, status=200, mimetype='application/json')
|
return {'response': 'success'}
|
||||||
return Response({'response': 'failed'}, status=500, mimetype='application/json')
|
raise MissingError('CaseId: %s Cannot be found.' % (case_id, ))
|
||||||
|
|
||||||
def _get_case(self, case_id):
|
def _get_case(self, case_id):
|
||||||
return request.env['signifyd.case'].sudo().search([('case_id', '=', case_id)], limit=1)
|
return request.env['signifyd.case'].sudo().search([('case_id', '=', case_id)], limit=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user