schon/engine/payments/docs/drf/views.py

42 lines
1.1 KiB
Python

from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import extend_schema
from rest_framework import status
from engine.core.docs.drf import error
from engine.payments.serializers import (
DepositSerializer,
LimitsSerializer,
TransactionProcessSerializer,
)
DEPOSIT_SCHEMA = {
"post": extend_schema(
tags=[
"payments",
],
summary=_("deposit to balance"),
description=_("deposit some money to balance"),
request=DepositSerializer,
responses={
status.HTTP_201_CREATED: TransactionProcessSerializer,
status.HTTP_401_UNAUTHORIZED: error,
status.HTTP_400_BAD_REQUEST: error,
},
),
}
LIMITS_SCHEMA = {
"get": extend_schema(
tags=[
"payments",
],
summary=_("payment limits"),
description=_(
"retrieve minimal and maximal allowed deposit amounts across available gateways"
),
responses={
status.HTTP_200_OK: LimitsSerializer,
status.HTTP_401_UNAUTHORIZED: error,
},
),
}