paytechuz 0.2.0b0__py3-none-any.whl → 0.2.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.

paytechuz/__init__.py CHANGED
@@ -6,7 +6,7 @@ payment systems in Uzbekistan. It supports Django, Flask, and FastAPI.
6
6
  """
7
7
  from typing import Any
8
8
 
9
- __version__ = '0.2.0-beta'
9
+ __version__ = '0.2.2'
10
10
 
11
11
  # Import framework integrations - these imports are used to check availability
12
12
  # of frameworks, not for direct usage
@@ -28,46 +28,13 @@ try:
28
28
  except ImportError:
29
29
  HAS_FLASK = False
30
30
 
31
-
32
- # Import the main classes for easier access
33
- try:
34
- from paytechuz.gateways.payme.client import PaymeGateway # noqa: E402
35
- from paytechuz.gateways.click.client import ClickGateway # noqa: E402
36
- from paytechuz.core.constants import PaymentGateway # noqa: E402
37
- except ImportError:
38
- # Fallback for development mode
39
- try:
40
- from .gateways.payme.client import PaymeGateway # noqa: E402
41
- from .gateways.click.client import ClickGateway # noqa: E402
42
- from .core.constants import PaymentGateway # noqa: E402
43
- except ImportError:
44
- # Dummy classes to avoid import errors
45
- class PaymeGateway:
46
- """Dummy PaymeGateway class to avoid import errors."""
47
- def __init__(self, **kwargs):
48
- pass
49
-
50
- def create_payment(self, **kwargs):
51
- return "https://test.paycom.uz/dummy-payment-url"
52
-
53
- class ClickGateway:
54
- """Dummy ClickGateway class to avoid import errors."""
55
- def __init__(self, **kwargs):
56
- pass
57
-
58
- def create_payment(self, **kwargs):
59
- return {"payment_url": "https://my.click.uz/dummy-payment-url"}
60
-
61
- class PaymentGateway:
62
- """Dummy PaymentGateway enum to avoid import errors."""
63
- class PAYME:
64
- value = 'payme'
65
-
66
- class CLICK:
67
- value = 'click'
31
+ from paytechuz.core.base import BasePaymentGateway # noqa: E402
32
+ from paytechuz.gateways.payme.client import PaymeGateway # noqa: E402
33
+ from paytechuz.gateways.click.client import ClickGateway # noqa: E402
34
+ from paytechuz.core.constants import PaymentGateway # noqa: E402
68
35
 
69
36
 
70
- def create_gateway(gateway_type: str, **kwargs) -> Any:
37
+ def create_gateway(gateway_type: str, **kwargs) -> BasePaymentGateway:
71
38
  """
72
39
  Create a payment gateway instance.
73
40
 
@@ -4,20 +4,21 @@ Click payment gateway client.
4
4
  import logging
5
5
  from typing import Dict, Any, Optional, Union
6
6
 
7
- from ....core.base import BasePaymentGateway
8
- from ....core.http import HttpClient
9
- from ....core.constants import ClickNetworks
10
- from ....core.utils import format_amount, handle_exceptions
7
+ from paytechuz.core.base import BasePaymentGateway
8
+ from paytechuz.core.http import HttpClient
9
+ from paytechuz.core.constants import ClickNetworks
10
+ from paytechuz.core.utils import format_amount, handle_exceptions
11
11
  from .merchant import ClickMerchantApi
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
+
15
16
  class ClickGateway(BasePaymentGateway):
16
17
  """
17
18
  Click payment gateway implementation.
18
19
 
19
20
  This class provides methods for interacting with the Click payment gateway,
20
- including creating payments, checking payment status, and canceling payments.
21
+ including creating payments, checking payment status, and canceling payments. # noqa
21
22
  """
22
23
 
23
24
  def __init__(
@@ -45,7 +46,7 @@ class ClickGateway(BasePaymentGateway):
45
46
  self.secret_key = secret_key
46
47
 
47
48
  # Set the API URL based on the environment
48
- url = ClickNetworks.TEST_NET if is_test_mode else ClickNetworks.PROD_NET
49
+ url = ClickNetworks.TEST_NET if is_test_mode else ClickNetworks.PROD_NET # noqa
49
50
 
50
51
  # Initialize HTTP client
51
52
  self.http_client = HttpClient(base_url=url)
@@ -80,13 +81,13 @@ class ClickGateway(BasePaymentGateway):
80
81
  - email: Customer email
81
82
 
82
83
  Returns:
83
- Dict containing payment details including transaction ID and payment URL
84
+ Dict containing payment details including transaction ID and payment URL # noqa
84
85
  """
85
86
  # Format amount to tiyin (1 som = 100 tiyin)
86
87
  amount_tiyin = format_amount(amount)
87
88
 
88
89
  # Extract additional parameters
89
- description = kwargs.get('description', f'Payment for account {account_id}')
90
+ description = kwargs.get('description', f'Payment for account {account_id}') # noqa
90
91
  return_url = kwargs.get('return_url')
91
92
  callback_url = kwargs.get('callback_url')
92
93
  # These parameters are not used in the URL but are available in the API
@@ -138,7 +139,7 @@ class ClickGateway(BasePaymentGateway):
138
139
  # Format: click_account_id_amount
139
140
  parts = transaction_id.split('_')
140
141
  if len(parts) < 3 or parts[0] != 'click':
141
- raise ValueError(f"Invalid transaction ID format: {transaction_id}")
142
+ raise ValueError(f"Invalid transaction ID format: {transaction_id}") # noqa
142
143
 
143
144
  account_id = parts[1]
144
145
 
@@ -187,7 +188,7 @@ class ClickGateway(BasePaymentGateway):
187
188
  # Format: click_account_id_amount
188
189
  parts = transaction_id.split('_')
189
190
  if len(parts) < 3 or parts[0] != 'click':
190
- raise ValueError(f"Invalid transaction ID format: {transaction_id}")
191
+ raise ValueError(f"Invalid transaction ID format: {transaction_id}") # noqa
191
192
 
192
193
  account_id = parts[1]
193
194
 
@@ -5,12 +5,13 @@ import hashlib
5
5
  import logging
6
6
  from typing import Dict, Any, Optional, Union
7
7
 
8
- from ....core.http import HttpClient
9
- from ....core.constants import ClickEndpoints
10
- from ....core.utils import handle_exceptions, generate_timestamp
8
+ from paytechuz.core.http import HttpClient
9
+ from paytechuz.core.constants import ClickEndpoints
10
+ from paytechuz.core.utils import handle_exceptions, generate_timestamp
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
13
 
14
+
14
15
  class ClickMerchantApi:
15
16
  """
16
17
  Click merchant API operations.
@@ -4,12 +4,13 @@ Payme cards operations.
4
4
  import logging
5
5
  from typing import Dict, Any
6
6
 
7
- from ....core.http import HttpClient
8
- from ....core.constants import PaymeEndpoints
9
- from ....core.utils import handle_exceptions
7
+ from paytechuz.core.http import HttpClient
8
+ from paytechuz.core.constants import PaymeEndpoints
9
+ from paytechuz.core.utils import handle_exceptions
10
10
 
11
11
  logger = logging.getLogger(__name__)
12
12
 
13
+
13
14
  class PaymeCards:
14
15
  """
15
16
  Payme cards operations.
@@ -5,10 +5,11 @@ import logging
5
5
  from typing import Dict, Any, Optional, Union
6
6
  import base64
7
7
 
8
- from ....core.base import BasePaymentGateway
9
- from ....core.http import HttpClient
10
- from ....core.constants import PaymeNetworks
11
- from ....core.utils import format_amount, handle_exceptions
8
+ from paytechuz.core.base import BasePaymentGateway
9
+ from paytechuz.core.http import HttpClient
10
+ from paytechuz.core.constants import PaymeNetworks
11
+ from paytechuz.core.utils import format_amount, handle_exceptions
12
+
12
13
  from .cards import PaymeCards
13
14
  from .receipts import PaymeReceipts
14
15
 
@@ -5,12 +5,13 @@ Payme receipts operations.
5
5
  import logging
6
6
  from typing import Dict, Any, Optional
7
7
 
8
- from ....core.http import HttpClient
9
- from ....core.constants import PaymeEndpoints
10
- from ....core.utils import handle_exceptions, generate_basic_auth
8
+ from paytechuz.core.http import HttpClient
9
+ from paytechuz.core.constants import PaymeEndpoints
10
+ from paytechuz.core.utils import handle_exceptions, generate_basic_auth
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
13
 
14
+
14
15
  class PaymeReceipts:
15
16
  """
16
17
  Payme receipts operations.
@@ -1,4 +1,10 @@
1
1
  """
2
2
  Django integration for PayTechUZ.
3
3
  """
4
+ # Register the app configuration
4
5
  default_app_config = 'paytechuz.integrations.django.apps.PaytechuzConfig'
6
+
7
+ # This is used to prevent Django from creating new migrations
8
+ # when the model changes. Instead, users should use the provided
9
+ # migration or create their own if needed.
10
+ PAYTECHUZ_PREVENT_MIGRATIONS = True
@@ -3,6 +3,7 @@ Django app configuration for PayTechUZ.
3
3
  """
4
4
  from django.apps import AppConfig
5
5
 
6
+
6
7
  class PaytechuzConfig(AppConfig):
7
8
  """
8
9
  Django app configuration for PayTechUZ.
@@ -10,6 +11,10 @@ class PaytechuzConfig(AppConfig):
10
11
  name = 'paytechuz.integrations.django'
11
12
  verbose_name = 'PayTechUZ'
12
13
 
14
+ # This is important - it tells Django to use our migrations
15
+ # but not to create new ones automatically
16
+ default_auto_field = 'django.db.models.AutoField'
17
+
13
18
  def ready(self):
14
19
  """
15
20
  Initialize the app.
@@ -34,6 +34,7 @@ class Migration(migrations.Migration):
34
34
  'verbose_name_plural': 'Payment Transactions',
35
35
  'db_table': 'payments',
36
36
  'ordering': ['-created_at'],
37
+ 'managed': False,
37
38
  },
38
39
  ),
39
40
  migrations.AddIndex(
@@ -58,6 +58,9 @@ class PaymentTransaction(models.Model):
58
58
  models.Index(fields=['account_id']),
59
59
  models.Index(fields=['state']),
60
60
  ]
61
+ # This is important - it tells Django not to manage this model
62
+ # which means no migrations will be created for it
63
+ managed = False
61
64
 
62
65
  def __str__(self):
63
66
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paytechuz
3
- Version: 0.2.0b0
3
+ Version: 0.2.2
4
4
  Summary: Unified Python package for Uzbekistan payment gateways
5
5
  Home-page: https://github.com/Muhammadali-Akbarov/paytechuz
6
6
  Author: Muhammadali Akbarov
@@ -1,4 +1,4 @@
1
- paytechuz/__init__.py,sha256=IpHrtevEvKObpWfZjT286sZSEYFJyzSYfiZAiIm0CYE,2856
1
+ paytechuz/__init__.py,sha256=FDe29y0Xs8ar0t0pvOMbFUmOkty_sqxuNvl3_VyYR6s,1753
2
2
  paytechuz/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  paytechuz/core/base.py,sha256=pW_0QrlyX0F8XVToeeDEI78ygAF2IgvvvyUGYMHH9bs,2565
4
4
  paytechuz/core/constants.py,sha256=P2zeZ_cfZIttdC1vqkpIngkfRFh6loWzJYEgzQb5cKA,1660
@@ -8,29 +8,29 @@ paytechuz/core/utils.py,sha256=EbNtDweR1ABOtCu4D6cYlolM0t_fbiE3gNoc_qfcKKA,4704
8
8
  paytechuz/core/payme/errors.py,sha256=CZE62MbYDMsRfNIX23Syt6of_tPMMGLnXhYMii4hw3A,542
9
9
  paytechuz/gateways/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  paytechuz/gateways/click/__init__.py,sha256=35RPIrZYHgMWDzxjQkJMZYjzHDa8cY_BqQztCdZZmBM,90
11
- paytechuz/gateways/click/client.py,sha256=YWvgkBoBeZf9SIYi09kIMiiWkf6M5wbR4Jc8k1z5mRA,6615
12
- paytechuz/gateways/click/merchant.py,sha256=9xbn7LD7CMBE0k6h5AVcsWpDjOaWudhxvf2QrmqbkoA,7236
11
+ paytechuz/gateways/click/client.py,sha256=NC9bHP2A_9ZagE1G4OBrckvefLhyALzs76tzKoc6x8U,6682
12
+ paytechuz/gateways/click/merchant.py,sha256=d8YUaxm5X51xFtI2_M6xtjZ-L2BvbU0T9YTJwodF7gU,7255
13
13
  paytechuz/gateways/click/webhook.py,sha256=rph-NmjjnBKMW4rcxQTXrHHdK-uMrU39kXnbqK56leo,7936
14
14
  paytechuz/gateways/payme/__init__.py,sha256=KcVkYvAEblL4ASVAOrUofRBwywAkTZIgRXoBaCbYtv8,90
15
- paytechuz/gateways/payme/cards.py,sha256=0uAfPD5tZZg0puqOjkodcWUxhMgqKeyvFpgenruMuSQ,5402
16
- paytechuz/gateways/payme/client.py,sha256=TK1ZwWHcabbPiRujbPOTFchPSjyt7V13KP6xfCgSm2A,7783
17
- paytechuz/gateways/payme/receipts.py,sha256=uLoFpowIqZtj3lPWmUvmpBEGfhwAPWt5Sl16OJHfiEI,8886
15
+ paytechuz/gateways/payme/cards.py,sha256=iyitnAIQ_BUNmF273ErSLe3GOs5LYp3pWHxdb_FtOzs,5421
16
+ paytechuz/gateways/payme/client.py,sha256=fmFHbgWX0UG7246JgA8tWougzAbw75QTWC9mw_TgvZI,7808
17
+ paytechuz/gateways/payme/receipts.py,sha256=DFIoD2EW65sStgeNP75GrUCcuvn7H7PPc415pw4S79g,8905
18
18
  paytechuz/gateways/payme/webhook.py,sha256=-0O8vzMtiu4U8FWFKDA6EfyoX4NEGqcEq-T0yNtVhM4,12374
19
19
  paytechuz/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- paytechuz/integrations/django/__init__.py,sha256=YDgD1Ux1E3CJxQMT-9tulhXmuLOEaUSv320LeaVgJ00,116
20
+ paytechuz/integrations/django/__init__.py,sha256=fNs4c2IWpCe78-_Yvgz59TdKbHiYRYDkLR33QOBf-Ok,356
21
21
  paytechuz/integrations/django/admin.py,sha256=6fs6GiKcdc-hGlLxJ0BthY7TFo_2RVVJRhQwhxMroCY,2664
22
- paytechuz/integrations/django/apps.py,sha256=57svd2aqSuoASWMI3Jnh70ZXrYN1oQ8EnvLl_5LNyl0,473
23
- paytechuz/integrations/django/models.py,sha256=83PjBnombavEjfPm2EcVFo2R5BO6VRIjp0MlNCp-fbg,5819
22
+ paytechuz/integrations/django/apps.py,sha256=Q9wG2osL7_Ip2BcAkq7lmmhu4UKJAg6UtSsSq_RgHlc,640
23
+ paytechuz/integrations/django/models.py,sha256=D_k9u8LIhLZMfYnZmpPln8hDl825fHy8x2zTAAxFSFA,5973
24
24
  paytechuz/integrations/django/signals.py,sha256=VtNYEAnu13wi9PqadEaCU9LY_k2tY26AS4bnPIAqw7M,1319
25
25
  paytechuz/integrations/django/views.py,sha256=nP2HRMx02tMbdv_KfDqIA5vQAwZ6TUuZazrZ2zoNfqQ,3029
26
26
  paytechuz/integrations/django/webhooks.py,sha256=cP_Jc3VlyyvyzDbBd2yEVHikw60th1_-L9_vtsRfwgs,31335
27
- paytechuz/integrations/django/migrations/0001_initial.py,sha256=YLDUp1w0V3Zvuz5TssQDrx3PlccduoHqdLD109Hg8Z4,2326
27
+ paytechuz/integrations/django/migrations/0001_initial.py,sha256=V6qFqnG3iinl71YL0xXJXs_2sAfDO05eZMN0HstwPVU,2360
28
28
  paytechuz/integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
29
29
  paytechuz/integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2SLG8qxldRuwR4,565
30
30
  paytechuz/integrations/fastapi/models.py,sha256=eWGUpiKufj47AK8Hld4A91jRDj0ZKQzAf95CyUozmvo,4638
31
31
  paytechuz/integrations/fastapi/routes.py,sha256=D17QeyY4-aX6tCNmk5h3UiavukvVrE5e6JOFCy4t_n8,36629
32
32
  paytechuz/integrations/fastapi/schemas.py,sha256=CkNohj22mQQje8Pu_IkTQwUPAoYHNOKXlGjqaRX_SGQ,3784
33
- paytechuz-0.2.0b0.dist-info/METADATA,sha256=tuyIUwQnsBhIXLE9vJNz3IqLsufiYnIJT_-H51BE1Wc,4151
34
- paytechuz-0.2.0b0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
35
- paytechuz-0.2.0b0.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
36
- paytechuz-0.2.0b0.dist-info/RECORD,,
33
+ paytechuz-0.2.2.dist-info/METADATA,sha256=ReMyrQEv06grF0XDl6yhn1Z362ql-HRciqUSyaKh9CQ,4149
34
+ paytechuz-0.2.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
35
+ paytechuz-0.2.2.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
36
+ paytechuz-0.2.2.dist-info/RECORD,,