-
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
8097e81
commit cf6fd3f
Showing
5 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .views import * |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from rest_framework import serializers | ||
from apps.payments.models import Payment | ||
|
||
|
||
class PaymentDeleteSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Payment | ||
fields = ( | ||
"id", | ||
"amount", | ||
"currency", | ||
"payment_type", | ||
"payment_method", | ||
"date", | ||
"description", | ||
"created_by", | ||
"approved_by", | ||
"reference_number", | ||
"status", | ||
) | ||
|
||
|
||
__all__ = ("PaymentDeleteSerializer",) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from rest_framework.generics import DestroyAPIView | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
from apps.payments.api.PaymentDelete.serializers import PaymentDeleteSerializer | ||
from apps.payments.models import Payment | ||
|
||
|
||
class PaymentDeleteAPIView(DestroyAPIView): | ||
serializer_class = PaymentDeleteSerializer | ||
permission_classes = (IsAuthenticated,) | ||
queryset = Payment.objects.all() | ||
|
||
|
||
__all__ = ("PaymentDeleteAPIView",) |
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 +1,2 @@ | ||
from .PaymentCreate import * | ||
from .PaymentDelete import * |
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,7 +1,9 @@ | ||
from django.urls import path | ||
|
||
from apps.payments.api.PaymentCreate.views import PaymentCreateAPIView | ||
from apps.payments.api.PaymentDelete.views import PaymentDeleteAPIView | ||
|
||
urlpatterns = [ | ||
path("create/", PaymentCreateAPIView.as_view(), name="payment-create"), | ||
path("delete/<int:pk>/", PaymentDeleteAPIView.as_view(), name="payment-delete"), | ||
] |