2025-06-02 12:18:13 +03:30
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
from rest_framework import status
|
2025-10-27 11:21:29 +03:30
|
|
|
from rest_framework.exceptions import APIException
|
2025-06-02 12:18:13 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
class TokenBlackListedException(APIException):
|
2025-06-02 15:26:49 +03:30
|
|
|
""" exception for blocked access tokens """
|
|
|
|
|
|
2025-06-02 12:18:13 +03:30
|
|
|
status_code = status.HTTP_401_UNAUTHORIZED
|
|
|
|
|
default_detail = _('unauthorized')
|
|
|
|
|
default_code = 'unauthorized'
|
2025-08-26 12:18:10 +03:30
|
|
|
|
|
|
|
|
|
2025-11-05 12:47:13 +03:30
|
|
|
class BankAccountExistException(APIException):
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = "اطلاعات بانکی وارد شده از قبل ثبت شده است" # noqa
|
|
|
|
|
default_code = "اطلاعات بانکی وارد شده از قبل ثبت شده است" # noqa
|
|
|
|
|
|
|
|
|
|
|
2025-08-26 12:18:10 +03:30
|
|
|
class OrganizationBankAccountException(APIException):
|
|
|
|
|
""" if organization does not have bank account """
|
|
|
|
|
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = "برای این سازمان حساب بانکی تعریف نشده است, ابتدا حساب بانکی تعریف کنید" # noqa
|
|
|
|
|
default_code = "برای این سازمان حساب بانکی تعریف نشده است" # noqa
|
2025-10-27 11:21:29 +03:30
|
|
|
|
|
|
|
|
|
2025-10-28 14:37:59 +03:30
|
|
|
class OrganizationNationalUniqueIDException(APIException):
|
|
|
|
|
""" if organization unique id exist """
|
|
|
|
|
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = _('این شناسه ملی قبلا ثبت شده است') # noqa
|
|
|
|
|
default_code = 'organization_unique_id_exist'
|
|
|
|
|
|
|
|
|
|
|
2025-10-29 10:33:14 +03:30
|
|
|
class OrganizationTypeRepeatableException(APIException):
|
|
|
|
|
""" if organization type is repeatable """
|
|
|
|
|
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = _('این نوع سازمان قابلیت تکرار ندارد و از قبل وجود دارد') # noqa
|
|
|
|
|
default_code = 'organization_type_repeatable'
|
|
|
|
|
|
|
|
|
|
|
2025-10-27 11:21:29 +03:30
|
|
|
class UserExistException(APIException):
|
|
|
|
|
""" if user exist """
|
|
|
|
|
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = _('کاربری با این شماره موبایل یا با این نام کاربری از قبل وجود دارد') # noqa
|
|
|
|
|
default_code = 'user_does_not_exist'
|
2025-10-27 15:53:47 +03:30
|
|
|
|
2025-10-28 14:37:59 +03:30
|
|
|
|
2025-10-27 15:53:47 +03:30
|
|
|
class AdminDeleteException(APIException):
|
|
|
|
|
""" admin user can not be deleted """
|
|
|
|
|
|
|
|
|
|
status_code = status.HTTP_403_FORBIDDEN
|
|
|
|
|
default_detail = _('این کاربر ادمین است و قابلیت حذف ندارد') # noqa
|
|
|
|
|
default_code = 'user_does_not_exist'
|