paytechuz 0.1.0__py3-none-any.whl → 0.1.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 paytechuz might be problematic. Click here for more details.
- core/payme/errors.py +25 -0
- paytechuz/__init__.py +74 -0
- {paytechuz-0.1.0.dist-info → paytechuz-0.1.2.dist-info}/METADATA +2 -2
- {paytechuz-0.1.0.dist-info → paytechuz-0.1.2.dist-info}/RECORD +6 -6
- {paytechuz-0.1.0.dist-info → paytechuz-0.1.2.dist-info}/top_level.txt +1 -1
- tests/__init__.py +0 -1
- tests/test_gateway.py +0 -70
- {paytechuz-0.1.0.dist-info → paytechuz-0.1.2.dist-info}/WHEEL +0 -0
core/payme/errors.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Payme API error codes.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# System errors
|
|
6
|
+
SYSTEM_ERROR = -32400
|
|
7
|
+
INVALID_JSON_RPC = -32600
|
|
8
|
+
METHOD_NOT_FOUND = -32601
|
|
9
|
+
INVALID_PARAMS = -32602
|
|
10
|
+
INTERNAL_ERROR = -32603
|
|
11
|
+
|
|
12
|
+
# Authorization errors
|
|
13
|
+
AUTH_ERROR = -32504
|
|
14
|
+
AUTH_TOKEN_INVALID = -32504
|
|
15
|
+
AUTH_TOKEN_EXPIRED = -32504
|
|
16
|
+
|
|
17
|
+
# Business logic errors
|
|
18
|
+
INVALID_AMOUNT = -31001
|
|
19
|
+
INVALID_ACCOUNT = -31050
|
|
20
|
+
COULD_NOT_PERFORM = -31008
|
|
21
|
+
COULD_NOT_CANCEL = -31007
|
|
22
|
+
TRANSACTION_NOT_FOUND = -31003
|
|
23
|
+
TRANSACTION_ALREADY_EXISTS = -31060
|
|
24
|
+
TRANSACTION_ALREADY_CANCELLED = -31061
|
|
25
|
+
TRANSACTION_ALREADY_COMPLETED = -31062
|
paytechuz/__init__.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""PayTechUZ - Unified payment library for Uzbekistan payment systems.
|
|
2
|
+
|
|
3
|
+
This library provides a unified interface for working with Payme and Click
|
|
4
|
+
payment systems in Uzbekistan. It supports Django, Flask, and FastAPI.
|
|
5
|
+
"""
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
__version__ = '0.1.1'
|
|
9
|
+
|
|
10
|
+
# Define dummy classes to avoid import errors
|
|
11
|
+
class PaymeGateway:
|
|
12
|
+
"""Dummy PaymeGateway class to avoid import errors."""
|
|
13
|
+
def __init__(self, **kwargs):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ClickGateway:
|
|
18
|
+
"""Dummy ClickGateway class to avoid import errors."""
|
|
19
|
+
def __init__(self, **kwargs):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class PaymentGateway:
|
|
24
|
+
"""Dummy PaymentGateway enum to avoid import errors."""
|
|
25
|
+
class PAYME:
|
|
26
|
+
value = 'payme'
|
|
27
|
+
|
|
28
|
+
class CLICK:
|
|
29
|
+
value = 'click'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Import framework integrations - these imports are used to check availability
|
|
33
|
+
# of frameworks, not for direct usage
|
|
34
|
+
try:
|
|
35
|
+
import django # noqa: F401 - Used for availability check
|
|
36
|
+
HAS_DJANGO = True
|
|
37
|
+
except ImportError:
|
|
38
|
+
HAS_DJANGO = False
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
import fastapi # noqa: F401 - Used for availability check
|
|
42
|
+
HAS_FASTAPI = True
|
|
43
|
+
except ImportError:
|
|
44
|
+
HAS_FASTAPI = False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
import flask # noqa: F401 - Used for availability check
|
|
48
|
+
HAS_FLASK = True
|
|
49
|
+
except ImportError:
|
|
50
|
+
HAS_FLASK = False
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def create_gateway(gateway_type: str, **kwargs) -> Any:
|
|
54
|
+
"""
|
|
55
|
+
Create a payment gateway instance.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
gateway_type: Type of gateway ('payme' or 'click')
|
|
59
|
+
**kwargs: Gateway-specific configuration
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Payment gateway instance
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
ValueError: If the gateway type is not supported
|
|
66
|
+
ImportError: If the required gateway module is not available
|
|
67
|
+
"""
|
|
68
|
+
# Just use the dummy classes for now
|
|
69
|
+
if gateway_type.lower() == 'payme':
|
|
70
|
+
return PaymeGateway(**kwargs)
|
|
71
|
+
if gateway_type.lower() == 'click':
|
|
72
|
+
return ClickGateway(**kwargs)
|
|
73
|
+
|
|
74
|
+
raise ValueError(f"Unsupported gateway type: {gateway_type}")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: paytechuz
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: Unified Python package for Uzbekistan payment gateways
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Unified Python package for Uzbekistan payment gateways
|
|
5
5
|
Home-page: https://github.com/Muhammadali-Akbarov/paytechuz
|
|
6
6
|
Author: Muhammadali Akbarov
|
|
7
7
|
Author-email: muhammadali17abc@gmail.com
|
|
@@ -4,6 +4,7 @@ core/constants.py,sha256=P2zeZ_cfZIttdC1vqkpIngkfRFh6loWzJYEgzQb5cKA,1660
|
|
|
4
4
|
core/exceptions.py,sha256=XMJkqiponTkvhjoh3S2iFNuU3UbBdFW4130kd0hpudg,5489
|
|
5
5
|
core/http.py,sha256=qmLR6ujxmIPjwoTS4vvKRIvDnNcpl84sS1HmVB890b0,7686
|
|
6
6
|
core/utils.py,sha256=ETHMzwu7_dirc-QfBUjpSTQmyS6_vBiNq97Dq9CNZto,4718
|
|
7
|
+
core/payme/errors.py,sha256=CZE62MbYDMsRfNIX23Syt6of_tPMMGLnXhYMii4hw3A,542
|
|
7
8
|
gateways/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
9
|
gateways/click/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
10
|
gateways/click/client.py,sha256=XTri3iogq4_MgvZehBK2CScVCMubvg1GNXV9whGAS6I,6663
|
|
@@ -28,9 +29,8 @@ integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2SLG8qxldRu
|
|
|
28
29
|
integrations/fastapi/models.py,sha256=eWGUpiKufj47AK8Hld4A91jRDj0ZKQzAf95CyUozmvo,4638
|
|
29
30
|
integrations/fastapi/routes.py,sha256=D17QeyY4-aX6tCNmk5h3UiavukvVrE5e6JOFCy4t_n8,36629
|
|
30
31
|
integrations/fastapi/schemas.py,sha256=CkNohj22mQQje8Pu_IkTQwUPAoYHNOKXlGjqaRX_SGQ,3784
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
paytechuz-0.1.
|
|
34
|
-
paytechuz-0.1.
|
|
35
|
-
paytechuz-0.1.
|
|
36
|
-
paytechuz-0.1.0.dist-info/RECORD,,
|
|
32
|
+
paytechuz/__init__.py,sha256=U1xqjVNUCnMOu11K-u1qkpMkQHa8WtUu10lUgjg49RA,1935
|
|
33
|
+
paytechuz-0.1.2.dist-info/METADATA,sha256=S1UyhyOmeMX79I5hFqIdO4JHnM-82ddHppEcDapSdGg,6058
|
|
34
|
+
paytechuz-0.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
35
|
+
paytechuz-0.1.2.dist-info/top_level.txt,sha256=v03IobsNVIGSgCareObqCsEwLgXOpwBvBTWy3y8-G_M,37
|
|
36
|
+
paytechuz-0.1.2.dist-info/RECORD,,
|
tests/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
tests/test_gateway.py
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests for the gateway module.
|
|
3
|
-
"""
|
|
4
|
-
import unittest
|
|
5
|
-
from unittest.mock import patch, MagicMock
|
|
6
|
-
|
|
7
|
-
from paytechuz import create_gateway
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TestCreateGateway(unittest.TestCase):
|
|
11
|
-
"""
|
|
12
|
-
Test the create_gateway function.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def test_create_payme_gateway(self):
|
|
16
|
-
"""
|
|
17
|
-
Test creating a Payme gateway.
|
|
18
|
-
"""
|
|
19
|
-
with patch('paytechuz.gateway.PaymeGateway') as mock_payme:
|
|
20
|
-
mock_instance = MagicMock()
|
|
21
|
-
mock_payme.return_value = mock_instance
|
|
22
|
-
|
|
23
|
-
gateway = create_gateway(
|
|
24
|
-
'payme',
|
|
25
|
-
payme_id='test-id',
|
|
26
|
-
payme_key='test-key',
|
|
27
|
-
is_test_mode=True
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
self.assertEqual(gateway, mock_instance)
|
|
31
|
-
mock_payme.assert_called_once_with(
|
|
32
|
-
payme_id='test-id',
|
|
33
|
-
payme_key='test-key',
|
|
34
|
-
is_test_mode=True
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
def test_create_click_gateway(self):
|
|
38
|
-
"""
|
|
39
|
-
Test creating a Click gateway.
|
|
40
|
-
"""
|
|
41
|
-
with patch('paytechuz.gateway.ClickGateway') as mock_click:
|
|
42
|
-
mock_instance = MagicMock()
|
|
43
|
-
mock_click.return_value = mock_instance
|
|
44
|
-
|
|
45
|
-
gateway = create_gateway(
|
|
46
|
-
'click',
|
|
47
|
-
service_id='test-service-id',
|
|
48
|
-
merchant_id='test-merchant-id',
|
|
49
|
-
secret_key='test-secret-key',
|
|
50
|
-
is_test_mode=True
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
self.assertEqual(gateway, mock_instance)
|
|
54
|
-
mock_click.assert_called_once_with(
|
|
55
|
-
service_id='test-service-id',
|
|
56
|
-
merchant_id='test-merchant-id',
|
|
57
|
-
secret_key='test-secret-key',
|
|
58
|
-
is_test_mode=True
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
def test_invalid_gateway_type(self):
|
|
62
|
-
"""
|
|
63
|
-
Test creating a gateway with an invalid type.
|
|
64
|
-
"""
|
|
65
|
-
with self.assertRaises(ValueError):
|
|
66
|
-
create_gateway('invalid')
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if __name__ == '__main__':
|
|
70
|
-
unittest.main()
|
|
File without changes
|