paytechuz 0.3.2__py3-none-any.whl → 0.3.4__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/core/constants.py +11 -11
- paytechuz/gateways/payme/cards.py +48 -15
- paytechuz/gateways/payme/receipts.py +23 -13
- paytechuz/integrations/django/webhooks.py +0 -2
- {paytechuz-0.3.2.dist-info → paytechuz-0.3.4.dist-info}/METADATA +1 -1
- {paytechuz-0.3.2.dist-info → paytechuz-0.3.4.dist-info}/RECORD +8 -8
- {paytechuz-0.3.2.dist-info → paytechuz-0.3.4.dist-info}/WHEEL +0 -0
- {paytechuz-0.3.2.dist-info → paytechuz-0.3.4.dist-info}/top_level.txt +0 -0
paytechuz/core/constants.py
CHANGED
|
@@ -20,17 +20,17 @@ class PaymentGateway(Enum):
|
|
|
20
20
|
|
|
21
21
|
class PaymeEndpoints:
|
|
22
22
|
"""Payme API endpoints."""
|
|
23
|
-
RECEIPTS_CREATE = "receipts
|
|
24
|
-
RECEIPTS_PAY = "receipts
|
|
25
|
-
RECEIPTS_SEND = "receipts
|
|
26
|
-
RECEIPTS_CHECK = "receipts
|
|
27
|
-
RECEIPTS_CANCEL = "receipts
|
|
28
|
-
RECEIPTS_GET = "receipts
|
|
29
|
-
CARDS_CREATE = "cards
|
|
30
|
-
CARDS_VERIFY = "cards
|
|
31
|
-
CARDS_CHECK = "cards
|
|
32
|
-
CARDS_REMOVE = "cards
|
|
33
|
-
CARDS_GET_VERIFY_CODE = "cards
|
|
23
|
+
RECEIPTS_CREATE = "receipts.create"
|
|
24
|
+
RECEIPTS_PAY = "receipts.pay"
|
|
25
|
+
RECEIPTS_SEND = "receipts.send"
|
|
26
|
+
RECEIPTS_CHECK = "receipts.check"
|
|
27
|
+
RECEIPTS_CANCEL = "receipts.cancel"
|
|
28
|
+
RECEIPTS_GET = "receipts.get"
|
|
29
|
+
CARDS_CREATE = "cards.create"
|
|
30
|
+
CARDS_VERIFY = "cards.verify"
|
|
31
|
+
CARDS_CHECK = "cards.check"
|
|
32
|
+
CARDS_REMOVE = "cards.remove"
|
|
33
|
+
CARDS_GET_VERIFY_CODE = "cards.get_verify_code"
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class PaymeNetworks:
|
|
@@ -30,6 +30,22 @@ class PaymeCards:
|
|
|
30
30
|
self.http_client = http_client
|
|
31
31
|
self.payme_id = payme_id
|
|
32
32
|
|
|
33
|
+
def _get_auth_headers(self, language: str = 'uz') -> Dict[str, str]:
|
|
34
|
+
"""
|
|
35
|
+
Get authentication headers for Payme API.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
language: Language code (uz, ru, en)
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Dict containing authentication headers
|
|
42
|
+
"""
|
|
43
|
+
headers = {
|
|
44
|
+
"Accept-Language": language,
|
|
45
|
+
"X-Auth": self.payme_id
|
|
46
|
+
}
|
|
47
|
+
return headers
|
|
48
|
+
|
|
33
49
|
@handle_exceptions
|
|
34
50
|
def create(
|
|
35
51
|
self,
|
|
@@ -58,23 +74,24 @@ class PaymeCards:
|
|
|
58
74
|
|
|
59
75
|
# Prepare request data
|
|
60
76
|
data = {
|
|
77
|
+
"jsonrpc": "2.0",
|
|
61
78
|
"method": PaymeEndpoints.CARDS_CREATE,
|
|
62
79
|
"params": {
|
|
63
80
|
"card": {
|
|
64
81
|
"number": card_number,
|
|
65
82
|
"expire": expire_date
|
|
66
83
|
},
|
|
67
|
-
"save": save
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
"save": save
|
|
85
|
+
},
|
|
86
|
+
"id": 1
|
|
70
87
|
}
|
|
71
88
|
|
|
72
89
|
# Add optional parameters
|
|
73
90
|
if phone:
|
|
74
91
|
data["params"]["phone"] = phone
|
|
75
92
|
|
|
76
|
-
#
|
|
77
|
-
headers =
|
|
93
|
+
# Get authentication headers
|
|
94
|
+
headers = self._get_auth_headers(language)
|
|
78
95
|
|
|
79
96
|
# Make request
|
|
80
97
|
response = self.http_client.post(
|
|
@@ -109,15 +126,17 @@ class PaymeCards:
|
|
|
109
126
|
|
|
110
127
|
# Prepare request data
|
|
111
128
|
data = {
|
|
129
|
+
"jsonrpc": "2.0",
|
|
112
130
|
"method": PaymeEndpoints.CARDS_VERIFY,
|
|
113
131
|
"params": {
|
|
114
132
|
"token": token,
|
|
115
133
|
"code": code
|
|
116
|
-
}
|
|
134
|
+
},
|
|
135
|
+
"id": 1
|
|
117
136
|
}
|
|
118
137
|
|
|
119
|
-
#
|
|
120
|
-
headers =
|
|
138
|
+
# Get authentication headers
|
|
139
|
+
headers = self._get_auth_headers(language)
|
|
121
140
|
|
|
122
141
|
# Make request
|
|
123
142
|
response = self.http_client.post(
|
|
@@ -141,16 +160,22 @@ class PaymeCards:
|
|
|
141
160
|
"""
|
|
142
161
|
# Prepare request data
|
|
143
162
|
data = {
|
|
163
|
+
"jsonrpc": "2.0",
|
|
144
164
|
"method": PaymeEndpoints.CARDS_CHECK,
|
|
145
165
|
"params": {
|
|
146
166
|
"token": token
|
|
147
|
-
}
|
|
167
|
+
},
|
|
168
|
+
"id": 1
|
|
148
169
|
}
|
|
149
170
|
|
|
171
|
+
# Get authentication headers
|
|
172
|
+
headers = self._get_auth_headers()
|
|
173
|
+
|
|
150
174
|
# Make request
|
|
151
175
|
response = self.http_client.post(
|
|
152
176
|
endpoint="",
|
|
153
|
-
json_data=data
|
|
177
|
+
json_data=data,
|
|
178
|
+
headers=headers
|
|
154
179
|
)
|
|
155
180
|
|
|
156
181
|
return response
|
|
@@ -168,16 +193,22 @@ class PaymeCards:
|
|
|
168
193
|
"""
|
|
169
194
|
# Prepare request data
|
|
170
195
|
data = {
|
|
196
|
+
"jsonrpc": "2.0",
|
|
171
197
|
"method": PaymeEndpoints.CARDS_REMOVE,
|
|
172
198
|
"params": {
|
|
173
199
|
"token": token
|
|
174
|
-
}
|
|
200
|
+
},
|
|
201
|
+
"id": 1
|
|
175
202
|
}
|
|
176
203
|
|
|
204
|
+
# Get authentication headers
|
|
205
|
+
headers = self._get_auth_headers()
|
|
206
|
+
|
|
177
207
|
# Make request
|
|
178
208
|
response = self.http_client.post(
|
|
179
209
|
endpoint="",
|
|
180
|
-
json_data=data
|
|
210
|
+
json_data=data,
|
|
211
|
+
headers=headers
|
|
181
212
|
)
|
|
182
213
|
|
|
183
214
|
return response
|
|
@@ -204,14 +235,16 @@ class PaymeCards:
|
|
|
204
235
|
|
|
205
236
|
# Prepare request data
|
|
206
237
|
data = {
|
|
238
|
+
"jsonrpc": "2.0",
|
|
207
239
|
"method": PaymeEndpoints.CARDS_GET_VERIFY_CODE,
|
|
208
240
|
"params": {
|
|
209
241
|
"token": token
|
|
210
|
-
}
|
|
242
|
+
},
|
|
243
|
+
"id": 1
|
|
211
244
|
}
|
|
212
245
|
|
|
213
|
-
#
|
|
214
|
-
headers =
|
|
246
|
+
# Get authentication headers
|
|
247
|
+
headers = self._get_auth_headers(language)
|
|
215
248
|
|
|
216
249
|
# Make request
|
|
217
250
|
response = self.http_client.post(
|
|
@@ -48,11 +48,10 @@ class PaymeReceipts:
|
|
|
48
48
|
Returns:
|
|
49
49
|
Dict containing authentication headers
|
|
50
50
|
"""
|
|
51
|
-
headers = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
headers["Authorization"] = auth
|
|
51
|
+
headers = {
|
|
52
|
+
"Accept-Language": language,
|
|
53
|
+
"X-Auth": f"{self.payme_id}:{self.payme_key}"
|
|
54
|
+
}
|
|
56
55
|
|
|
57
56
|
return headers
|
|
58
57
|
|
|
@@ -94,14 +93,15 @@ class PaymeReceipts:
|
|
|
94
93
|
|
|
95
94
|
# Prepare request data
|
|
96
95
|
data = {
|
|
96
|
+
"jsonrpc": "2.0",
|
|
97
97
|
"method": PaymeEndpoints.RECEIPTS_CREATE,
|
|
98
98
|
"params": {
|
|
99
99
|
"amount": amount,
|
|
100
100
|
"account": account,
|
|
101
101
|
"description": description,
|
|
102
|
-
"detail": detail
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
"detail": detail
|
|
103
|
+
},
|
|
104
|
+
"id": 1
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
# Add optional parameters
|
|
@@ -156,11 +156,13 @@ class PaymeReceipts:
|
|
|
156
156
|
|
|
157
157
|
# Prepare request data
|
|
158
158
|
data = {
|
|
159
|
+
"jsonrpc": "2.0",
|
|
159
160
|
"method": PaymeEndpoints.RECEIPTS_PAY,
|
|
160
161
|
"params": {
|
|
161
162
|
"id": receipt_id,
|
|
162
163
|
"token": token
|
|
163
|
-
}
|
|
164
|
+
},
|
|
165
|
+
"id": 1
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
# Get authentication headers
|
|
@@ -199,11 +201,13 @@ class PaymeReceipts:
|
|
|
199
201
|
|
|
200
202
|
# Prepare request data
|
|
201
203
|
data = {
|
|
204
|
+
"jsonrpc": "2.0",
|
|
202
205
|
"method": PaymeEndpoints.RECEIPTS_SEND,
|
|
203
206
|
"params": {
|
|
204
207
|
"id": receipt_id,
|
|
205
208
|
"phone": phone
|
|
206
|
-
}
|
|
209
|
+
},
|
|
210
|
+
"id": 1
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
# Get authentication headers
|
|
@@ -236,10 +240,12 @@ class PaymeReceipts:
|
|
|
236
240
|
|
|
237
241
|
# Prepare request data
|
|
238
242
|
data = {
|
|
243
|
+
"jsonrpc": "2.0",
|
|
239
244
|
"method": PaymeEndpoints.RECEIPTS_CHECK,
|
|
240
245
|
"params": {
|
|
241
246
|
"id": receipt_id
|
|
242
|
-
}
|
|
247
|
+
},
|
|
248
|
+
"id": 1
|
|
243
249
|
}
|
|
244
250
|
|
|
245
251
|
# Get authentication headers
|
|
@@ -278,10 +284,12 @@ class PaymeReceipts:
|
|
|
278
284
|
|
|
279
285
|
# Prepare request data
|
|
280
286
|
data = {
|
|
287
|
+
"jsonrpc": "2.0",
|
|
281
288
|
"method": PaymeEndpoints.RECEIPTS_CANCEL,
|
|
282
289
|
"params": {
|
|
283
290
|
"id": receipt_id
|
|
284
|
-
}
|
|
291
|
+
},
|
|
292
|
+
"id": 1
|
|
285
293
|
}
|
|
286
294
|
|
|
287
295
|
# Add reason if provided
|
|
@@ -318,10 +326,12 @@ class PaymeReceipts:
|
|
|
318
326
|
|
|
319
327
|
# Prepare request data
|
|
320
328
|
data = {
|
|
329
|
+
"jsonrpc": "2.0",
|
|
321
330
|
"method": PaymeEndpoints.RECEIPTS_GET,
|
|
322
331
|
"params": {
|
|
323
332
|
"id": receipt_id
|
|
324
|
-
}
|
|
333
|
+
},
|
|
334
|
+
"id": 1
|
|
325
335
|
}
|
|
326
336
|
|
|
327
337
|
# Get authentication headers
|
|
@@ -434,8 +434,6 @@ class PaymeWebhook(View):
|
|
|
434
434
|
f"Transaction {transaction_id} not found"
|
|
435
435
|
) from None
|
|
436
436
|
|
|
437
|
-
print(transaction.state, reason)
|
|
438
|
-
|
|
439
437
|
# Check if transaction is already cancelled
|
|
440
438
|
if transaction.state == PaymentTransaction.CANCELLED:
|
|
441
439
|
# If transaction is already cancelled, return the existing data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
paytechuz/__init__.py,sha256=uWgnlJCeEyLr6Nl54y8yVKo0nzvzjsJ6nfwcc1Kdbx8,1916
|
|
2
2
|
paytechuz/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
paytechuz/core/base.py,sha256=Es6eEGNgDjQJe-kEJVAHSAh8AWbgtIuQMm0xn7qfjl4,2549
|
|
4
|
-
paytechuz/core/constants.py,sha256=
|
|
4
|
+
paytechuz/core/constants.py,sha256=uju3BNtDln-m04X1MhZsdIc26dHkZ2Tyb3Kfl00Btj8,2305
|
|
5
5
|
paytechuz/core/exceptions.py,sha256=XMJkqiponTkvhjoh3S2iFNuU3UbBdFW4130kd0hpudg,5489
|
|
6
6
|
paytechuz/core/http.py,sha256=1PFv_Fo62GtfyYKUK2nsT4AaeQNuMgZlFUFL1q9p2MI,7672
|
|
7
7
|
paytechuz/core/utils.py,sha256=EbNtDweR1ABOtCu4D6cYlolM0t_fbiE3gNoc_qfcKKA,4704
|
|
@@ -15,9 +15,9 @@ paytechuz/gateways/click/client.py,sha256=NwsPGfXacO0tWvZCA0V9KZ9XhFV7AnyHBmtxsW
|
|
|
15
15
|
paytechuz/gateways/click/merchant.py,sha256=tvHUwNr_eiDz_ED4-m2GNBh_LXN0b5lwtq1jw1e0zAQ,7191
|
|
16
16
|
paytechuz/gateways/click/webhook.py,sha256=rph-NmjjnBKMW4rcxQTXrHHdK-uMrU39kXnbqK56leo,7936
|
|
17
17
|
paytechuz/gateways/payme/__init__.py,sha256=KcVkYvAEblL4ASVAOrUofRBwywAkTZIgRXoBaCbYtv8,90
|
|
18
|
-
paytechuz/gateways/payme/cards.py,sha256=
|
|
18
|
+
paytechuz/gateways/payme/cards.py,sha256=JociR-Y405fUxiqP96WSLJMu45bc_oa5YszxenchHDc,6291
|
|
19
19
|
paytechuz/gateways/payme/client.py,sha256=fmFHbgWX0UG7246JgA8tWougzAbw75QTWC9mw_TgvZI,7808
|
|
20
|
-
paytechuz/gateways/payme/receipts.py,sha256=
|
|
20
|
+
paytechuz/gateways/payme/receipts.py,sha256=YtQufqLN7A8SYY4qnIpYe32tQU9BcbF81NTpNKnzYp0,9104
|
|
21
21
|
paytechuz/gateways/payme/webhook.py,sha256=-0O8vzMtiu4U8FWFKDA6EfyoX4NEGqcEq-T0yNtVhM4,12374
|
|
22
22
|
paytechuz/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
paytechuz/integrations/django/__init__.py,sha256=fNs4c2IWpCe78-_Yvgz59TdKbHiYRYDkLR33QOBf-Ok,356
|
|
@@ -26,7 +26,7 @@ paytechuz/integrations/django/apps.py,sha256=Q9wG2osL7_Ip2BcAkq7lmmhu4UKJAg6UtSs
|
|
|
26
26
|
paytechuz/integrations/django/models.py,sha256=ze-yzGBYN3sAXFClT6xjEzRN3ihepPVPDcm_qgdvM40,5936
|
|
27
27
|
paytechuz/integrations/django/signals.py,sha256=VtNYEAnu13wi9PqadEaCU9LY_k2tY26AS4bnPIAqw7M,1319
|
|
28
28
|
paytechuz/integrations/django/views.py,sha256=KFiuMcr4BtMbzbrW_RbIkv0-Fk214WIWWwaStscArzs,4149
|
|
29
|
-
paytechuz/integrations/django/webhooks.py,sha256=
|
|
29
|
+
paytechuz/integrations/django/webhooks.py,sha256=_1nipbMIFc_Q4LijNB2byu5aKMrQmpMkJt_eFAWvFPw,36801
|
|
30
30
|
paytechuz/integrations/django/migrations/0001_initial.py,sha256=SWHIUuwq91crzaxa9v1UK0kay8CxsjUo6t4bqg7j0Gw,1896
|
|
31
31
|
paytechuz/integrations/django/migrations/0002_alter_paymenttransaction_gateway.py,sha256=XiZx5urgfhXxra3W_KWksQ1LbaDOs3sjPn4w0T2cW50,457
|
|
32
32
|
paytechuz/integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
|
|
@@ -34,7 +34,7 @@ paytechuz/integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2
|
|
|
34
34
|
paytechuz/integrations/fastapi/models.py,sha256=9IqrsndIVuIDwDbijZ89biJxEWQASXRBfWVShxgerAc,5113
|
|
35
35
|
paytechuz/integrations/fastapi/routes.py,sha256=t8zbqhMZsaJmEvMDgmF-NoRmbqksfX_AvIrx-3kCjg8,37845
|
|
36
36
|
paytechuz/integrations/fastapi/schemas.py,sha256=PgRqviJiD4-u3_CIkUOX8R7L8Yqn8L44WLte7968G0E,3887
|
|
37
|
-
paytechuz-0.3.
|
|
38
|
-
paytechuz-0.3.
|
|
39
|
-
paytechuz-0.3.
|
|
40
|
-
paytechuz-0.3.
|
|
37
|
+
paytechuz-0.3.4.dist-info/METADATA,sha256=61m7h6BtW3SeUI1zb9hMO0CQChTa4XDn7QQQmGEIGFo,13096
|
|
38
|
+
paytechuz-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
39
|
+
paytechuz-0.3.4.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
|
|
40
|
+
paytechuz-0.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|