diff --git a/core/apps/orders/urls.py b/core/apps/orders/urls.py index 6c576e8..17ad467 100644 --- a/core/apps/orders/urls.py +++ b/core/apps/orders/urls.py @@ -43,6 +43,7 @@ urlpatterns = [ path('pay/', party_views.PartyPaymentApiView.as_view()), path('statistics/', party_views.PartyStatisticsApiView.as_view()), path('bulk-delete/', party_views.DeleteMultiplePartyApiView.as_view()), + path('/change-confirmation/', party_views.ChangeConfirmationPartyApiView.as_view()), ] )), ] \ No newline at end of file diff --git a/core/apps/orders/views/party.py b/core/apps/orders/views/party.py index b3cbb40..cb4214b 100644 --- a/core/apps/orders/views/party.py +++ b/core/apps/orders/views/party.py @@ -236,4 +236,26 @@ class DeleteMultiplePartyApiView(views.APIView): return Response({"detail": "party_ids kerak"}, status=400) deleted_count, _ = Party.objects.filter(id__in=ids).delete() - return Response({"deleted": deleted_count}, status=200) \ No newline at end of file + return Response({"deleted": deleted_count}, status=200) + + +class ChangeConfirmationPartyApiView(views.APIView): + permission_classes = [HasRolePermission] + + def post(self, request, id): + party = get_object_or_404(Party, id=id) + confirmation = request.data.get('confirmation', None) + if not confirmation: + return Response({ + 'success': False, 'message': 'confirmation field is required' + }, status=400) + party.confirmation = confirmation + party.save() + return Response( + { + 'success': True, + 'message': 'confirmation changed successfully', + }, + status=200 + ) + \ No newline at end of file