paytechuz 0.2.4__tar.gz → 0.2.6__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.4/src/paytechuz.egg-info → paytechuz-0.2.6}/PKG-INFO +15 -2
- {paytechuz-0.2.4 → paytechuz-0.2.6}/README.md +14 -1
- {paytechuz-0.2.4 → paytechuz-0.2.6}/pyproject.toml +1 -1
- {paytechuz-0.2.4 → paytechuz-0.2.6}/setup.py +1 -1
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/base.py +2 -2
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/click/client.py +6 -5
- {paytechuz-0.2.4/src/paytechuz → paytechuz-0.2.6/src}/gateways/click/merchant.py +9 -9
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/payme/client.py +2 -2
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/base.py +2 -2
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/click/client.py +6 -6
- {paytechuz-0.2.4/src → paytechuz-0.2.6/src/paytechuz}/gateways/click/merchant.py +9 -8
- {paytechuz-0.2.4 → paytechuz-0.2.6/src/paytechuz.egg-info}/PKG-INFO +15 -2
- {paytechuz-0.2.4 → paytechuz-0.2.6}/MANIFEST.in +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/setup.cfg +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/constants.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/exceptions.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/http.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/payme/errors.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/core/utils.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/click/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/click/webhook.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/payme/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/payme/cards.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/payme/receipts.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/gateways/payme/webhook.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/admin.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/apps.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/migrations/0001_initial.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/migrations/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/models.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/signals.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/views.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/django/webhooks.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/fastapi/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/fastapi/models.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/fastapi/routes.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/integrations/fastapi/schemas.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/constants.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/exceptions.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/http.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/payme/errors.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/core/utils.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/click/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/click/webhook.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/payme/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/payme/cards.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/payme/client.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/payme/receipts.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/gateways/payme/webhook.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/admin.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/apps.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/migrations/0001_initial.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/migrations/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/models.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/signals.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/views.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/webhooks.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/fastapi/__init__.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/fastapi/models.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/fastapi/routes.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz/integrations/fastapi/schemas.py +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz.egg-info/SOURCES.txt +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/src/paytechuz.egg-info/dependency_links.txt +0 -0
- {paytechuz-0.2.4 → paytechuz-0.2.6}/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.
|
|
3
|
+
Version: 0.2.6
|
|
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
|
|
@@ -66,8 +66,8 @@ payme_link = payme.create_payment(
|
|
|
66
66
|
)
|
|
67
67
|
|
|
68
68
|
click_link = click.create_payment(
|
|
69
|
+
id="order_123",
|
|
69
70
|
amount=150000, # amount in UZS
|
|
70
|
-
account_id="order_123",
|
|
71
71
|
description="Test payment",
|
|
72
72
|
return_url="https://example.com/return"
|
|
73
73
|
)
|
|
@@ -117,6 +117,19 @@ class PaymeWebhookView(BasePaymeWebhookView):
|
|
|
117
117
|
order.save()
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
3. Add webhook URLs to `urls.py`:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# urls.py
|
|
124
|
+
from django.urls import path
|
|
125
|
+
from .views import PaymeWebhookView
|
|
126
|
+
|
|
127
|
+
urlpatterns = [
|
|
128
|
+
# ...
|
|
129
|
+
path('payments/webhook/payme/', PaymeWebhookView.as_view(), name='payme_webhook'),
|
|
130
|
+
]
|
|
131
|
+
```
|
|
132
|
+
|
|
120
133
|
### FastAPI Integration
|
|
121
134
|
|
|
122
135
|
1. Create webhook handler:
|
|
@@ -51,8 +51,8 @@ payme_link = payme.create_payment(
|
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
click_link = click.create_payment(
|
|
54
|
+
id="order_123",
|
|
54
55
|
amount=150000, # amount in UZS
|
|
55
|
-
account_id="order_123",
|
|
56
56
|
description="Test payment",
|
|
57
57
|
return_url="https://example.com/return"
|
|
58
58
|
)
|
|
@@ -102,6 +102,19 @@ class PaymeWebhookView(BasePaymeWebhookView):
|
|
|
102
102
|
order.save()
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
3. Add webhook URLs to `urls.py`:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# urls.py
|
|
109
|
+
from django.urls import path
|
|
110
|
+
from .views import PaymeWebhookView
|
|
111
|
+
|
|
112
|
+
urlpatterns = [
|
|
113
|
+
# ...
|
|
114
|
+
path('payments/webhook/payme/', PaymeWebhookView.as_view(), name='payme_webhook'),
|
|
115
|
+
]
|
|
116
|
+
```
|
|
117
|
+
|
|
105
118
|
### FastAPI Integration
|
|
106
119
|
|
|
107
120
|
1. Create webhook handler:
|
|
@@ -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:
|
|
@@ -12,6 +12,7 @@ from paytechuz.gateways.click.merchant import ClickMerchantApi
|
|
|
12
12
|
|
|
13
13
|
logger = logging.getLogger(__name__)
|
|
14
14
|
|
|
15
|
+
|
|
15
16
|
class ClickGateway(BasePaymentGateway):
|
|
16
17
|
"""
|
|
17
18
|
Click payment gateway implementation.
|
|
@@ -61,16 +62,16 @@ class ClickGateway(BasePaymentGateway):
|
|
|
61
62
|
@handle_exceptions
|
|
62
63
|
def create_payment(
|
|
63
64
|
self,
|
|
65
|
+
id: Union[int, str],
|
|
64
66
|
amount: Union[int, float, str],
|
|
65
|
-
account_id: Union[int, str],
|
|
66
67
|
**kwargs
|
|
67
68
|
) -> Dict[str, Any]:
|
|
68
69
|
"""
|
|
69
70
|
Create a payment using Click.
|
|
70
71
|
|
|
71
72
|
Args:
|
|
73
|
+
id: The account ID or order ID
|
|
72
74
|
amount: The payment amount in som
|
|
73
|
-
account_id: The account ID or order ID
|
|
74
75
|
**kwargs: Additional parameters for the payment
|
|
75
76
|
- description: Payment description
|
|
76
77
|
- return_url: URL to return after payment
|
|
@@ -99,7 +100,7 @@ class ClickGateway(BasePaymentGateway):
|
|
|
99
100
|
payment_url += f"?service_id={self.service_id}"
|
|
100
101
|
payment_url += f"&merchant_id={self.merchant_id}"
|
|
101
102
|
payment_url += f"&amount={amount}"
|
|
102
|
-
payment_url += f"&transaction_param={
|
|
103
|
+
payment_url += f"&transaction_param={id}"
|
|
103
104
|
|
|
104
105
|
if return_url:
|
|
105
106
|
payment_url += f"&return_url={return_url}"
|
|
@@ -111,13 +112,13 @@ class ClickGateway(BasePaymentGateway):
|
|
|
111
112
|
payment_url += f"&merchant_user_id={description}"
|
|
112
113
|
|
|
113
114
|
# Generate a unique transaction ID
|
|
114
|
-
transaction_id = f"click_{
|
|
115
|
+
transaction_id = f"click_{id}_{int(amount_tiyin)}"
|
|
115
116
|
|
|
116
117
|
return {
|
|
117
118
|
'transaction_id': transaction_id,
|
|
118
119
|
'payment_url': payment_url,
|
|
119
120
|
'amount': amount,
|
|
120
|
-
'account_id':
|
|
121
|
+
'account_id': id,
|
|
121
122
|
'status': 'created',
|
|
122
123
|
'service_id': self.service_id,
|
|
123
124
|
'merchant_id': self.merchant_id
|
|
@@ -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,
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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 {
|
|
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(
|
|
173
|
+
"merchant_transaction_id": str(id),
|
|
174
174
|
"description": description,
|
|
175
175
|
"request_id": str(generate_timestamp()),
|
|
176
176
|
"expire_time": expire_time
|
|
@@ -149,8 +149,8 @@ class PaymeGateway(BasePaymentGateway):
|
|
|
149
149
|
Create a payment using Payme.
|
|
150
150
|
|
|
151
151
|
Args:
|
|
152
|
+
id: Account or order ID
|
|
152
153
|
amount: Payment amount in som
|
|
153
|
-
account_id: Account or order ID
|
|
154
154
|
return_url: Return URL after payment (default: "")
|
|
155
155
|
account_field_name: Field name for account ID (default: "order_id")
|
|
156
156
|
|
|
@@ -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
|
|
|
@@ -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
|
-
|
|
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 {
|
|
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={
|
|
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_{
|
|
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':
|
|
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,
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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 {
|
|
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(
|
|
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.
|
|
3
|
+
Version: 0.2.6
|
|
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
|
|
@@ -66,8 +66,8 @@ payme_link = payme.create_payment(
|
|
|
66
66
|
)
|
|
67
67
|
|
|
68
68
|
click_link = click.create_payment(
|
|
69
|
+
id="order_123",
|
|
69
70
|
amount=150000, # amount in UZS
|
|
70
|
-
account_id="order_123",
|
|
71
71
|
description="Test payment",
|
|
72
72
|
return_url="https://example.com/return"
|
|
73
73
|
)
|
|
@@ -117,6 +117,19 @@ class PaymeWebhookView(BasePaymeWebhookView):
|
|
|
117
117
|
order.save()
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
3. Add webhook URLs to `urls.py`:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# urls.py
|
|
124
|
+
from django.urls import path
|
|
125
|
+
from .views import PaymeWebhookView
|
|
126
|
+
|
|
127
|
+
urlpatterns = [
|
|
128
|
+
# ...
|
|
129
|
+
path('payments/webhook/payme/', PaymeWebhookView.as_view(), name='payme_webhook'),
|
|
130
|
+
]
|
|
131
|
+
```
|
|
132
|
+
|
|
120
133
|
### FastAPI Integration
|
|
121
134
|
|
|
122
135
|
1. Create webhook handler:
|
|
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.4 → paytechuz-0.2.6}/src/paytechuz/integrations/django/migrations/0001_initial.py
RENAMED
|
File without changes
|
{paytechuz-0.2.4 → paytechuz-0.2.6}/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
|