paytechuz 0.2.5__tar.gz → 0.2.7__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.

Files changed (74) hide show
  1. {paytechuz-0.2.5/src/paytechuz.egg-info → paytechuz-0.2.7}/PKG-INFO +1 -1
  2. {paytechuz-0.2.5 → paytechuz-0.2.7}/pyproject.toml +1 -1
  3. {paytechuz-0.2.5 → paytechuz-0.2.7}/setup.py +1 -1
  4. {paytechuz-0.2.5/src/paytechuz → paytechuz-0.2.7/src}/gateways/click/merchant.py +9 -9
  5. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/payme/client.py +1 -1
  6. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/views.py +2 -0
  7. {paytechuz-0.2.5/src/paytechuz → paytechuz-0.2.7/src}/integrations/django/webhooks.py +4 -0
  8. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/base.py +2 -2
  9. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/click/client.py +6 -6
  10. {paytechuz-0.2.5/src → paytechuz-0.2.7/src/paytechuz}/gateways/click/merchant.py +9 -8
  11. {paytechuz-0.2.5 → paytechuz-0.2.7/src/paytechuz.egg-info}/PKG-INFO +1 -1
  12. {paytechuz-0.2.5 → paytechuz-0.2.7}/MANIFEST.in +0 -0
  13. {paytechuz-0.2.5 → paytechuz-0.2.7}/README.md +0 -0
  14. {paytechuz-0.2.5 → paytechuz-0.2.7}/setup.cfg +0 -0
  15. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/__init__.py +0 -0
  16. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/__init__.py +0 -0
  17. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/base.py +0 -0
  18. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/constants.py +0 -0
  19. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/exceptions.py +0 -0
  20. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/http.py +0 -0
  21. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/payme/errors.py +0 -0
  22. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/core/utils.py +0 -0
  23. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/__init__.py +0 -0
  24. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/click/__init__.py +0 -0
  25. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/click/client.py +0 -0
  26. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/click/webhook.py +0 -0
  27. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/payme/__init__.py +0 -0
  28. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/payme/cards.py +0 -0
  29. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/payme/receipts.py +0 -0
  30. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/gateways/payme/webhook.py +0 -0
  31. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/__init__.py +0 -0
  32. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/__init__.py +0 -0
  33. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/admin.py +0 -0
  34. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/apps.py +0 -0
  35. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/migrations/0001_initial.py +0 -0
  36. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/migrations/__init__.py +0 -0
  37. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/models.py +0 -0
  38. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/django/signals.py +0 -0
  39. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/fastapi/__init__.py +0 -0
  40. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/fastapi/models.py +0 -0
  41. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/fastapi/routes.py +0 -0
  42. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/integrations/fastapi/schemas.py +0 -0
  43. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/__init__.py +0 -0
  44. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/__init__.py +0 -0
  45. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/constants.py +0 -0
  46. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/exceptions.py +0 -0
  47. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/http.py +0 -0
  48. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/payme/errors.py +0 -0
  49. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/core/utils.py +0 -0
  50. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/__init__.py +0 -0
  51. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/click/__init__.py +0 -0
  52. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/click/webhook.py +0 -0
  53. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/payme/__init__.py +0 -0
  54. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/payme/cards.py +0 -0
  55. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/payme/client.py +0 -0
  56. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/payme/receipts.py +0 -0
  57. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/gateways/payme/webhook.py +0 -0
  58. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/__init__.py +0 -0
  59. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/__init__.py +0 -0
  60. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/admin.py +0 -0
  61. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/apps.py +0 -0
  62. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/migrations/0001_initial.py +0 -0
  63. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/migrations/__init__.py +0 -0
  64. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/models.py +0 -0
  65. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/signals.py +0 -0
  66. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/django/views.py +0 -0
  67. {paytechuz-0.2.5/src → paytechuz-0.2.7/src/paytechuz}/integrations/django/webhooks.py +0 -0
  68. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/fastapi/__init__.py +0 -0
  69. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/fastapi/models.py +0 -0
  70. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/fastapi/routes.py +0 -0
  71. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz/integrations/fastapi/schemas.py +0 -0
  72. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz.egg-info/SOURCES.txt +0 -0
  73. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz.egg-info/dependency_links.txt +0 -0
  74. {paytechuz-0.2.5 → paytechuz-0.2.7}/src/paytechuz.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paytechuz
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "paytechuz"
7
- version = "0.2.5"
7
+ version = "0.2.7"
8
8
  description = "Unified Python package for Uzbekistan payment gateways"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -8,7 +8,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
8
8
 
9
9
  setup(
10
10
  name='paytechuz',
11
- version='0.2.5',
11
+ version='0.2.7',
12
12
  license='MIT',
13
13
  author="Muhammadali Akbarov",
14
14
  author_email='muhammadali17abc@gmail.com',
@@ -70,7 +70,7 @@ class ClickMerchantApi:
70
70
  return hashlib.md5(sign_string.encode('utf-8')).hexdigest()
71
71
 
72
72
  @handle_exceptions
73
- def check_payment(self, account_id: Union[int, str]) -> Dict[str, Any]:
73
+ def check_payment(self, id: Union[int, str]) -> Dict[str, Any]:
74
74
  """
75
75
  Check payment status.
76
76
 
@@ -83,7 +83,7 @@ class ClickMerchantApi:
83
83
  # Prepare request data
84
84
  data = {
85
85
  "service_id": self.service_id,
86
- "merchant_transaction_id": str(account_id),
86
+ "merchant_transaction_id": str(id),
87
87
  "request_id": str(generate_timestamp())
88
88
  }
89
89
 
@@ -102,14 +102,14 @@ class ClickMerchantApi:
102
102
  @handle_exceptions
103
103
  def cancel_payment(
104
104
  self,
105
- account_id: Union[int, str],
105
+ id: Union[int, str],
106
106
  reason: Optional[str] = None
107
107
  ) -> Dict[str, Any]:
108
108
  """
109
109
  Cancel payment.
110
110
 
111
111
  Args:
112
- account_id: Account ID or order ID
112
+ id: Account ID or order ID
113
113
  reason: Optional reason for cancellation
114
114
 
115
115
  Returns:
@@ -118,7 +118,7 @@ class ClickMerchantApi:
118
118
  # Prepare request data
119
119
  data = {
120
120
  "service_id": self.service_id,
121
- "merchant_transaction_id": str(account_id),
121
+ "merchant_transaction_id": str(id),
122
122
  "request_id": str(generate_timestamp())
123
123
  }
124
124
 
@@ -141,8 +141,8 @@ class ClickMerchantApi:
141
141
  @handle_exceptions
142
142
  def create_invoice(
143
143
  self,
144
+ id: Union[int, str],
144
145
  amount: Union[int, float],
145
- account_id: Union[int, str],
146
146
  **kwargs
147
147
  ) -> Dict[str, Any]:
148
148
  """
@@ -150,7 +150,7 @@ class ClickMerchantApi:
150
150
 
151
151
  Args:
152
152
  amount: Payment amount
153
- account_id: Account ID or order ID
153
+ id: Account ID or order ID
154
154
  **kwargs: Additional parameters
155
155
  - description: Payment description
156
156
  - phone: Customer phone number
@@ -161,7 +161,7 @@ class ClickMerchantApi:
161
161
  Dict containing invoice details
162
162
  """
163
163
  # Extract additional parameters
164
- description = kwargs.get('description', f'Payment for account {account_id}')
164
+ description = kwargs.get('description', f'Payment for account {id}')
165
165
  phone = kwargs.get('phone')
166
166
  email = kwargs.get('email')
167
167
  expire_time = kwargs.get('expire_time', 60) # Default 1 hour
@@ -170,7 +170,7 @@ class ClickMerchantApi:
170
170
  data = {
171
171
  "service_id": self.service_id,
172
172
  "amount": float(amount),
173
- "merchant_transaction_id": str(account_id),
173
+ "merchant_transaction_id": str(id),
174
174
  "description": description,
175
175
  "request_id": str(generate_timestamp()),
176
176
  "expire_time": expire_time
@@ -176,8 +176,8 @@ class PaymeGateway(BasePaymentGateway):
176
176
  Async version of create_payment.
177
177
 
178
178
  Args:
179
+ id: Account or order ID
179
180
  amount: Payment amount in som
180
- account_id: Account or order ID
181
181
  return_url: Return URL after payment (default: "")
182
182
  account_field_name: Field name for account ID (default: "order_id")
183
183
 
@@ -9,6 +9,7 @@ from .webhooks import PaymeWebhook, ClickWebhook
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
12
+
12
13
  @method_decorator(csrf_exempt, name='dispatch')
13
14
  class PaymeWebhookView(PaymeWebhook):
14
15
  """
@@ -54,6 +55,7 @@ class PaymeWebhookView(PaymeWebhook):
54
55
  """
55
56
  logger.info(f"Payme payment cancelled: {transaction.transaction_id}")
56
57
 
58
+
57
59
  @method_decorator(csrf_exempt, name='dispatch')
58
60
  class ClickWebhookView(ClickWebhook):
59
61
  """
@@ -432,6 +432,10 @@ class PaymeWebhook(View):
432
432
  # If transaction is already cancelled, return the existing data
433
433
  return self._cancel_response(transaction)
434
434
 
435
+ if reason == 3:
436
+ transaction.state = PaymentTransaction.CANCELLED_DURING_INIT
437
+ transaction.save()
438
+
435
439
  # Use the mark_as_cancelled method to properly store the reason
436
440
  transaction.mark_as_cancelled(reason=reason)
437
441
 
@@ -26,16 +26,16 @@ class BasePaymentGateway(ABC):
26
26
  @abstractmethod
27
27
  def create_payment(
28
28
  self,
29
+ id: Union[int, str],
29
30
  amount: Union[int, float, str],
30
- account_id: Union[int, str],
31
31
  **kwargs
32
32
  ) -> Dict[str, Any]:
33
33
  """
34
34
  Create a payment.
35
35
 
36
36
  Args:
37
+ id: The account ID or order ID
37
38
  amount: The payment amount
38
- account_id: The account ID or order ID
39
39
  **kwargs: Additional parameters specific to the payment gateway
40
40
 
41
41
  Returns:
@@ -62,8 +62,8 @@ class ClickGateway(BasePaymentGateway):
62
62
  @handle_exceptions
63
63
  def create_payment(
64
64
  self,
65
+ id: Union[int, str],
65
66
  amount: Union[int, float, str],
66
- account_id: Union[int, str],
67
67
  **kwargs
68
68
  ) -> Dict[str, Any]:
69
69
  """
@@ -71,7 +71,7 @@ class ClickGateway(BasePaymentGateway):
71
71
 
72
72
  Args:
73
73
  amount: The payment amount in som
74
- account_id: The account ID or order ID
74
+ id: The account ID or order ID
75
75
  **kwargs: Additional parameters for the payment
76
76
  - description: Payment description
77
77
  - return_url: URL to return after payment
@@ -87,7 +87,7 @@ class ClickGateway(BasePaymentGateway):
87
87
  amount_tiyin = format_amount(amount)
88
88
 
89
89
  # Extract additional parameters
90
- description = kwargs.get('description', f'Payment for account {account_id}') # noqa
90
+ description = kwargs.get('description', f'Payment for account {id}') # noqa
91
91
  return_url = kwargs.get('return_url')
92
92
  callback_url = kwargs.get('callback_url')
93
93
  # These parameters are not used in the URL but are available in the API
@@ -100,7 +100,7 @@ class ClickGateway(BasePaymentGateway):
100
100
  payment_url += f"?service_id={self.service_id}"
101
101
  payment_url += f"&merchant_id={self.merchant_id}"
102
102
  payment_url += f"&amount={amount}"
103
- payment_url += f"&transaction_param={account_id}"
103
+ payment_url += f"&transaction_param={id}"
104
104
 
105
105
  if return_url:
106
106
  payment_url += f"&return_url={return_url}"
@@ -112,13 +112,13 @@ class ClickGateway(BasePaymentGateway):
112
112
  payment_url += f"&merchant_user_id={description}"
113
113
 
114
114
  # Generate a unique transaction ID
115
- transaction_id = f"click_{account_id}_{int(amount_tiyin)}"
115
+ transaction_id = f"click_{id}_{int(amount_tiyin)}"
116
116
 
117
117
  return {
118
118
  'transaction_id': transaction_id,
119
119
  'payment_url': payment_url,
120
120
  'amount': amount,
121
- 'account_id': account_id,
121
+ 'account_id': id,
122
122
  'status': 'created',
123
123
  'service_id': self.service_id,
124
124
  'merchant_id': self.merchant_id
@@ -11,6 +11,7 @@ from paytechuz.core.utils import handle_exceptions, generate_timestamp
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
13
 
14
+
14
15
  class ClickMerchantApi:
15
16
  """
16
17
  Click merchant API operations.
@@ -69,7 +70,7 @@ class ClickMerchantApi:
69
70
  return hashlib.md5(sign_string.encode('utf-8')).hexdigest()
70
71
 
71
72
  @handle_exceptions
72
- def check_payment(self, account_id: Union[int, str]) -> Dict[str, Any]:
73
+ def check_payment(self, id: Union[int, str]) -> Dict[str, Any]:
73
74
  """
74
75
  Check payment status.
75
76
 
@@ -82,7 +83,7 @@ class ClickMerchantApi:
82
83
  # Prepare request data
83
84
  data = {
84
85
  "service_id": self.service_id,
85
- "merchant_transaction_id": str(account_id),
86
+ "merchant_transaction_id": str(id),
86
87
  "request_id": str(generate_timestamp())
87
88
  }
88
89
 
@@ -101,14 +102,14 @@ class ClickMerchantApi:
101
102
  @handle_exceptions
102
103
  def cancel_payment(
103
104
  self,
104
- account_id: Union[int, str],
105
+ id: Union[int, str],
105
106
  reason: Optional[str] = None
106
107
  ) -> Dict[str, Any]:
107
108
  """
108
109
  Cancel payment.
109
110
 
110
111
  Args:
111
- account_id: Account ID or order ID
112
+ id: Account ID or order ID
112
113
  reason: Optional reason for cancellation
113
114
 
114
115
  Returns:
@@ -117,7 +118,7 @@ class ClickMerchantApi:
117
118
  # Prepare request data
118
119
  data = {
119
120
  "service_id": self.service_id,
120
- "merchant_transaction_id": str(account_id),
121
+ "merchant_transaction_id": str(id),
121
122
  "request_id": str(generate_timestamp())
122
123
  }
123
124
 
@@ -140,8 +141,8 @@ class ClickMerchantApi:
140
141
  @handle_exceptions
141
142
  def create_invoice(
142
143
  self,
144
+ id: Union[int, str],
143
145
  amount: Union[int, float],
144
- account_id: Union[int, str],
145
146
  **kwargs
146
147
  ) -> Dict[str, Any]:
147
148
  """
@@ -160,7 +161,7 @@ class ClickMerchantApi:
160
161
  Dict containing invoice details
161
162
  """
162
163
  # Extract additional parameters
163
- description = kwargs.get('description', f'Payment for account {account_id}')
164
+ description = kwargs.get('description', f'Payment for account {id}')
164
165
  phone = kwargs.get('phone')
165
166
  email = kwargs.get('email')
166
167
  expire_time = kwargs.get('expire_time', 60) # Default 1 hour
@@ -169,7 +170,7 @@ class ClickMerchantApi:
169
170
  data = {
170
171
  "service_id": self.service_id,
171
172
  "amount": float(amount),
172
- "merchant_transaction_id": str(account_id),
173
+ "merchant_transaction_id": str(id),
173
174
  "description": description,
174
175
  "request_id": str(generate_timestamp()),
175
176
  "expire_time": expire_time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paytechuz
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes