Merge branch 'main' into storefront-nuxt
This commit is contained in:
commit
5dd055b677
4 changed files with 14 additions and 10 deletions
|
|
@ -12,5 +12,5 @@ payment_router.register(prefix=r"transactions", viewset=TransactionViewSet, base
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(r"", include(payment_router.urls)),
|
path(r"", include(payment_router.urls)),
|
||||||
path(r"deposit/", DepositView.as_view()),
|
path(r"deposit/", DepositView.as_view()),
|
||||||
path(r"<str:uuid>/callback/<str:gateway>/", CallbackAPIView.as_view()),
|
path(r"<str:uuid>/callback/", CallbackAPIView.as_view()),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -72,14 +72,12 @@ class CallbackAPIView(APIView):
|
||||||
|
|
||||||
def post(self, request: Request, *args: list[Any], **kwargs: dict[Any, Any]) -> Response:
|
def post(self, request: Request, *args: list[Any], **kwargs: dict[Any, Any]) -> Response:
|
||||||
try:
|
try:
|
||||||
gateway = kwargs.get("gateway", "")
|
transaction = Transaction.objects.get(uuid=str(kwargs.get("uuid")))
|
||||||
# noinspection PyUnreachableCode
|
if not transaction.gateway:
|
||||||
match gateway:
|
raise UnknownGatewayError()
|
||||||
case "gateway":
|
gateway = transaction.gateway.get_integration_class_object(raise_exc=True)
|
||||||
# Gateway.process_callback(request.data)
|
gateway.process_callback(request.data)
|
||||||
return Response(status=status.HTTP_200_OK)
|
return Response(status=status.HTTP_202_ACCEPTED)
|
||||||
case _:
|
|
||||||
raise UnknownGatewayError(f"Couldn't match '{gateway}' any gateway")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return Response(
|
return Response(
|
||||||
status=status.HTTP_500_INTERNAL_SERVER_ERROR, data={"error": f"{e}; {traceback.format_exc()}"}
|
status=status.HTTP_500_INTERNAL_SERVER_ERROR, data={"error": f"{e}; {traceback.format_exc()}"}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ INITIALIZED = (BASE_DIR / ".initialized").exists()
|
||||||
|
|
||||||
SECRET_KEY = getenv("SECRET_KEY", "SUPER_SECRET_KEY")
|
SECRET_KEY = getenv("SECRET_KEY", "SUPER_SECRET_KEY")
|
||||||
DEBUG = bool(int(getenv("DEBUG", "1")))
|
DEBUG = bool(int(getenv("DEBUG", "1")))
|
||||||
|
DEBUG_DATABASE = bool(int(getenv("DEBUG_DATABASE", "1")))
|
||||||
|
|
||||||
BASE_DOMAIN: str = getenv("EVIBES_BASE_DOMAIN", "localhost")
|
BASE_DOMAIN: str = getenv("EVIBES_BASE_DOMAIN", "localhost")
|
||||||
STOREFRONT_DOMAIN: str = getenv("EVIBES_STOREFRONT_DOMAIN", "localhost")
|
STOREFRONT_DOMAIN: str = getenv("EVIBES_STOREFRONT_DOMAIN", "localhost")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from evibes.settings.base import DEBUG
|
from evibes.settings.base import DEBUG, DEBUG_DATABASE
|
||||||
|
|
||||||
|
|
||||||
class SkipVariableDoesNotExistFilter(logging.Filter):
|
class SkipVariableDoesNotExistFilter(logging.Filter):
|
||||||
|
|
@ -63,6 +63,11 @@ LOGGING = {
|
||||||
"level": "DEBUG" if DEBUG else "INFO",
|
"level": "DEBUG" if DEBUG else "INFO",
|
||||||
"propagate": True,
|
"propagate": True,
|
||||||
},
|
},
|
||||||
|
"django.db": {
|
||||||
|
"handlers": ["console"],
|
||||||
|
"level": "DEBUG" if DEBUG_DATABASE else "WARNING",
|
||||||
|
"propagate": True,
|
||||||
|
},
|
||||||
"django.template": {
|
"django.template": {
|
||||||
"handlers": ["console"],
|
"handlers": ["console"],
|
||||||
"level": "DEBUG" if DEBUG else "ERROR",
|
"level": "DEBUG" if DEBUG else "ERROR",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue