paytechuz 0.2.16__tar.gz → 0.2.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of paytechuz might be problematic. Click here for more details.
- {paytechuz-0.2.16 → paytechuz-0.2.18}/PKG-INFO +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/main.py +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/pyproject.toml +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/setup.py +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/fastapi/routes.py +35 -25
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/__init__.py +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz.egg-info/PKG-INFO +1 -1
- {paytechuz-0.2.16 → paytechuz-0.2.18}/MANIFEST.in +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/README.md +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/app/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/app/database.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/app/models.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/app/typing.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/app/webhook_handlers.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/payments.db +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/examples/paytechuz_fastapi/run.sh +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/setup.cfg +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/base.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/constants.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/exceptions.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/http.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/payme/errors.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/core/utils.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/click/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/click/client.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/click/merchant.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/click/webhook.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/payme/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/payme/cards.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/payme/client.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/payme/receipts.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/gateways/payme/webhook.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/admin.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/apps.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/migrations/0001_initial.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/migrations/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/models.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/signals.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/views.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/django/webhooks.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/fastapi/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/fastapi/models.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/integrations/fastapi/schemas.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/base.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/constants.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/exceptions.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/http.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/payme/errors.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/core/utils.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/click/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/click/client.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/click/merchant.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/click/webhook.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/payme/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/payme/cards.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/payme/client.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/payme/receipts.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/gateways/payme/webhook.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/admin.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/apps.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/migrations/0001_initial.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/migrations/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/models.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/signals.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/views.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/webhooks.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/fastapi/__init__.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/fastapi/models.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/fastapi/routes.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/fastapi/schemas.py +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz.egg-info/SOURCES.txt +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz.egg-info/dependency_links.txt +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz.egg-info/top_level.txt +0 -0
- {paytechuz-0.2.16 → paytechuz-0.2.18}/tests/test_click_gateway.py +0 -0
|
@@ -91,12 +91,12 @@ async def payme_webhook(request: Request, db: Session = Depends(get_db)):
|
|
|
91
91
|
)
|
|
92
92
|
return await handler.handle_webhook(request)
|
|
93
93
|
|
|
94
|
+
|
|
94
95
|
@app.post("/payments/click/webhook")
|
|
95
96
|
async def click_webhook(request: Request, db: Session = Depends(get_db)):
|
|
96
97
|
handler = CustomClickWebhookHandler(
|
|
97
98
|
db=db,
|
|
98
99
|
service_id="your_service_id",
|
|
99
|
-
merchant_id="your_merchant_id",
|
|
100
100
|
secret_key="your_secret_key",
|
|
101
101
|
account_model=Order
|
|
102
102
|
)
|
|
@@ -7,11 +7,10 @@ import json
|
|
|
7
7
|
import logging
|
|
8
8
|
from datetime import datetime
|
|
9
9
|
from decimal import Decimal
|
|
10
|
-
from typing import Dict, Any, Optional
|
|
10
|
+
from typing import Dict, Any, Optional
|
|
11
11
|
|
|
12
12
|
from fastapi import (
|
|
13
13
|
APIRouter,
|
|
14
|
-
Depends,
|
|
15
14
|
HTTPException,
|
|
16
15
|
Request,
|
|
17
16
|
Response,
|
|
@@ -919,37 +918,48 @@ class ClickWebhookHandler:
|
|
|
919
918
|
"""
|
|
920
919
|
Check authentication using signature.
|
|
921
920
|
"""
|
|
922
|
-
if
|
|
921
|
+
if not all([self.service_id, self.secret_key]):
|
|
923
922
|
raise HTTPException(
|
|
924
923
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
925
|
-
detail="
|
|
924
|
+
detail="Missing required settings: service_id or secret_key"
|
|
926
925
|
)
|
|
927
926
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
927
|
+
if str(params.get("service_id")) != self.service_id:
|
|
928
|
+
raise HTTPException(
|
|
929
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
930
|
+
detail="Invalid service ID"
|
|
931
|
+
)
|
|
932
932
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
936
|
-
detail="Missing signature parameters"
|
|
937
|
-
)
|
|
933
|
+
sign_string = params.get("sign_string")
|
|
934
|
+
sign_time = params.get("sign_time")
|
|
938
935
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
936
|
+
if not sign_string or not sign_time:
|
|
937
|
+
raise HTTPException(
|
|
938
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
939
|
+
detail="Missing signature parameters"
|
|
940
|
+
)
|
|
944
941
|
|
|
945
|
-
|
|
946
|
-
|
|
942
|
+
# Prepare signature components
|
|
943
|
+
text_parts = [
|
|
944
|
+
str(params.get("click_trans_id") or ""),
|
|
945
|
+
str(params.get("service_id") or ""),
|
|
946
|
+
str(self.secret_key or ""),
|
|
947
|
+
str(params.get("merchant_trans_id") or ""),
|
|
948
|
+
str(params.get("merchant_prepare_id") or ""),
|
|
949
|
+
str(params.get("amount") or ""),
|
|
950
|
+
str(params.get("action") or ""),
|
|
951
|
+
str(sign_time)
|
|
952
|
+
]
|
|
953
|
+
|
|
954
|
+
# Calculate hash
|
|
955
|
+
calculated_hash = hashlib.md5("".join(text_parts).encode("utf-8")).hexdigest()
|
|
956
|
+
|
|
957
|
+
if calculated_hash != sign_string:
|
|
958
|
+
raise HTTPException(
|
|
959
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
960
|
+
detail="Invalid signature"
|
|
961
|
+
)
|
|
947
962
|
|
|
948
|
-
if signature != sign_string:
|
|
949
|
-
raise HTTPException(
|
|
950
|
-
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
951
|
-
detail="Invalid signature"
|
|
952
|
-
)
|
|
953
963
|
|
|
954
964
|
def _find_account(self, merchant_trans_id: str) -> Any:
|
|
955
965
|
"""
|
|
@@ -6,7 +6,7 @@ payment systems in Uzbekistan. It supports Django, Flask, and FastAPI.
|
|
|
6
6
|
"""
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
-
__version__ = '0.2.
|
|
9
|
+
__version__ = '0.2.17'
|
|
10
10
|
|
|
11
11
|
# Import framework integrations - these imports are used to check availability
|
|
12
12
|
# of frameworks, not for direct usage
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/migrations/0001_initial.py
RENAMED
|
File without changes
|
{paytechuz-0.2.16 → paytechuz-0.2.18}/src/paytechuz/integrations/django/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|