paytechuz 0.2.20__py3-none-any.whl → 0.2.21__py3-none-any.whl
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/integrations/fastapi/routes.py +32 -27
- {paytechuz-0.2.20.dist-info → paytechuz-0.2.21.dist-info}/METADATA +1 -1
- {paytechuz-0.2.20.dist-info → paytechuz-0.2.21.dist-info}/RECORD +5 -5
- {paytechuz-0.2.20.dist-info → paytechuz-0.2.21.dist-info}/WHEEL +0 -0
- {paytechuz-0.2.20.dist-info → paytechuz-0.2.21.dist-info}/top_level.txt +0 -0
|
@@ -989,42 +989,47 @@ class ClickWebhookHandler:
|
|
|
989
989
|
"""
|
|
990
990
|
Check authentication using signature.
|
|
991
991
|
"""
|
|
992
|
-
if
|
|
992
|
+
if not all([self.service_id, self.secret_key]):
|
|
993
993
|
raise HTTPException(
|
|
994
994
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
995
|
-
detail="
|
|
995
|
+
detail="Missing required settings: service_id or secret_key"
|
|
996
996
|
)
|
|
997
997
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
998
|
+
if str(params.get("service_id")) != self.service_id:
|
|
999
|
+
raise HTTPException(
|
|
1000
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
1001
|
+
detail="Invalid service ID"
|
|
1002
|
+
)
|
|
1002
1003
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
1006
|
-
detail="Missing signature parameters"
|
|
1007
|
-
)
|
|
1004
|
+
sign_string = params.get("sign_string")
|
|
1005
|
+
sign_time = params.get("sign_time")
|
|
1008
1006
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
f"{self.secret_key}"
|
|
1014
|
-
f"{params.get('merchant_trans_id')}"
|
|
1015
|
-
f"{params.get('amount')}"
|
|
1016
|
-
f"{params.get('action')}"
|
|
1017
|
-
f"{sign_time}"
|
|
1007
|
+
if not sign_string or not sign_time:
|
|
1008
|
+
raise HTTPException(
|
|
1009
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
1010
|
+
detail="Missing signature parameters"
|
|
1018
1011
|
)
|
|
1019
1012
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1013
|
+
# Prepare signature components
|
|
1014
|
+
text_parts = [
|
|
1015
|
+
str(params.get("click_trans_id") or ""),
|
|
1016
|
+
str(params.get("service_id") or ""),
|
|
1017
|
+
str(self.secret_key or ""),
|
|
1018
|
+
str(params.get("merchant_trans_id") or ""),
|
|
1019
|
+
str(params.get("merchant_prepare_id") or ""),
|
|
1020
|
+
str(params.get("amount") or ""),
|
|
1021
|
+
str(params.get("action") or ""),
|
|
1022
|
+
str(sign_time)
|
|
1023
|
+
]
|
|
1024
|
+
|
|
1025
|
+
# Calculate hash
|
|
1026
|
+
calculated_hash = hashlib.md5("".join(text_parts).encode("utf-8")).hexdigest()
|
|
1022
1027
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
+
if calculated_hash != sign_string:
|
|
1029
|
+
raise HTTPException(
|
|
1030
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
1031
|
+
detail="Invalid signature"
|
|
1032
|
+
)
|
|
1028
1033
|
|
|
1029
1034
|
def _find_account(self, merchant_trans_id: str) -> Any:
|
|
1030
1035
|
"""
|
|
@@ -59,9 +59,9 @@ paytechuz/integrations/django/migrations/0001_initial.py,sha256=SWHIUuwq91crzaxa
|
|
|
59
59
|
paytechuz/integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
|
|
60
60
|
paytechuz/integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2SLG8qxldRuwR4,565
|
|
61
61
|
paytechuz/integrations/fastapi/models.py,sha256=9IqrsndIVuIDwDbijZ89biJxEWQASXRBfWVShxgerAc,5113
|
|
62
|
-
paytechuz/integrations/fastapi/routes.py,sha256=
|
|
62
|
+
paytechuz/integrations/fastapi/routes.py,sha256=t8zbqhMZsaJmEvMDgmF-NoRmbqksfX_AvIrx-3kCjg8,37845
|
|
63
63
|
paytechuz/integrations/fastapi/schemas.py,sha256=PgRqviJiD4-u3_CIkUOX8R7L8Yqn8L44WLte7968G0E,3887
|
|
64
|
-
paytechuz-0.2.
|
|
65
|
-
paytechuz-0.2.
|
|
66
|
-
paytechuz-0.2.
|
|
67
|
-
paytechuz-0.2.
|
|
64
|
+
paytechuz-0.2.21.dist-info/METADATA,sha256=dHA9NdyvhNtzp8F0V7gmF8KC75OauwM_Yyy9cd8PRjw,11464
|
|
65
|
+
paytechuz-0.2.21.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
66
|
+
paytechuz-0.2.21.dist-info/top_level.txt,sha256=v03IobsNVIGSgCareObqCsEwLgXOpwBvBTWy3y8-G_M,37
|
|
67
|
+
paytechuz-0.2.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|