bugfix
This commit is contained in:
parent
7c29da5e78
commit
a8006579bc
4 changed files with 84 additions and 47 deletions
|
|
@ -0,0 +1,30 @@
|
|||
# Generated by Django 5.1.7 on 2025-03-13 10:20
|
||||
|
||||
import oauth2_provider.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gooyal_oauth2', '0005_alter_application_balance'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='accesstoken',
|
||||
name='token_checksum',
|
||||
field=oauth2_provider.models.TokenChecksumField(db_index=True, default=None, max_length=64, unique=True),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='refreshtoken',
|
||||
name='token_family',
|
||||
field=models.UUIDField(blank=True, editable=False, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='accesstoken',
|
||||
name='token',
|
||||
field=models.TextField(),
|
||||
),
|
||||
]
|
||||
|
|
@ -26,14 +26,16 @@ user_urlpatterns = [
|
|||
|
||||
application_urlpatterns = [
|
||||
path('api/application/balance', application_views.BalanceAPIView.as_view(), name='application_wallet_balance_api'),
|
||||
path('api/application/', application_views.TransactionListAPIView.as_view(), name='application_transaction_list_api'),
|
||||
path('api/application/<uuid>/', application_views.TransactionDetailAPIView.as_view(), name='application_transaction_detail'),
|
||||
|
||||
path('api/application/deposit/', application_views.DepositSubmitAPIView.as_view(), name='application_deposit_submit_api'),
|
||||
path('api/application/deposit/<uuid>/verify', application_views.DepositVerifyAPIView.as_view(), name='application_deposit_verify_api'),
|
||||
|
||||
path('api/application/withdraw/', application_views.WithdrawSubmitAPIView.as_view(), name='application_withdraw_submit_api'),
|
||||
path('api/application/withdraw/<uuid>/verify', application_views.WithdrawVerifyAPIView.as_view(), name='application_withdraw_verify_api'),
|
||||
|
||||
path('api/application/', application_views.TransactionListAPIView.as_view(), name='application_transaction_list_api'),
|
||||
path('api/application/<uuid>/', application_views.TransactionDetailAPIView.as_view(), name='application_transaction_detail'),
|
||||
|
||||
]
|
||||
|
||||
urlpatterns = user_urlpatterns + application_urlpatterns
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
from django.db.models import Q
|
||||
from oauth2_provider.contrib.rest_framework import TokenHasScope, IsAuthenticatedOrTokenHasScope
|
||||
from rest_framework import generics, permissions, mixins
|
||||
from rest_framework.exceptions import APIException
|
||||
from rest_framework.response import Response
|
||||
|
||||
from apps.wallet.constans import TypeChoices, StateChoices
|
||||
|
|
@ -59,7 +60,7 @@ class TransactionListAPIView(generics.ListAPIView):
|
|||
# from application to another entity
|
||||
# TODO: better name
|
||||
class DepositSubmitAPIView(generics.CreateAPIView):
|
||||
permission_classes = [TokenHasScope]
|
||||
permission_classes = [IsAuthenticatedOrTokenHasScope]
|
||||
serializer_class = ApplicationDepositSerializer
|
||||
required_scopes = ['wallet.application.deposit:submit']
|
||||
|
||||
|
|
@ -76,11 +77,14 @@ class DepositSubmitAPIView(generics.CreateAPIView):
|
|||
instance = serializer.save(payer_id=application.pk,
|
||||
payer_type=TypeChoices.APPLICATION.value,
|
||||
application=application)
|
||||
instance.submit()
|
||||
try:
|
||||
instance.submit()
|
||||
except:
|
||||
APIException('Failed to submit deposit')
|
||||
|
||||
|
||||
class DepositVerifyAPIView(generics.RetrieveAPIView):
|
||||
permission_classes = [TokenHasScope]
|
||||
permission_classes = [IsAuthenticatedOrTokenHasScope]
|
||||
serializer_class = ApplicationDepositSerializer
|
||||
lookup_field = 'uuid'
|
||||
required_scopes = ['wallet.application.deposit:verify']
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# pip-compile
|
||||
#
|
||||
amqp==5.2.0
|
||||
amqp==5.3.1
|
||||
# via kombu
|
||||
anyio==4.8.0
|
||||
# via httpx
|
||||
|
|
@ -12,26 +12,26 @@ asgiref==3.8.1
|
|||
# via
|
||||
# django
|
||||
# django-cors-headers
|
||||
async-timeout==4.0.3
|
||||
async-timeout==5.0.1
|
||||
# via redis
|
||||
attrs==23.2.0
|
||||
attrs==25.2.0
|
||||
# via
|
||||
# jsonschema
|
||||
# referencing
|
||||
billiard==4.2.0
|
||||
billiard==4.2.1
|
||||
# via celery
|
||||
celery==5.4.0
|
||||
# via -r requirements.in
|
||||
certifi==2024.6.2
|
||||
certifi==2025.1.31
|
||||
# via
|
||||
# httpcore
|
||||
# httpx
|
||||
# requests
|
||||
cffi==1.16.0
|
||||
cffi==1.17.1
|
||||
# via cryptography
|
||||
charset-normalizer==3.3.2
|
||||
charset-normalizer==3.4.1
|
||||
# via requests
|
||||
click==8.1.7
|
||||
click==8.1.8
|
||||
# via
|
||||
# celery
|
||||
# click-didyoumean
|
||||
|
|
@ -43,11 +43,11 @@ click-plugins==1.1.1
|
|||
# via celery
|
||||
click-repl==0.3.0
|
||||
# via celery
|
||||
crispy-bootstrap5==2024.2
|
||||
crispy-bootstrap5==2024.10
|
||||
# via -r requirements.in
|
||||
cryptography==42.0.8
|
||||
cryptography==44.0.2
|
||||
# via jwcrypto
|
||||
django==5.0.6
|
||||
django==5.1.7
|
||||
# via
|
||||
# -r requirements.in
|
||||
# crispy-bootstrap5
|
||||
|
|
@ -62,17 +62,17 @@ django==5.0.6
|
|||
# drf-spectacular
|
||||
django-betterforms==2.0.0
|
||||
# via -r requirements.in
|
||||
django-cors-headers==4.4.0
|
||||
django-cors-headers==4.7.0
|
||||
# via -r requirements.in
|
||||
django-crispy-forms==2.2
|
||||
django-crispy-forms==2.3
|
||||
# via
|
||||
# -r requirements.in
|
||||
# crispy-bootstrap5
|
||||
django-filter==24.2
|
||||
django-filter==25.1
|
||||
# via -r requirements.in
|
||||
django-jalali-date==1.1.3
|
||||
# via -r requirements.in
|
||||
django-oauth-toolkit==2.4.0
|
||||
django-oauth-toolkit==3.0.1
|
||||
# via -r requirements.in
|
||||
django-redis==5.4.0
|
||||
# via -r requirements.in
|
||||
|
|
@ -80,13 +80,13 @@ djangorestframework==3.15.2
|
|||
# via
|
||||
# -r requirements.in
|
||||
# drf-spectacular
|
||||
drf-spectacular==0.27.2
|
||||
drf-spectacular==0.28.0
|
||||
# via -r requirements.in
|
||||
gevent==24.2.1
|
||||
gevent==24.11.1
|
||||
# via -r requirements.in
|
||||
greenlet==3.0.3
|
||||
greenlet==3.1.1
|
||||
# via gevent
|
||||
gunicorn==22.0.0
|
||||
gunicorn==23.0.0
|
||||
# via -r requirements.in
|
||||
h11==0.14.0
|
||||
# via httpcore
|
||||
|
|
@ -94,7 +94,7 @@ httpcore==1.0.7
|
|||
# via httpx
|
||||
httpx==0.28.1
|
||||
# via -r requirements.in
|
||||
idna==3.7
|
||||
idna==3.10
|
||||
# via
|
||||
# anyio
|
||||
# httpx
|
||||
|
|
@ -103,29 +103,29 @@ inflection==0.5.1
|
|||
# via drf-spectacular
|
||||
jalali-core==1.0.0
|
||||
# via jdatetime
|
||||
jdatetime==5.0.0
|
||||
jdatetime==5.2.0
|
||||
# via django-jalali-date
|
||||
jsonschema==4.22.0
|
||||
jsonschema==4.23.0
|
||||
# via drf-spectacular
|
||||
jsonschema-specifications==2023.12.1
|
||||
jsonschema-specifications==2024.10.1
|
||||
# via jsonschema
|
||||
jwcrypto==1.5.6
|
||||
# via django-oauth-toolkit
|
||||
kombu==5.3.7
|
||||
kombu==5.4.2
|
||||
# via celery
|
||||
markdown==3.6
|
||||
markdown==3.7
|
||||
# via -r requirements.in
|
||||
oauthlib==3.2.2
|
||||
# via django-oauth-toolkit
|
||||
packaging==24.1
|
||||
packaging==24.2
|
||||
# via gunicorn
|
||||
pillow==10.3.0
|
||||
pillow==11.1.0
|
||||
# via -r requirements.in
|
||||
prompt-toolkit==3.0.47
|
||||
prompt-toolkit==3.0.50
|
||||
# via click-repl
|
||||
psycopg[binary]==3.1.19
|
||||
psycopg[binary]==3.2.6
|
||||
# via -r requirements.in
|
||||
psycopg-binary==3.1.19
|
||||
psycopg-binary==3.2.6
|
||||
# via psycopg
|
||||
pycparser==2.22
|
||||
# via cffi
|
||||
|
|
@ -133,40 +133,41 @@ python-dateutil==2.9.0.post0
|
|||
# via celery
|
||||
python-decouple==3.8
|
||||
# via -r requirements.in
|
||||
pytz==2024.1
|
||||
# via django-oauth-toolkit
|
||||
pyyaml==6.0.1
|
||||
pyyaml==6.0.2
|
||||
# via drf-spectacular
|
||||
redis==5.0.6
|
||||
redis==5.2.1
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django-redis
|
||||
referencing==0.35.1
|
||||
referencing==0.36.2
|
||||
# via
|
||||
# jsonschema
|
||||
# jsonschema-specifications
|
||||
requests==2.32.3
|
||||
# via django-oauth-toolkit
|
||||
rpds-py==0.18.1
|
||||
rpds-py==0.23.1
|
||||
# via
|
||||
# jsonschema
|
||||
# referencing
|
||||
six==1.16.0
|
||||
six==1.17.0
|
||||
# via python-dateutil
|
||||
sniffio==1.3.1
|
||||
# via anyio
|
||||
sqlparse==0.5.0
|
||||
sqlparse==0.5.3
|
||||
# via django
|
||||
typing-extensions==4.12.2
|
||||
# via
|
||||
# anyio
|
||||
# jwcrypto
|
||||
# psycopg
|
||||
tzdata==2024.1
|
||||
# via celery
|
||||
# referencing
|
||||
tzdata==2025.1
|
||||
# via
|
||||
# celery
|
||||
# kombu
|
||||
uritemplate==4.1.1
|
||||
# via drf-spectacular
|
||||
urllib3==2.2.2
|
||||
urllib3==2.3.0
|
||||
# via requests
|
||||
vine==5.1.0
|
||||
# via
|
||||
|
|
@ -177,7 +178,7 @@ wcwidth==0.2.13
|
|||
# via prompt-toolkit
|
||||
zope-event==5.0
|
||||
# via gevent
|
||||
zope-interface==6.4.post2
|
||||
zope-interface==7.2
|
||||
# via gevent
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue