-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
009711b
commit 0d34532
Showing
3 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
from django.urls import path | ||
|
||
from .views import ( | ||
BookingsByOrderIdAPIView, | ||
PaymentListView, | ||
PaymentProcessingView, | ||
PaymentStatusView, | ||
send_purchase_email_view, | ||
yookassa_webhook, | ||
BookingsByOrderIdAPIView | ||
) | ||
|
||
urlpatterns = [ | ||
path("yookassa-webhook/", yookassa_webhook, name="yookassa-webhook"), | ||
path("create/", PaymentProcessingView.as_view()), | ||
path("check/<str:payment_id>/", PaymentStatusView.as_view(), name="payment-status"), | ||
path("order/<str:payment_id>/bookings/", BookingsByOrderIdAPIView.as_view(), name="bookings-by-order"), | ||
path("test-mail/", send_purchase_email_view), | ||
path( | ||
"order/<str:payment_id>/bookings/", | ||
BookingsByOrderIdAPIView.as_view(), | ||
name="bookings-by-order", | ||
), | ||
path("", PaymentListView.as_view(), name="payment-list"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,24 @@ | |
from django.http import JsonResponse | ||
from django.views.decorators.csrf import csrf_exempt | ||
from rest_framework import generics, status | ||
from rest_framework.decorators import api_view | ||
from rest_framework.response import Response | ||
from rest_framework.views import APIView | ||
|
||
from .models import Order | ||
from .serializers import PaymentProcessingSerializer, PaymentStatusSerializer | ||
from .serializers import ( | ||
PaymentListOutputSerializer, | ||
PaymentProcessingSerializer, | ||
PaymentStatusSerializer, | ||
) | ||
from .services import YooKassaService | ||
|
||
|
||
@api_view(["POST"]) | ||
def send_purchase_email_view(request): | ||
email = "[email protected]" | ||
order_id = "2dff10a2-000f-5000-8000-1dd9e1fd9832" | ||
send_purchase_email(email, order_id) | ||
return Response({"status": "Email is being sent."}) | ||
class PaymentListView(generics.ListAPIView): | ||
serializer_class = PaymentListOutputSerializer | ||
queryset = Order.objects.all() | ||
|
||
def get(self, request, *args, **kwargs): | ||
return self.list(request, *args, **kwargs) | ||
|
||
|
||
class PaymentStatusView(generics.RetrieveAPIView): | ||
|