paytechuz 0.1.1__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/__init__.py +0 -0
- core/base.py +88 -0
- core/constants.py +68 -0
- core/exceptions.py +190 -0
- core/http.py +268 -0
- core/payme/errors.py +25 -0
- core/utils.py +192 -0
- gateways/__init__.py +0 -0
- gateways/click/__init__.py +0 -0
- gateways/click/client.py +202 -0
- gateways/click/merchant.py +264 -0
- gateways/click/webhook.py +227 -0
- gateways/payme/__init__.py +0 -0
- gateways/payme/cards.py +222 -0
- gateways/payme/client.py +238 -0
- gateways/payme/receipts.py +336 -0
- gateways/payme/webhook.py +379 -0
- integrations/__init__.py +0 -0
- integrations/django/__init__.py +4 -0
- integrations/django/admin.py +78 -0
- integrations/django/apps.py +21 -0
- integrations/django/migrations/0001_initial.py +51 -0
- integrations/django/migrations/__init__.py +3 -0
- integrations/django/models.py +174 -0
- integrations/django/signals.py +46 -0
- integrations/django/views.py +100 -0
- integrations/django/webhooks.py +880 -0
- integrations/fastapi/__init__.py +21 -0
- integrations/fastapi/models.py +151 -0
- integrations/fastapi/routes.py +1028 -0
- integrations/fastapi/schemas.py +99 -0
- paytechuz/__init__.py +26 -14
- {paytechuz-0.1.1.dist-info → paytechuz-0.1.2.dist-info}/METADATA +1 -1
- paytechuz-0.1.2.dist-info/RECORD +36 -0
- paytechuz-0.1.1.dist-info/RECORD +0 -5
- {paytechuz-0.1.1.dist-info → paytechuz-0.1.2.dist-info}/WHEEL +0 -0
- {paytechuz-0.1.1.dist-info → paytechuz-0.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FastAPI schemas for PayTechUZ.
|
|
3
|
+
"""
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing import Dict, Any, Optional, List
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
|
|
9
|
+
class PaymentTransactionBase(BaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Base schema for payment transaction.
|
|
12
|
+
"""
|
|
13
|
+
gateway: str = Field(..., description="Payment gateway (payme or click)")
|
|
14
|
+
transaction_id: str = Field(..., description="Transaction ID from the payment system")
|
|
15
|
+
account_id: str = Field(..., description="Account or order ID")
|
|
16
|
+
amount: float = Field(..., description="Payment amount")
|
|
17
|
+
state: int = Field(0, description="Transaction state")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PaymentTransactionCreate(PaymentTransactionBase):
|
|
21
|
+
"""
|
|
22
|
+
Schema for creating a payment transaction.
|
|
23
|
+
"""
|
|
24
|
+
extra_data: Optional[Dict[str, Any]] = Field(None, description="Additional data for the transaction")
|
|
25
|
+
|
|
26
|
+
class PaymentTransaction(PaymentTransactionBase):
|
|
27
|
+
"""
|
|
28
|
+
Schema for payment transaction.
|
|
29
|
+
"""
|
|
30
|
+
id: int = Field(..., description="Transaction ID")
|
|
31
|
+
extra_data: Dict[str, Any] = Field({}, description="Additional data for the transaction")
|
|
32
|
+
created_at: datetime = Field(..., description="Creation timestamp")
|
|
33
|
+
updated_at: datetime = Field(..., description="Last update timestamp")
|
|
34
|
+
performed_at: Optional[datetime] = Field(None, description="Payment timestamp")
|
|
35
|
+
cancelled_at: Optional[datetime] = Field(None, description="Cancellation timestamp")
|
|
36
|
+
|
|
37
|
+
class Config:
|
|
38
|
+
"""
|
|
39
|
+
Pydantic configuration.
|
|
40
|
+
"""
|
|
41
|
+
orm_mode = True
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class PaymentTransactionList(BaseModel):
|
|
45
|
+
"""
|
|
46
|
+
Schema for a list of payment transactions.
|
|
47
|
+
"""
|
|
48
|
+
transactions: List[PaymentTransaction] = Field(..., description="List of transactions")
|
|
49
|
+
total: int = Field(..., description="Total number of transactions")
|
|
50
|
+
|
|
51
|
+
class PaymeWebhookRequest(BaseModel):
|
|
52
|
+
"""
|
|
53
|
+
Schema for Payme webhook request.
|
|
54
|
+
"""
|
|
55
|
+
method: str = Field(..., description="Method name")
|
|
56
|
+
params: Dict[str, Any] = Field(..., description="Method parameters")
|
|
57
|
+
id: int = Field(..., description="Request ID")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class PaymeWebhookResponse(BaseModel):
|
|
61
|
+
"""
|
|
62
|
+
Schema for Payme webhook response.
|
|
63
|
+
"""
|
|
64
|
+
jsonrpc: str = Field("2.0", description="JSON-RPC version")
|
|
65
|
+
id: int = Field(..., description="Request ID")
|
|
66
|
+
result: Dict[str, Any] = Field(..., description="Response result")
|
|
67
|
+
|
|
68
|
+
class PaymeWebhookErrorResponse(BaseModel):
|
|
69
|
+
"""
|
|
70
|
+
Schema for Payme webhook error response.
|
|
71
|
+
"""
|
|
72
|
+
jsonrpc: str = Field("2.0", description="JSON-RPC version")
|
|
73
|
+
id: int = Field(..., description="Request ID")
|
|
74
|
+
error: Dict[str, Any] = Field(..., description="Error details")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ClickWebhookRequest(BaseModel):
|
|
78
|
+
"""
|
|
79
|
+
Schema for Click webhook request.
|
|
80
|
+
"""
|
|
81
|
+
click_trans_id: str = Field(..., description="Click transaction ID")
|
|
82
|
+
service_id: str = Field(..., description="Service ID")
|
|
83
|
+
merchant_trans_id: str = Field(..., description="Merchant transaction ID")
|
|
84
|
+
amount: str = Field(..., description="Payment amount")
|
|
85
|
+
action: str = Field(..., description="Action (0 - prepare, 1 - complete)")
|
|
86
|
+
sign_time: str = Field(..., description="Signature timestamp")
|
|
87
|
+
sign_string: str = Field(..., description="Signature string")
|
|
88
|
+
error: Optional[str] = Field(None, description="Error code")
|
|
89
|
+
error_note: Optional[str] = Field(None, description="Error note")
|
|
90
|
+
|
|
91
|
+
class ClickWebhookResponse(BaseModel):
|
|
92
|
+
"""
|
|
93
|
+
Schema for Click webhook response.
|
|
94
|
+
"""
|
|
95
|
+
click_trans_id: str = Field(..., description="Click transaction ID")
|
|
96
|
+
merchant_trans_id: str = Field(..., description="Merchant transaction ID")
|
|
97
|
+
merchant_prepare_id: Optional[int] = Field(None, description="Merchant prepare ID")
|
|
98
|
+
error: int = Field(0, description="Error code")
|
|
99
|
+
error_note: str = Field("Success", description="Error note")
|
paytechuz/__init__.py
CHANGED
|
@@ -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,36 @@
|
|
|
1
|
+
core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
core/base.py,sha256=bHmRMYZ97Kj76a4kL7UMRcecnZF-rKnBYZddQvRtRmQ,2497
|
|
3
|
+
core/constants.py,sha256=P2zeZ_cfZIttdC1vqkpIngkfRFh6loWzJYEgzQb5cKA,1660
|
|
4
|
+
core/exceptions.py,sha256=XMJkqiponTkvhjoh3S2iFNuU3UbBdFW4130kd0hpudg,5489
|
|
5
|
+
core/http.py,sha256=qmLR6ujxmIPjwoTS4vvKRIvDnNcpl84sS1HmVB890b0,7686
|
|
6
|
+
core/utils.py,sha256=ETHMzwu7_dirc-QfBUjpSTQmyS6_vBiNq97Dq9CNZto,4718
|
|
7
|
+
core/payme/errors.py,sha256=CZE62MbYDMsRfNIX23Syt6of_tPMMGLnXhYMii4hw3A,542
|
|
8
|
+
gateways/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
gateways/click/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
gateways/click/client.py,sha256=XTri3iogq4_MgvZehBK2CScVCMubvg1GNXV9whGAS6I,6663
|
|
11
|
+
gateways/click/merchant.py,sha256=vJ_DivA1KfRT5p3sfA5yZGMYXoUmVbAM7QHvaXr6VCU,7254
|
|
12
|
+
gateways/click/webhook.py,sha256=rph-NmjjnBKMW4rcxQTXrHHdK-uMrU39kXnbqK56leo,7936
|
|
13
|
+
gateways/payme/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
gateways/payme/cards.py,sha256=aL6su_ZTCBPU8qmrz2Jcw_Wn7Zf9RwIu8k10o4AWFTs,5420
|
|
15
|
+
gateways/payme/client.py,sha256=C1OQWLo7LIAF3xbFOLyCaJ3xFwQaFVpaxWCYajCltTY,8201
|
|
16
|
+
gateways/payme/receipts.py,sha256=DdrZMPeDvQmGyqAEOTmtUorfcIVVb3t2tg31l7TXqHo,8904
|
|
17
|
+
gateways/payme/webhook.py,sha256=-0O8vzMtiu4U8FWFKDA6EfyoX4NEGqcEq-T0yNtVhM4,12374
|
|
18
|
+
integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
integrations/django/__init__.py,sha256=YDgD1Ux1E3CJxQMT-9tulhXmuLOEaUSv320LeaVgJ00,116
|
|
20
|
+
integrations/django/admin.py,sha256=6fs6GiKcdc-hGlLxJ0BthY7TFo_2RVVJRhQwhxMroCY,2664
|
|
21
|
+
integrations/django/apps.py,sha256=57svd2aqSuoASWMI3Jnh70ZXrYN1oQ8EnvLl_5LNyl0,473
|
|
22
|
+
integrations/django/models.py,sha256=83PjBnombavEjfPm2EcVFo2R5BO6VRIjp0MlNCp-fbg,5819
|
|
23
|
+
integrations/django/signals.py,sha256=VtNYEAnu13wi9PqadEaCU9LY_k2tY26AS4bnPIAqw7M,1319
|
|
24
|
+
integrations/django/views.py,sha256=nP2HRMx02tMbdv_KfDqIA5vQAwZ6TUuZazrZ2zoNfqQ,3029
|
|
25
|
+
integrations/django/webhooks.py,sha256=cP_Jc3VlyyvyzDbBd2yEVHikw60th1_-L9_vtsRfwgs,31335
|
|
26
|
+
integrations/django/migrations/0001_initial.py,sha256=YLDUp1w0V3Zvuz5TssQDrx3PlccduoHqdLD109Hg8Z4,2326
|
|
27
|
+
integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
|
|
28
|
+
integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2SLG8qxldRuwR4,565
|
|
29
|
+
integrations/fastapi/models.py,sha256=eWGUpiKufj47AK8Hld4A91jRDj0ZKQzAf95CyUozmvo,4638
|
|
30
|
+
integrations/fastapi/routes.py,sha256=D17QeyY4-aX6tCNmk5h3UiavukvVrE5e6JOFCy4t_n8,36629
|
|
31
|
+
integrations/fastapi/schemas.py,sha256=CkNohj22mQQje8Pu_IkTQwUPAoYHNOKXlGjqaRX_SGQ,3784
|
|
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,,
|
paytechuz-0.1.1.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
paytechuz/__init__.py,sha256=BQdz6ByBQ_t8VlZ0AN10u9Ponlr6g_ySt3sX1aJc50Y,1853
|
|
2
|
-
paytechuz-0.1.1.dist-info/METADATA,sha256=-xSS_CqgVVoBae9kS01aqsH53fvzt2yyBxyWe7RlEsI,6058
|
|
3
|
-
paytechuz-0.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
4
|
-
paytechuz-0.1.1.dist-info/top_level.txt,sha256=v03IobsNVIGSgCareObqCsEwLgXOpwBvBTWy3y8-G_M,37
|
|
5
|
-
paytechuz-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|