paytechuz 0.2.22__py3-none-any.whl → 0.2.24__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/__init__.py CHANGED
@@ -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.19'
9
+ __version__ = '0.2.24'
10
10
 
11
11
  # Import framework integrations - these imports are used to check availability
12
12
  # of frameworks, not for direct usage
@@ -786,30 +786,37 @@ class ClickWebhook(View):
786
786
  """
787
787
  Check authentication using signature.
788
788
  """
789
- if str(params.get('service_id')) != self.service_id:
789
+ # Check if service_id and secret_key are set
790
+ if not self.service_id or not self.secret_key:
791
+ raise PermissionDenied("Missing required settings: service_id or secret_key")
792
+
793
+ if str(params.get("service_id")) != self.service_id:
790
794
  raise PermissionDenied("Invalid service ID")
791
795
 
792
- # Check signature if secret key is provided
793
- if self.secret_key:
794
- sign_string = params.get('sign_string')
795
- sign_time = params.get('sign_time')
796
+ sign_string = params.get("sign_string")
797
+ sign_time = params.get("sign_time")
796
798
 
797
- if not sign_string or not sign_time:
798
- raise PermissionDenied("Missing signature parameters")
799
+ if not sign_string or not sign_time:
800
+ raise PermissionDenied("Missing signature parameters")
799
801
 
800
- # Create string to sign
801
- to_sign = (
802
- f"{params.get('click_trans_id')}{params.get('service_id')}"
803
- )
804
- to_sign += f"{self.secret_key}{params.get('merchant_trans_id')}"
805
- to_sign += f"{params.get('amount')}{params.get('action')}"
806
- to_sign += f"{sign_time}"
802
+ # Prepare signature components; note merchant_prepare_id added compared to your original
803
+ text_parts = [
804
+ str(params.get("click_trans_id") or ""),
805
+ str(params.get("service_id") or ""),
806
+ str(self.secret_key or ""),
807
+ str(params.get("merchant_trans_id") or ""),
808
+ str(params.get("merchant_prepare_id") or ""), # added here
809
+ str(params.get("amount") or ""),
810
+ str(params.get("action") or ""),
811
+ str(sign_time)
812
+ ]
813
+
814
+ # Calculate hash
815
+ calculated_hash = hashlib.md5("".join(text_parts).encode("utf-8")).hexdigest()
807
816
 
808
- # Generate signature
809
- signature = hashlib.md5(to_sign.encode('utf-8')).hexdigest()
817
+ if calculated_hash != sign_string:
818
+ raise PermissionDenied("Invalid signature")
810
819
 
811
- if signature != sign_string:
812
- raise PermissionDenied("Invalid signature")
813
820
 
814
821
  def _find_account(self, merchant_trans_id):
815
822
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paytechuz
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Unified Python package for Uzbekistan payment gateways
5
5
  Home-page: https://github.com/Muhammadali-Akbarov/paytechuz
6
6
  Author: Muhammadali Akbarov
@@ -1,4 +1,4 @@
1
- paytechuz/__init__.py,sha256=d-9AjWthchZAE_ykEjoBZ79o32gzqM1jZkkAQd-jB8s,1754
1
+ paytechuz/__init__.py,sha256=ODKIHhEIrUJ9I-8OQ22jNkG0W8PCHxWi3DBFXFQLqYk,1754
2
2
  paytechuz/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  paytechuz/core/base.py,sha256=Es6eEGNgDjQJe-kEJVAHSAh8AWbgtIuQMm0xn7qfjl4,2549
4
4
  paytechuz/core/constants.py,sha256=P2zeZ_cfZIttdC1vqkpIngkfRFh6loWzJYEgzQb5cKA,1660
@@ -23,14 +23,14 @@ paytechuz/integrations/django/apps.py,sha256=Q9wG2osL7_Ip2BcAkq7lmmhu4UKJAg6UtSs
23
23
  paytechuz/integrations/django/models.py,sha256=x3cVLY812Xts5oNk4VmCzK3zjb0FXQON9WV41PCtxaw,5696
24
24
  paytechuz/integrations/django/signals.py,sha256=VtNYEAnu13wi9PqadEaCU9LY_k2tY26AS4bnPIAqw7M,1319
25
25
  paytechuz/integrations/django/views.py,sha256=TL-LNbwrLvYjoBvGxm_yZjMVLBqelorgKjr4l3sKH1Y,3037
26
- paytechuz/integrations/django/webhooks.py,sha256=6GlLgLEizMjkD7dYR3AoLcLmZnMPwi3IaqB0Kln7dSk,31759
26
+ paytechuz/integrations/django/webhooks.py,sha256=gATM5oxoNKznnCHHYanjwhgdpeoRGIhDGRxVO3SIYYU,32048
27
27
  paytechuz/integrations/django/migrations/0001_initial.py,sha256=SWHIUuwq91crzaxa9v1UK0kay8CxsjUo6t4bqg7j0Gw,1896
28
28
  paytechuz/integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
29
29
  paytechuz/integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2SLG8qxldRuwR4,565
30
30
  paytechuz/integrations/fastapi/models.py,sha256=9IqrsndIVuIDwDbijZ89biJxEWQASXRBfWVShxgerAc,5113
31
31
  paytechuz/integrations/fastapi/routes.py,sha256=t8zbqhMZsaJmEvMDgmF-NoRmbqksfX_AvIrx-3kCjg8,37845
32
32
  paytechuz/integrations/fastapi/schemas.py,sha256=PgRqviJiD4-u3_CIkUOX8R7L8Yqn8L44WLte7968G0E,3887
33
- paytechuz-0.2.22.dist-info/METADATA,sha256=JNeDz3IQeu9uOtMOt48IsarEErU6mMLAv6GWndyBgW4,10084
34
- paytechuz-0.2.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- paytechuz-0.2.22.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
36
- paytechuz-0.2.22.dist-info/RECORD,,
33
+ paytechuz-0.2.24.dist-info/METADATA,sha256=wWTY1mR8E2eE9ChZjydxSYQoITVmPwWpjqV0sCiMH_8,10084
34
+ paytechuz-0.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ paytechuz-0.2.24.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
36
+ paytechuz-0.2.24.dist-info/RECORD,,