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 = [
|
||||
path(r"", include(payment_router.urls)),
|
||||
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:
|
||||
try:
|
||||
gateway = kwargs.get("gateway", "")
|
||||
# noinspection PyUnreachableCode
|
||||
match gateway:
|
||||
case "gateway":
|
||||
# Gateway.process_callback(request.data)
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
case _:
|
||||
raise UnknownGatewayError(f"Couldn't match '{gateway}' any gateway")
|
||||
transaction = Transaction.objects.get(uuid=str(kwargs.get("uuid")))
|
||||
if not transaction.gateway:
|
||||
raise UnknownGatewayError()
|
||||
gateway = transaction.gateway.get_integration_class_object(raise_exc=True)
|
||||
gateway.process_callback(request.data)
|
||||
return Response(status=status.HTTP_202_ACCEPTED)
|
||||
except Exception as e:
|
||||
return Response(
|
||||
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")
|
||||
DEBUG = bool(int(getenv("DEBUG", "1")))
|
||||
DEBUG_DATABASE = bool(int(getenv("DEBUG_DATABASE", "1")))
|
||||
|
||||
BASE_DOMAIN: str = getenv("EVIBES_BASE_DOMAIN", "localhost")
|
||||
STOREFRONT_DOMAIN: str = getenv("EVIBES_STOREFRONT_DOMAIN", "localhost")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
from evibes.settings.base import DEBUG
|
||||
from evibes.settings.base import DEBUG, DEBUG_DATABASE
|
||||
|
||||
|
||||
class SkipVariableDoesNotExistFilter(logging.Filter):
|
||||
|
|
@ -63,6 +63,11 @@ LOGGING = {
|
|||
"level": "DEBUG" if DEBUG else "INFO",
|
||||
"propagate": True,
|
||||
},
|
||||
"django.db": {
|
||||
"handlers": ["console"],
|
||||
"level": "DEBUG" if DEBUG_DATABASE else "WARNING",
|
||||
"propagate": True,
|
||||
},
|
||||
"django.template": {
|
||||
"handlers": ["console"],
|
||||
"level": "DEBUG" if DEBUG else "ERROR",
|
||||
|
|
|
|||
Loading…
Reference in a new issue