paymentsgate 1.5.0__py3-none-any.whl → 1.5.2__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 paymentsgate might be problematic. Click here for more details.
- paymentsgate/__init__.py +14 -14
- paymentsgate/cache.py +9 -7
- paymentsgate/client.py +270 -110
- paymentsgate/enums.py +60 -59
- paymentsgate/exceptions.py +29 -12
- paymentsgate/logger.py +0 -1
- paymentsgate/mappers.py +0 -1
- paymentsgate/models.py +234 -197
- paymentsgate/signature.py +91 -0
- paymentsgate/tokens.py +7 -4
- paymentsgate/transport.py +12 -6
- paymentsgate/types.py +3 -5
- {paymentsgate-1.5.0.dist-info → paymentsgate-1.5.2.dist-info}/METADATA +5 -4
- paymentsgate-1.5.2.dist-info/RECORD +16 -0
- paymentsgate-1.5.0.dist-info/RECORD +0 -15
- {paymentsgate-1.5.0.dist-info → paymentsgate-1.5.2.dist-info}/LICENSE +0 -0
- {paymentsgate-1.5.0.dist-info → paymentsgate-1.5.2.dist-info}/WHEEL +0 -0
paymentsgate/enums.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
from enum import
|
|
1
|
+
from enum import StrEnum
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
class StrEnum(str, Enum):
|
|
5
|
-
def __str__(self) -> str:
|
|
6
|
-
return self.value
|
|
7
|
-
|
|
8
4
|
class AuthenticationRealms(StrEnum):
|
|
9
5
|
production = "production"
|
|
10
6
|
sandbox = "sandbox"
|
|
11
7
|
|
|
8
|
+
|
|
12
9
|
class ApiPaths(StrEnum):
|
|
13
10
|
token_issue = "/auth/token"
|
|
14
11
|
token_refresh = "/auth/token/refresh"
|
|
@@ -28,6 +25,7 @@ class ApiPaths(StrEnum):
|
|
|
28
25
|
fx_quote = "/fx/calculatenew"
|
|
29
26
|
fx_quote_tlv = "/fx/tlv"
|
|
30
27
|
|
|
28
|
+
|
|
31
29
|
class Currencies(StrEnum):
|
|
32
30
|
USDT = "USDT"
|
|
33
31
|
EUR = "EUR"
|
|
@@ -58,16 +56,17 @@ class Currencies(StrEnum):
|
|
|
58
56
|
NGN = "NGN"
|
|
59
57
|
AMD = "AMD"
|
|
60
58
|
|
|
59
|
+
|
|
61
60
|
class Languages(StrEnum):
|
|
62
|
-
EN = "EN",
|
|
63
|
-
AZ = "AZ",
|
|
64
|
-
UZ = "UZ",
|
|
65
|
-
GE = "GE",
|
|
66
|
-
TR = "TR",
|
|
67
|
-
AE = "AE",
|
|
68
|
-
RU = "RU",
|
|
69
|
-
IN = "IN",
|
|
70
|
-
AR = "AR",
|
|
61
|
+
EN = ("EN",)
|
|
62
|
+
AZ = ("AZ",)
|
|
63
|
+
UZ = ("UZ",)
|
|
64
|
+
GE = ("GE",)
|
|
65
|
+
TR = ("TR",)
|
|
66
|
+
AE = ("AE",)
|
|
67
|
+
RU = ("RU",)
|
|
68
|
+
IN = ("IN",)
|
|
69
|
+
AR = ("AR",)
|
|
71
70
|
KG = "KG"
|
|
72
71
|
|
|
73
72
|
|
|
@@ -82,8 +81,8 @@ class Statuses(StrEnum):
|
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
class CurrencyTypes(StrEnum):
|
|
85
|
-
fiat = "
|
|
86
|
-
crypto = "
|
|
84
|
+
fiat = "FIAT"
|
|
85
|
+
crypto = "CRYPTO"
|
|
87
86
|
|
|
88
87
|
|
|
89
88
|
class InvoiceTypes(StrEnum):
|
|
@@ -122,59 +121,61 @@ class InvoiceTypes(StrEnum):
|
|
|
122
121
|
vodafonecash = "vodafonecash"
|
|
123
122
|
razn = "razn"
|
|
124
123
|
rtjs = "rtjs"
|
|
125
|
-
sberpay = "sberpay",
|
|
126
|
-
tpay = "tpay",
|
|
127
|
-
opay = "opay",
|
|
128
|
-
moniepoint = "moniepoint",
|
|
129
|
-
palmpay = "palmpay",
|
|
130
|
-
wave = "wave",
|
|
131
|
-
orangemoney = "orangemoney",
|
|
132
|
-
moovmoney = "moovmoney",
|
|
133
|
-
rtjscard = "rtjscard",
|
|
134
|
-
ruzs = "ruzs",
|
|
135
|
-
amobile = "amobile",
|
|
136
|
-
payid = "payid",
|
|
137
|
-
baridi = "baridi",
|
|
138
|
-
multiwidget = "multiwidget",
|
|
139
|
-
attijari = "attijari",
|
|
140
|
-
cih = "cih",
|
|
141
|
-
cashplus = "cashplus",
|
|
142
|
-
elqr = "elqr",
|
|
124
|
+
sberpay = ("sberpay",)
|
|
125
|
+
tpay = ("tpay",)
|
|
126
|
+
opay = ("opay",)
|
|
127
|
+
moniepoint = ("moniepoint",)
|
|
128
|
+
palmpay = ("palmpay",)
|
|
129
|
+
wave = ("wave",)
|
|
130
|
+
orangemoney = ("orangemoney",)
|
|
131
|
+
moovmoney = ("moovmoney",)
|
|
132
|
+
rtjscard = ("rtjscard",)
|
|
133
|
+
ruzs = ("ruzs",)
|
|
134
|
+
amobile = ("amobile",)
|
|
135
|
+
payid = ("payid",)
|
|
136
|
+
baridi = ("baridi",)
|
|
137
|
+
multiwidget = ("multiwidget",)
|
|
138
|
+
attijari = ("attijari",)
|
|
139
|
+
cih = ("cih",)
|
|
140
|
+
cashplus = ("cashplus",)
|
|
141
|
+
elqr = ("elqr",)
|
|
143
142
|
odengi = "odengi"
|
|
144
143
|
|
|
144
|
+
|
|
145
145
|
class EELQRBankALias(StrEnum):
|
|
146
|
-
bakai =
|
|
147
|
-
mbank =
|
|
148
|
-
optima =
|
|
149
|
-
kicb =
|
|
150
|
-
odengi =
|
|
151
|
-
demir =
|
|
152
|
-
megapay =
|
|
146
|
+
bakai = ("bakai",)
|
|
147
|
+
mbank = ("mbank",)
|
|
148
|
+
optima = ("optima",)
|
|
149
|
+
kicb = ("kicb",)
|
|
150
|
+
odengi = ("odengi",)
|
|
151
|
+
demir = ("demir",)
|
|
152
|
+
megapay = ("megapay",)
|
|
153
|
+
|
|
153
154
|
|
|
154
155
|
class CredentialsTypes(StrEnum):
|
|
155
|
-
iban = "iban",
|
|
156
|
-
phone = "phone",
|
|
157
|
-
card = "card",
|
|
158
|
-
fps = "fps",
|
|
159
|
-
qr = "qr",
|
|
160
|
-
account = "account",
|
|
156
|
+
iban = ("iban",)
|
|
157
|
+
phone = ("phone",)
|
|
158
|
+
card = ("card",)
|
|
159
|
+
fps = ("fps",)
|
|
160
|
+
qr = ("qr",)
|
|
161
|
+
account = ("account",)
|
|
161
162
|
custom = "custom"
|
|
162
163
|
|
|
163
164
|
|
|
164
165
|
class RiskScoreLevels(StrEnum):
|
|
165
166
|
unclassified = "unclassified"
|
|
166
|
-
hr = "hr"
|
|
167
|
-
ftd = "ftd"
|
|
168
|
-
trusted = "trusted"
|
|
167
|
+
hr = "hr" # highest risk
|
|
168
|
+
ftd = "ftd" # high risk
|
|
169
|
+
trusted = "trusted" # low risk
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
class CancellationReason(StrEnum):
|
|
172
|
-
NO_MONEY = "NO_MONEY",
|
|
173
|
-
CREDENTIALS_INVALID = "CREDENTIALS_INVALID",
|
|
174
|
-
EXPIRED = "EXPIRED",
|
|
175
|
-
PRECHARGE_GAP_UPPER_LIMIT = "PRECHARGE_GAP_UPPER_LIMIT",
|
|
176
|
-
CROSS_BANK_TFF_LESS_THAN_3K = "CROSS_BANK_TFF_LESS_THAN_3K",
|
|
177
|
-
CROSS_BANK_UNSUPPORTED = "CROSS_BANK_UNSUPPORTED",
|
|
173
|
+
NO_MONEY = ("NO_MONEY",)
|
|
174
|
+
CREDENTIALS_INVALID = ("CREDENTIALS_INVALID",)
|
|
175
|
+
EXPIRED = ("EXPIRED",)
|
|
176
|
+
PRECHARGE_GAP_UPPER_LIMIT = ("PRECHARGE_GAP_UPPER_LIMIT",)
|
|
177
|
+
CROSS_BANK_TFF_LESS_THAN_3K = ("CROSS_BANK_TFF_LESS_THAN_3K",)
|
|
178
|
+
CROSS_BANK_UNSUPPORTED = ("CROSS_BANK_UNSUPPORTED",)
|
|
178
179
|
ACCOUNT_NUMBER_BLACKLISTED = "ACCOUNT_NUMBER_BLACKLISTED"
|
|
179
180
|
|
|
180
181
|
|
|
@@ -184,9 +185,9 @@ class FeesStrategy(StrEnum):
|
|
|
184
185
|
|
|
185
186
|
|
|
186
187
|
class InvoiceDirection(StrEnum):
|
|
187
|
-
F2C = "F2C",
|
|
188
|
-
C2F = "C2F",
|
|
189
|
-
FIAT_IN = "FIAT_IN",
|
|
188
|
+
F2C = ("F2C",)
|
|
189
|
+
C2F = ("C2F",)
|
|
190
|
+
FIAT_IN = ("FIAT_IN",)
|
|
190
191
|
FIAT_OUT = "FIAT_OUT"
|
|
191
192
|
|
|
192
193
|
|
paymentsgate/exceptions.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
from paymentsgate.transport import Response
|
|
3
2
|
|
|
4
3
|
|
|
@@ -12,27 +11,45 @@ class APIError(PaymentsgateError):
|
|
|
12
11
|
code: int
|
|
13
12
|
data: object | None
|
|
14
13
|
details: object | None
|
|
15
|
-
|
|
16
|
-
def __init__(
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
error: str,
|
|
18
|
+
message: str,
|
|
19
|
+
data: object | None,
|
|
20
|
+
details: object | None,
|
|
21
|
+
status: int,
|
|
22
|
+
) -> None:
|
|
17
23
|
super().__init__(f"[{error}] {message} (status: {status})")
|
|
18
24
|
self.error = error
|
|
19
25
|
self.message = message
|
|
20
26
|
self.data = data
|
|
21
|
-
self.code = status
|
|
22
|
-
self.details = details
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (data is not None):
|
|
27
|
+
self.code = status
|
|
28
|
+
self.details = details
|
|
29
|
+
if details is not None:
|
|
30
|
+
print("Error details:", self.details)
|
|
31
|
+
if data is not None:
|
|
27
32
|
print(self.data)
|
|
28
33
|
# print(f"{self.error}: {self.message} code: {self.code} details: {self.details}")
|
|
29
|
-
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
class APIResponseError(APIError):
|
|
33
37
|
def __init__(self, response: Response) -> None:
|
|
34
|
-
super().__init__(
|
|
38
|
+
super().__init__(
|
|
39
|
+
response.json_body.get("error"),
|
|
40
|
+
response.json_body.get("message"),
|
|
41
|
+
response.json_body.get("data"),
|
|
42
|
+
response.json_body.get("details"),
|
|
43
|
+
response.status_code,
|
|
44
|
+
)
|
|
45
|
+
|
|
35
46
|
|
|
36
47
|
class APIAuthenticationError(APIError):
|
|
37
48
|
def __init__(self, response: Response) -> None:
|
|
38
|
-
super().__init__(
|
|
49
|
+
super().__init__(
|
|
50
|
+
response.json_body.get("error"),
|
|
51
|
+
response.json_body.get("message"),
|
|
52
|
+
response.json_body.get("data"),
|
|
53
|
+
response.json_body.get("details"),
|
|
54
|
+
response.status_code,
|
|
55
|
+
)
|
paymentsgate/logger.py
CHANGED
paymentsgate/mappers.py
CHANGED