Files
homm/backend/apps/payments/views.py
T
apuc 756f40353b Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF):
- accounts: phone OTP login, JWT, profile, addresses
- catalog: categories, products, images, filters, search, hits/new/related
- orders: creation with Idempotency-Key, stock reservation, status history, cancel
- loyalty: bonus accounts, promo codes, gift certificates
- payments: payment records and YooKassa webhook handling
- content: static pages, banners, site settings
- integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses)
- common: error envelope, pagination, request-id, integration auth, admin dashboard

Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx),
requirements split by environment, OpenAPI contracts for site and 1C, architecture doc.

Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
2026-11-22 21:54:16 +03:00

24 lines
717 B
Python

from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from .serializers import PaymentWebhookSerializer
from .services import handle_yookassa_webhook
class YooKassaWebhookView(APIView):
"""Receives ЮKassa notifications.
TODO: verify the source IP / signature before applying the event.
"""
permission_classes = [AllowAny]
authentication_classes: list = []
serializer_class = PaymentWebhookSerializer
def post(self, request):
payment = handle_yookassa_webhook(request.data)
if payment is None:
return Response({"detail": "ignored"})
return Response({"detail": "ok"})