payme-pkg 3.0.5__tar.gz → 3.0.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 payme-pkg might be problematic. Click here for more details.
- {payme_pkg-3.0.5/payme_pkg.egg-info → payme_pkg-3.0.7}/PKG-INFO +1 -1
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/README.md +7 -3
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/cards.py +0 -9
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/client.py +1 -3
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/initializer.py +0 -22
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/receipts.py +0 -9
- payme_pkg-3.0.7/payme/const.py +12 -0
- payme_pkg-3.0.7/payme/util.py +26 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7/payme_pkg.egg-info}/PKG-INFO +1 -1
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/setup.py +1 -1
- payme_pkg-3.0.5/payme/const.py +0 -35
- payme_pkg-3.0.5/payme/util.py +0 -53
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/LICENSE.txt +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/admin.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/apps.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/classes/http.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/exceptions/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/exceptions/general.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/exceptions/webhook.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/migrations/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/models.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/request/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/response/__init__.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/response/cards.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/response/receipts.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/types/response/webhook.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/urls.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme/views.py +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme_pkg.egg-info/SOURCES.txt +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme_pkg.egg-info/dependency_links.txt +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme_pkg.egg-info/requires.txt +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/payme_pkg.egg-info/top_level.txt +0 -0
- {payme_pkg-3.0.5 → payme_pkg-3.0.7}/setup.cfg +0 -0
|
@@ -39,17 +39,21 @@ INSTALLED_APPS = [
|
|
|
39
39
|
|
|
40
40
|
Add `'payme'` credentials inside to settings.py
|
|
41
41
|
|
|
42
|
-
One time payment configuration settings.py
|
|
42
|
+
One time payment (Однаразовый платеж) configuration settings.py
|
|
43
|
+
|
|
44
|
+
Example project: https://github.com/PayTechUz/shop-backend
|
|
43
45
|
```python
|
|
44
46
|
PAYME_ID = "your-payme-id"
|
|
45
47
|
PAYME_KEY = "your-payme-key"
|
|
46
|
-
PAYME_ACCOUNT_FIELD = "
|
|
48
|
+
PAYME_ACCOUNT_FIELD = "order_id"
|
|
47
49
|
PAYME_AMOUNT_FIELD = "total_amount"
|
|
48
50
|
PAYME_ACCOUNT_MODEL = "orders.models.Orders"
|
|
49
51
|
PAYME_ONE_TIME_PAYMENT = True
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
Multi payment configuration settings.py
|
|
54
|
+
Multi payment (Накопительный) configuration settings.py
|
|
55
|
+
|
|
56
|
+
Example project: Coming soon
|
|
53
57
|
```python
|
|
54
58
|
PAYME_ID = "your-payme-id"
|
|
55
59
|
PAYME_KEY = "your-payme-key"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from payme.util import input_type_checker
|
|
4
3
|
from payme.classes.http import HttpClient
|
|
5
4
|
from payme.types.response import cards as response
|
|
6
5
|
|
|
@@ -20,8 +19,6 @@ class Cards:
|
|
|
20
19
|
services. It allows you to create new cards and retrieve verification
|
|
21
20
|
codes for existing cards.
|
|
22
21
|
"""
|
|
23
|
-
|
|
24
|
-
@input_type_checker
|
|
25
22
|
def __init__(self, url: str, payme_id: str) -> "Cards":
|
|
26
23
|
"""
|
|
27
24
|
Initialize the Cards client.
|
|
@@ -35,7 +32,6 @@ class Cards:
|
|
|
35
32
|
}
|
|
36
33
|
self.http = HttpClient(url, headers)
|
|
37
34
|
|
|
38
|
-
@input_type_checker
|
|
39
35
|
def create(self, number: str, expire: str, save: bool = False,
|
|
40
36
|
timeout: int = 10) -> response.CardsCreateResponse:
|
|
41
37
|
"""
|
|
@@ -53,7 +49,6 @@ class Cards:
|
|
|
53
49
|
params = {"card": {"number": number, "expire": expire}, "save": save}
|
|
54
50
|
return self._post_request(method, params, timeout)
|
|
55
51
|
|
|
56
|
-
@input_type_checker
|
|
57
52
|
def get_verify_code(self, token: str, timeout: int = 10) -> \
|
|
58
53
|
response.GetVerifyResponse:
|
|
59
54
|
"""
|
|
@@ -68,7 +63,6 @@ class Cards:
|
|
|
68
63
|
params = {"token": token}
|
|
69
64
|
return self._post_request(method, params, timeout)
|
|
70
65
|
|
|
71
|
-
@input_type_checker
|
|
72
66
|
def verify(self, token: str, code: str, timeout: int = 10) -> \
|
|
73
67
|
response.VerifyResponse:
|
|
74
68
|
"""
|
|
@@ -84,7 +78,6 @@ class Cards:
|
|
|
84
78
|
params = {"token": token, "code": code}
|
|
85
79
|
return self._post_request(method, params, timeout)
|
|
86
80
|
|
|
87
|
-
@input_type_checker
|
|
88
81
|
def remove(self, token: str, timeout: int = 10) -> response.RemoveResponse:
|
|
89
82
|
"""
|
|
90
83
|
Remove a card from the Paycom system.
|
|
@@ -98,7 +91,6 @@ class Cards:
|
|
|
98
91
|
params = {"token": token}
|
|
99
92
|
return self._post_request(method, params, timeout)
|
|
100
93
|
|
|
101
|
-
@input_type_checker
|
|
102
94
|
def check(self, token: str, timeout: int = 10) -> response.CheckResponse:
|
|
103
95
|
"""
|
|
104
96
|
Check the status of a card.
|
|
@@ -112,7 +104,6 @@ class Cards:
|
|
|
112
104
|
params = {"token": token}
|
|
113
105
|
return self._post_request(method, params, timeout)
|
|
114
106
|
|
|
115
|
-
@input_type_checker
|
|
116
107
|
def _post_request(self, method: str, params: dict,
|
|
117
108
|
timeout: int = 10) -> response.Common:
|
|
118
109
|
"""
|
|
@@ -3,7 +3,6 @@ from typing import Union
|
|
|
3
3
|
|
|
4
4
|
from payme.const import Networks
|
|
5
5
|
from payme.classes.cards import Cards
|
|
6
|
-
from payme.util import input_type_checker
|
|
7
6
|
from payme.classes.receipts import Receipts
|
|
8
7
|
from payme.classes.initializer import Initializer
|
|
9
8
|
|
|
@@ -12,7 +11,6 @@ class Payme:
|
|
|
12
11
|
"""
|
|
13
12
|
The payme class provides a simple interface
|
|
14
13
|
"""
|
|
15
|
-
@input_type_checker
|
|
16
14
|
def __init__(
|
|
17
15
|
self,
|
|
18
16
|
payme_id: str,
|
|
@@ -24,7 +22,7 @@ class Payme:
|
|
|
24
22
|
url = Networks.PROD_NET
|
|
25
23
|
|
|
26
24
|
if is_test_mode is True:
|
|
27
|
-
url = Networks.TEST_NET
|
|
25
|
+
url = Networks.TEST_NET.value
|
|
28
26
|
|
|
29
27
|
self.cards = Cards(url=url, payme_id=payme_id)
|
|
30
28
|
self.initializer = Initializer(payme_id=payme_id)
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
|
|
3
|
-
from payme.util import input_type_checker
|
|
4
|
-
|
|
5
3
|
from django.conf import settings
|
|
6
4
|
|
|
7
5
|
|
|
@@ -15,12 +13,9 @@ class Initializer:
|
|
|
15
13
|
The Payme ID associated with your account
|
|
16
14
|
"""
|
|
17
15
|
|
|
18
|
-
@input_type_checker
|
|
19
16
|
def __init__(self, payme_id: str = None):
|
|
20
17
|
self.payme_id = payme_id
|
|
21
18
|
|
|
22
|
-
# pylint: disable=W0622
|
|
23
|
-
@input_type_checker
|
|
24
19
|
def generate_pay_link(
|
|
25
20
|
self,
|
|
26
21
|
id: int,
|
|
@@ -60,20 +55,3 @@ class Initializer:
|
|
|
60
55
|
)
|
|
61
56
|
params = base64.b64encode(params.encode("utf-8")).decode("utf-8")
|
|
62
57
|
return f"https://checkout.paycom.uz/{params}"
|
|
63
|
-
|
|
64
|
-
def test(self):
|
|
65
|
-
"""
|
|
66
|
-
Test method for the Initializer class.
|
|
67
|
-
|
|
68
|
-
This method generates a payment link for a sample order and checks
|
|
69
|
-
if the result is a valid string. If successful, it prints a
|
|
70
|
-
confirmation message.
|
|
71
|
-
"""
|
|
72
|
-
result = self.generate_pay_link(
|
|
73
|
-
id=12345,
|
|
74
|
-
amount=7000,
|
|
75
|
-
return_url="https://example.com"
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
assert isinstance(result, str), "Failed to generate payment link"
|
|
79
|
-
print("Success: Payment link generated successfully.")
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Union, Optional
|
|
2
2
|
|
|
3
3
|
from payme.classes.cards import Cards
|
|
4
|
-
from payme.util import input_type_checker
|
|
5
4
|
from payme.classes.http import HttpClient
|
|
6
5
|
from payme.types.response import receipts as response
|
|
7
6
|
|
|
@@ -37,7 +36,6 @@ class Receipts:
|
|
|
37
36
|
}
|
|
38
37
|
self.http = HttpClient(url, headers)
|
|
39
38
|
|
|
40
|
-
@input_type_checker
|
|
41
39
|
def create(
|
|
42
40
|
self,
|
|
43
41
|
account: dict,
|
|
@@ -64,7 +62,6 @@ class Receipts:
|
|
|
64
62
|
}
|
|
65
63
|
return self._post_request(method, params, timeout)
|
|
66
64
|
|
|
67
|
-
@input_type_checker
|
|
68
65
|
def pay(
|
|
69
66
|
self, receipts_id: str, token: str, timeout: int = 10
|
|
70
67
|
) -> response.PayResponse:
|
|
@@ -83,7 +80,6 @@ class Receipts:
|
|
|
83
80
|
}
|
|
84
81
|
return self._post_request(method, params, timeout)
|
|
85
82
|
|
|
86
|
-
@input_type_checker
|
|
87
83
|
def send(
|
|
88
84
|
self, receipts_id: str, phone: str, timeout: int = 10
|
|
89
85
|
) -> response.SendResponse:
|
|
@@ -101,7 +97,6 @@ class Receipts:
|
|
|
101
97
|
}
|
|
102
98
|
return self._post_request(method, params, timeout)
|
|
103
99
|
|
|
104
|
-
@input_type_checker
|
|
105
100
|
def cancel(
|
|
106
101
|
self, receipts_id: str, timeout: int = 10
|
|
107
102
|
) -> response.CancelResponse:
|
|
@@ -117,7 +112,6 @@ class Receipts:
|
|
|
117
112
|
}
|
|
118
113
|
return self._post_request(method, params, timeout)
|
|
119
114
|
|
|
120
|
-
@input_type_checker
|
|
121
115
|
def check(
|
|
122
116
|
self, receipts_id: str, timeout: int = 10
|
|
123
117
|
) -> response.CheckResponse:
|
|
@@ -133,7 +127,6 @@ class Receipts:
|
|
|
133
127
|
}
|
|
134
128
|
return self._post_request(method, params, timeout)
|
|
135
129
|
|
|
136
|
-
@input_type_checker
|
|
137
130
|
def get(
|
|
138
131
|
self, receipts_id: str, timeout: int = 10
|
|
139
132
|
) -> response.GetResponse:
|
|
@@ -149,7 +142,6 @@ class Receipts:
|
|
|
149
142
|
}
|
|
150
143
|
return self._post_request(method, params, timeout)
|
|
151
144
|
|
|
152
|
-
@input_type_checker
|
|
153
145
|
def get_all(
|
|
154
146
|
self, count: int, from_: int, to: int, offset: int, timeout: int = 10
|
|
155
147
|
) -> response.GetAllResponse:
|
|
@@ -171,7 +163,6 @@ class Receipts:
|
|
|
171
163
|
}
|
|
172
164
|
return self._post_request(method, params, timeout)
|
|
173
165
|
|
|
174
|
-
@input_type_checker
|
|
175
166
|
def _post_request(
|
|
176
167
|
self, method: str, params: dict, timeout: int = 10
|
|
177
168
|
) -> response.Common:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def time_to_payme(datatime) -> int:
|
|
5
|
+
"""
|
|
6
|
+
Convert datetime object to Payme's datetime format.
|
|
7
|
+
|
|
8
|
+
Payme's datetime format is in the format: YYYY-MM-DD HH:MM:SS.ssssss
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
datatime (datetime): The datetime object to convert.
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
str: The datetime object in Payme's datetime format.
|
|
15
|
+
"""
|
|
16
|
+
if not datatime:
|
|
17
|
+
return 0
|
|
18
|
+
|
|
19
|
+
return int(datatime.timestamp() * 1000)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def time_to_service(milliseconds: int) -> datetime:
|
|
23
|
+
"""
|
|
24
|
+
Converts milliseconds since the epoch to a datetime object.
|
|
25
|
+
"""
|
|
26
|
+
return datetime.fromtimestamp(milliseconds / 1000)
|
payme_pkg-3.0.5/payme/const.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Payme enumerations
|
|
3
|
-
"""
|
|
4
|
-
from enum import Enum
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Methods(str, Enum):
|
|
8
|
-
"""
|
|
9
|
-
The enumeration of create transaction methods.
|
|
10
|
-
|
|
11
|
-
Available Methods:
|
|
12
|
-
- GET_STATEMENT: Fetches transaction statement.
|
|
13
|
-
- CHECK_TRANSACTION: Checks a transaction.
|
|
14
|
-
- CREATE_TRANSACTION: Creates a new transaction.
|
|
15
|
-
- CANCEL_TRANSACTION: Cancels an existing transaction.
|
|
16
|
-
- PERFORM_TRANSACTION: Performs a transaction.
|
|
17
|
-
- CHECK_PERFORM_TRANSACTION: Checks if the transaction can be performed.
|
|
18
|
-
"""
|
|
19
|
-
GET_STATEMENT = "GetStatement"
|
|
20
|
-
CHECK_TRANSACTION = "CheckTransaction"
|
|
21
|
-
CREATE_TRANSACTION = "CreateTransaction"
|
|
22
|
-
CANCEL_TRANSACTION = "CancelTransaction"
|
|
23
|
-
PERFORM_TRANSACTION = "PerformTransaction"
|
|
24
|
-
CHECK_PERFORM_TRANSACTION = "CheckPerformTransaction"
|
|
25
|
-
|
|
26
|
-
def __str__(self):
|
|
27
|
-
return str(self.value)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class Networks(str, Enum):
|
|
31
|
-
"""
|
|
32
|
-
Payme networks
|
|
33
|
-
"""
|
|
34
|
-
PROD_NET = "https://checkout.paycom.uz/api"
|
|
35
|
-
TEST_NET = "https://checkout.test.paycom.uz/api"
|
payme_pkg-3.0.5/payme/util.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
from functools import wraps
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import get_type_hints
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def time_to_payme(datatime) -> int:
|
|
7
|
-
"""
|
|
8
|
-
Convert datetime object to Payme's datetime format.
|
|
9
|
-
|
|
10
|
-
Payme's datetime format is in the format: YYYY-MM-DD HH:MM:SS.ssssss
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
datatime (datetime): The datetime object to convert.
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
str: The datetime object in Payme's datetime format.
|
|
17
|
-
"""
|
|
18
|
-
if not datatime:
|
|
19
|
-
return 0
|
|
20
|
-
|
|
21
|
-
return int(datatime.timestamp() * 1000)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def time_to_service(milliseconds: int) -> datetime:
|
|
25
|
-
"""
|
|
26
|
-
Converts milliseconds since the epoch to a datetime object.
|
|
27
|
-
"""
|
|
28
|
-
return datetime.fromtimestamp(milliseconds / 1000)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def input_type_checker(func):
|
|
32
|
-
"""
|
|
33
|
-
input type checker decorator helps to
|
|
34
|
-
validate the input types of the function before executing it.
|
|
35
|
-
"""
|
|
36
|
-
@wraps(func)
|
|
37
|
-
def wrapper(*args, **kwargs):
|
|
38
|
-
"""
|
|
39
|
-
Get the type hints of the function
|
|
40
|
-
"""
|
|
41
|
-
hints = get_type_hints(func)
|
|
42
|
-
|
|
43
|
-
all_args = kwargs.copy()
|
|
44
|
-
all_args.update(zip(func.__code__.co_varnames, args))
|
|
45
|
-
|
|
46
|
-
for arg_name, arg_type in hints.items():
|
|
47
|
-
if arg_name in all_args and not isinstance(all_args[arg_name], arg_type): # noqa
|
|
48
|
-
raise TypeError(
|
|
49
|
-
f"Argument '{arg_name}' in {func.__name__} must be of type {arg_type.__name__}, " # noqa
|
|
50
|
-
f"but got {type(all_args[arg_name]).__name__}."
|
|
51
|
-
)
|
|
52
|
-
return func(*args, **kwargs)
|
|
53
|
-
return wrapper
|
|
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
|