Skip to content

Commit a895e37

Browse files
committed
Add logs to webhook
1 parent 2626fda commit a895e37

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pretix_pix_openpix/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import logging
23
from http import HTTPStatus
34

45
from django.http import HttpResponse
@@ -7,6 +8,8 @@
78

89
from pretix.base.models import Order, OrderPayment
910

11+
logger = logging.getLogger(__name__)
12+
1013

1114
@csrf_exempt
1215
def webhook(request):
@@ -18,13 +21,16 @@ def webhook(request):
1821
return HttpResponse(status=HTTPStatus.OK)
1922

2023
event = data.get("event") or ""
24+
logger.info("Received event %s", event)
25+
2126
if event == "OPENPIX:CHARGE_COMPLETED":
2227
pix = data.get("pix") or {}
2328
charge = pix.get("charge") or {}
2429

2530
identifier = charge.get("identifier")
2631
value = charge.get("value", 0.0) / 100
2732

33+
logger.info("Processing %s with value %s", identifier, str(value))
2834
with scopes_disabled():
2935
order_payment = OrderPayment.objects.filter(
3036
order__code=identifier,

0 commit comments

Comments
 (0)