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 = [
path('', HomeView.as_view(), name='home'),
path('charge/<pk>/', ChargeView.as_view(), name='charge'),
path('api/charge_create', ChargeRequestApiView.as_view(), name='charge_create_api'),
# path('charge/<pk>/', ChargeView.as_view(), name='charge'),
# path('api/charge_create', ChargeRequestApiView.as_view(), name='charge_create_api'),
]

View file

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