fix(wallet): fix bugs

fix bugs
This commit is contained in:
Haydar Ghasemi 2025-10-29 11:04:43 +03:30
parent d508e74c7f
commit a032eb1ccd
2 changed files with 11 additions and 12 deletions

View file

@ -5,6 +5,6 @@ app_name = "core"
urlpatterns = [ urlpatterns = [
path('', HomeView.as_view(), name='home'), path('', HomeView.as_view(), name='home'),
path('charge/<pk>/', ChargeView.as_view(), name='charge'), # path('charge/<pk>/', ChargeView.as_view(), name='charge'),
path('api/charge_create', ChargeRequestApiView.as_view(), name='charge_create_api'), # path('api/charge_create', ChargeRequestApiView.as_view(), name='charge_create_api'),
] ]

View file

@ -76,8 +76,7 @@ class TransactionDetailAPIView(generics.RetrieveAPIView):
serializer_class = TransactionSerializer serializer_class = TransactionSerializer
lookup_field = 'uuid' lookup_field = 'uuid'
filter_backends = (DjangoFilterBackend,) filter_backends = (DjangoFilterBackend,)
filterset_class = AccountFilter permission_classes = [IsAuthenticatedOrTokenHasScope]
permission_classes = [TokenHasScope]
required_scopes = ['wallet.application:get_transaction_detail'] required_scopes = ['wallet.application:get_transaction_detail']
queryset = Transaction.objects.all() queryset = Transaction.objects.all()
@ -86,11 +85,11 @@ class TransactionDetailAPIView(generics.RetrieveAPIView):
application = get_application(self.request) application = get_application(self.request)
return Transaction.objects.filter(Q(application=application) | return Transaction.objects.filter(Q(application=application) |
Q(payer_wallet__owner_uuid=application.pk, Q(payer_account__owner_uuid=application.pk,
payer_wallet__owner_type=TypeChoices.APPLICATION, payer_account__owner_type=TypeChoices.APPLICATION,
) | ) |
Q(payee_wallet__owner_uuid=application.pk, Q(payee_account__owner_uuid=application.pk,
payee_wallet__owner_type=TypeChoices.APPLICATION, payee_account__owner_type=TypeChoices.APPLICATION,
) )
).all() ).all()
@ -109,10 +108,10 @@ class TransactionListAPIView(generics.ListAPIView):
application = get_application(self.request) application = get_application(self.request)
return qs.filter(Q(application=application) | return qs.filter(Q(application=application) |
Q(payer_wallet__owner_uuid=application.pk, Q(payer_account__owner_uuid=application.pk,
payer_wallet__owner_type=TypeChoices.APPLICATION) | payer_account__owner_type=TypeChoices.APPLICATION) |
Q(payee_wallet__owner_uuid=application.pk, Q(payee_account__owner_uuid=application.pk,
payee_wallet__owner_type=TypeChoices.APPLICATION, payee_account__owner_type=TypeChoices.APPLICATION,
) )
).all() ).all()