from django.utils.translation import gettext_lazy as _ from rest_framework import status from rest_framework.exceptions import APIException class TokenBlackListedException(APIException): """ exception for blocked access tokens """ status_code = status.HTTP_401_UNAUTHORIZED default_detail = _('unauthorized') default_code = 'unauthorized' class BankAccountExistException(APIException): status_code = status.HTTP_403_FORBIDDEN default_detail = "اطلاعات بانکی وارد شده از قبل ثبت شده است" # noqa default_code = "اطلاعات بانکی وارد شده از قبل ثبت شده است" # noqa class BankAccountCardException(APIException): status_code = status.HTTP_403_FORBIDDEN default_detail = "شماره کارت از قبل ثبت شده است" # noqa default_code = "شماره کارت از قبل ثبت شده است" # noqa class BankAccountShebaException(APIException): status_code = status.HTTP_403_FORBIDDEN default_detail = "شماره شبا از قبل ثبت شده است" # noqa default_code = "شماره شبا از قبل ثبت شده است" # noqa class BankAccountNumberAccountException(APIException): status_code = status.HTTP_403_FORBIDDEN default_detail = "شماره حساب از قبل ثبت شده است" # noqa default_code = "شماره حساب از قبل ثبت شده است" # noqa class OrganizationBankAccountException(APIException): """ if organization does not have bank account """ status_code = status.HTTP_403_FORBIDDEN default_detail = "برای این سازمان حساب بانکی تعریف نشده است, ابتدا حساب بانکی تعریف کنید" # noqa default_code = "برای این سازمان حساب بانکی تعریف نشده است" # noqa class OrganizationNationalUniqueIDException(APIException): """ if organization unique id exist """ status_code = status.HTTP_403_FORBIDDEN default_detail = _('این شناسه ملی قبلا ثبت شده است') # noqa default_code = 'organization_unique_id_exist' class OrganizationTypeRepeatableException(APIException): """ if organization type is repeatable """ status_code = status.HTTP_403_FORBIDDEN default_detail = _('این نوع سازمان قابلیت تکرار ندارد و از قبل وجود دارد') # noqa default_code = 'organization_type_repeatable' class UserExistException(APIException): """ if user exist """ status_code = status.HTTP_403_FORBIDDEN default_detail = _('کاربری با این شماره موبایل یا با این نام کاربری از قبل وجود دارد') # noqa default_code = 'user_does_not_exist' class AdminDeleteException(APIException): """ admin user can not be deleted """ status_code = status.HTTP_403_FORBIDDEN default_detail = _('این کاربر ادمین است و قابلیت حذف ندارد') # noqa default_code = 'user_does_not_exist'