summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1/wati.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-02-20 09:52:42 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-02-20 09:52:42 +0700
commit1b53c0081b925e54e056c94b355a9b99320e0ea5 (patch)
tree74a20d5a5efdeb23a779adc340681718f697d7b9 /indoteknik_api/controllers/api_v1/wati.py
parentce3e018ad61808b7e581e416525e6696ed088916 (diff)
parent4a7d62d40a47ae894e2e22171105332ada9516ee (diff)
Merge branch 'midtrans' into staging
Diffstat (limited to 'indoteknik_api/controllers/api_v1/wati.py')
-rw-r--r--indoteknik_api/controllers/api_v1/wati.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/wati.py b/indoteknik_api/controllers/api_v1/wati.py
new file mode 100644
index 00000000..68ff1640
--- /dev/null
+++ b/indoteknik_api/controllers/api_v1/wati.py
@@ -0,0 +1,20 @@
+from .. import controller
+from odoo import http
+from odoo.http import request
+import json
+
+
+class Wati(controller.Controller):
+ prefix = '/api/v1/'
+
+ @http.route(prefix + 'wati/notification', auth='none', type='json', csrf=False, cors='*', methods=['POST', 'OPTIONS'])
+ def notification(self, **kw):
+ json_raw = json.loads(request.httprequest.data)
+ json_dump = json.dumps(json_raw, indent=4, sort_keys=True)
+
+ request.env['wati.notification'].create([{
+ 'json_raw': json_dump,
+ 'is_lead': False
+ }])
+
+ return