paytechuz 0.1.1__tar.gz → 0.1.2__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.1.1 → paytechuz-0.1.2}/MANIFEST.in +1 -9
- {paytechuz-0.1.1/paytechuz.egg-info → paytechuz-0.1.2}/PKG-INFO +1 -1
- {paytechuz-0.1.1 → paytechuz-0.1.2/paytechuz.egg-info}/PKG-INFO +1 -1
- paytechuz-0.1.2/paytechuz.egg-info/SOURCES.txt +40 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2}/setup.py +6 -4
- {paytechuz-0.1.1/paytechuz → paytechuz-0.1.2/src}/__init__.py +26 -14
- paytechuz-0.1.2/src/integrations/django/migrations/0001_initial.py +51 -0
- paytechuz-0.1.2/src/integrations/django/migrations/__init__.py +3 -0
- paytechuz-0.1.1/paytechuz.egg-info/SOURCES.txt +0 -39
- paytechuz-0.1.1/tests/test_gateway.py +0 -70
- {paytechuz-0.1.1 → paytechuz-0.1.2}/README.md +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2}/paytechuz.egg-info/dependency_links.txt +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2}/paytechuz.egg-info/requires.txt +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2}/paytechuz.egg-info/top_level.txt +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2}/setup.cfg +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/base.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/constants.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/exceptions.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/http.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/payme/errors.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/core/utils.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/click/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/click/client.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/click/merchant.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/click/webhook.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/payme/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/payme/cards.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/payme/client.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/payme/receipts.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/gateways/payme/webhook.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/admin.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/apps.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/models.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/signals.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/views.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/django/webhooks.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/fastapi/__init__.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/fastapi/models.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/fastapi/routes.py +0 -0
- {paytechuz-0.1.1 → paytechuz-0.1.2/src}/integrations/fastapi/schemas.py +0 -0
|
@@ -3,15 +3,7 @@ include README.md
|
|
|
3
3
|
include PYPI_UPLOAD.md
|
|
4
4
|
|
|
5
5
|
# Include all Python files
|
|
6
|
-
include
|
|
7
|
-
include core/payme/*.py
|
|
8
|
-
include gateways/*.py
|
|
9
|
-
include gateways/payme/*.py
|
|
10
|
-
include gateways/click/*.py
|
|
11
|
-
include integrations/*.py
|
|
12
|
-
include integrations/django/*.py
|
|
13
|
-
include integrations/fastapi/*.py
|
|
14
|
-
include integrations/flask/*.py
|
|
6
|
+
recursive-include src *.py
|
|
15
7
|
|
|
16
8
|
# Include examples
|
|
17
9
|
recursive-include examples *
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
paytechuz.egg-info/PKG-INFO
|
|
5
|
+
paytechuz.egg-info/SOURCES.txt
|
|
6
|
+
paytechuz.egg-info/dependency_links.txt
|
|
7
|
+
paytechuz.egg-info/requires.txt
|
|
8
|
+
paytechuz.egg-info/top_level.txt
|
|
9
|
+
src/__init__.py
|
|
10
|
+
src/core/__init__.py
|
|
11
|
+
src/core/base.py
|
|
12
|
+
src/core/constants.py
|
|
13
|
+
src/core/exceptions.py
|
|
14
|
+
src/core/http.py
|
|
15
|
+
src/core/utils.py
|
|
16
|
+
src/core/payme/errors.py
|
|
17
|
+
src/gateways/__init__.py
|
|
18
|
+
src/gateways/click/__init__.py
|
|
19
|
+
src/gateways/click/client.py
|
|
20
|
+
src/gateways/click/merchant.py
|
|
21
|
+
src/gateways/click/webhook.py
|
|
22
|
+
src/gateways/payme/__init__.py
|
|
23
|
+
src/gateways/payme/cards.py
|
|
24
|
+
src/gateways/payme/client.py
|
|
25
|
+
src/gateways/payme/receipts.py
|
|
26
|
+
src/gateways/payme/webhook.py
|
|
27
|
+
src/integrations/__init__.py
|
|
28
|
+
src/integrations/django/__init__.py
|
|
29
|
+
src/integrations/django/admin.py
|
|
30
|
+
src/integrations/django/apps.py
|
|
31
|
+
src/integrations/django/models.py
|
|
32
|
+
src/integrations/django/signals.py
|
|
33
|
+
src/integrations/django/views.py
|
|
34
|
+
src/integrations/django/webhooks.py
|
|
35
|
+
src/integrations/django/migrations/0001_initial.py
|
|
36
|
+
src/integrations/django/migrations/__init__.py
|
|
37
|
+
src/integrations/fastapi/__init__.py
|
|
38
|
+
src/integrations/fastapi/models.py
|
|
39
|
+
src/integrations/fastapi/routes.py
|
|
40
|
+
src/integrations/fastapi/schemas.py
|
|
@@ -8,7 +8,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name='paytechuz',
|
|
11
|
-
version='0.1.
|
|
11
|
+
version='0.1.2',
|
|
12
12
|
license='MIT',
|
|
13
13
|
author="Muhammadali Akbarov",
|
|
14
14
|
author_email='muhammadali17abc@gmail.com',
|
|
@@ -17,10 +17,12 @@ setup(
|
|
|
17
17
|
long_description_content_type="text/markdown",
|
|
18
18
|
url='https://github.com/Muhammadali-Akbarov/paytechuz',
|
|
19
19
|
|
|
20
|
-
packages=['paytechuz'],
|
|
21
|
-
py_modules=['core', 'gateways', 'integrations'],
|
|
20
|
+
packages=['paytechuz', 'core', 'gateways', 'integrations'],
|
|
22
21
|
package_dir={
|
|
23
|
-
'paytechuz': '
|
|
22
|
+
'paytechuz': 'src',
|
|
23
|
+
'core': 'src/core',
|
|
24
|
+
'gateways': 'src/gateways',
|
|
25
|
+
'integrations': 'src/integrations',
|
|
24
26
|
},
|
|
25
27
|
include_package_data=True,
|
|
26
28
|
package_data={
|
|
@@ -3,21 +3,31 @@
|
|
|
3
3
|
This library provides a unified interface for working with Payme and Click
|
|
4
4
|
payment systems in Uzbekistan. It supports Django, Flask, and FastAPI.
|
|
5
5
|
"""
|
|
6
|
-
|
|
7
6
|
from typing import Any
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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'
|
|
19
30
|
|
|
20
|
-
__version__ = '0.1.0'
|
|
21
31
|
|
|
22
32
|
# Import framework integrations - these imports are used to check availability
|
|
23
33
|
# of frameworks, not for direct usage
|
|
@@ -53,10 +63,12 @@ def create_gateway(gateway_type: str, **kwargs) -> Any:
|
|
|
53
63
|
|
|
54
64
|
Raises:
|
|
55
65
|
ValueError: If the gateway type is not supported
|
|
66
|
+
ImportError: If the required gateway module is not available
|
|
56
67
|
"""
|
|
57
|
-
|
|
68
|
+
# Just use the dummy classes for now
|
|
69
|
+
if gateway_type.lower() == 'payme':
|
|
58
70
|
return PaymeGateway(**kwargs)
|
|
59
|
-
if gateway_type.lower() ==
|
|
71
|
+
if gateway_type.lower() == 'click':
|
|
60
72
|
return ClickGateway(**kwargs)
|
|
61
73
|
|
|
62
74
|
raise ValueError(f"Unsupported gateway type: {gateway_type}")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Initial migration for PaymentTransaction model.
|
|
3
|
+
"""
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
"""
|
|
9
|
+
Initial migration for PaymentTransaction model.
|
|
10
|
+
"""
|
|
11
|
+
initial = True
|
|
12
|
+
|
|
13
|
+
dependencies = []
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.CreateModel(
|
|
17
|
+
name='PaymentTransaction',
|
|
18
|
+
fields=[
|
|
19
|
+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
20
|
+
('gateway', models.CharField(choices=[('payme', 'Payme'), ('click', 'Click')], max_length=10)),
|
|
21
|
+
('transaction_id', models.CharField(max_length=255)),
|
|
22
|
+
('account_id', models.CharField(max_length=255)),
|
|
23
|
+
('amount', models.DecimalField(decimal_places=2, max_digits=15)),
|
|
24
|
+
('state', models.IntegerField(choices=[(0, 'Created'), (1, 'Initiating'), (2, 'Successfully'), (-2, 'Cancelled after successful performed'), (-1, 'Cancelled during initiation')], default=0)),
|
|
25
|
+
('reason', models.IntegerField(blank=True, null=True, help_text='Reason for cancellation')),
|
|
26
|
+
('extra_data', models.JSONField(blank=True, default=dict)),
|
|
27
|
+
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
28
|
+
('updated_at', models.DateTimeField(auto_now=True, db_index=True)),
|
|
29
|
+
('performed_at', models.DateTimeField(blank=True, db_index=True, null=True)),
|
|
30
|
+
('cancelled_at', models.DateTimeField(blank=True, db_index=True, null=True)),
|
|
31
|
+
],
|
|
32
|
+
options={
|
|
33
|
+
'verbose_name': 'Payment Transaction',
|
|
34
|
+
'verbose_name_plural': 'Payment Transactions',
|
|
35
|
+
'db_table': 'payments',
|
|
36
|
+
'ordering': ['-created_at'],
|
|
37
|
+
},
|
|
38
|
+
),
|
|
39
|
+
migrations.AddIndex(
|
|
40
|
+
model_name='paymenttransaction',
|
|
41
|
+
index=models.Index(fields=['account_id'], name='payments_account_d4c2a8_idx'),
|
|
42
|
+
),
|
|
43
|
+
migrations.AddIndex(
|
|
44
|
+
model_name='paymenttransaction',
|
|
45
|
+
index=models.Index(fields=['state'], name='payments_state_e0ceac_idx'),
|
|
46
|
+
),
|
|
47
|
+
migrations.AlterUniqueTogether(
|
|
48
|
+
name='paymenttransaction',
|
|
49
|
+
unique_together={('gateway', 'transaction_id')},
|
|
50
|
+
),
|
|
51
|
+
]
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
MANIFEST.in
|
|
2
|
-
README.md
|
|
3
|
-
setup.py
|
|
4
|
-
core/__init__.py
|
|
5
|
-
core/base.py
|
|
6
|
-
core/constants.py
|
|
7
|
-
core/exceptions.py
|
|
8
|
-
core/http.py
|
|
9
|
-
core/utils.py
|
|
10
|
-
core/payme/errors.py
|
|
11
|
-
gateways/__init__.py
|
|
12
|
-
gateways/click/__init__.py
|
|
13
|
-
gateways/click/client.py
|
|
14
|
-
gateways/click/merchant.py
|
|
15
|
-
gateways/click/webhook.py
|
|
16
|
-
gateways/payme/__init__.py
|
|
17
|
-
gateways/payme/cards.py
|
|
18
|
-
gateways/payme/client.py
|
|
19
|
-
gateways/payme/receipts.py
|
|
20
|
-
gateways/payme/webhook.py
|
|
21
|
-
integrations/__init__.py
|
|
22
|
-
integrations/django/__init__.py
|
|
23
|
-
integrations/django/admin.py
|
|
24
|
-
integrations/django/apps.py
|
|
25
|
-
integrations/django/models.py
|
|
26
|
-
integrations/django/signals.py
|
|
27
|
-
integrations/django/views.py
|
|
28
|
-
integrations/django/webhooks.py
|
|
29
|
-
integrations/fastapi/__init__.py
|
|
30
|
-
integrations/fastapi/models.py
|
|
31
|
-
integrations/fastapi/routes.py
|
|
32
|
-
integrations/fastapi/schemas.py
|
|
33
|
-
paytechuz/__init__.py
|
|
34
|
-
paytechuz.egg-info/PKG-INFO
|
|
35
|
-
paytechuz.egg-info/SOURCES.txt
|
|
36
|
-
paytechuz.egg-info/dependency_links.txt
|
|
37
|
-
paytechuz.egg-info/requires.txt
|
|
38
|
-
paytechuz.egg-info/top_level.txt
|
|
39
|
-
tests/test_gateway.py
|
|
@@ -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
|
|
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
|