payme-pkg 3.0.22__tar.gz → 3.0.23b0__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 payme-pkg might be problematic. Click here for more details.
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/PKG-INFO +1 -1
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/exceptions/webhook.py +33 -1
- payme_pkg-3.0.23b0/payme/migrations/0002_paymetransactions_fiscal_data.py +18 -0
- payme_pkg-3.0.23b0/payme/migrations/0003_alter_paymetransactions_fiscal_data.py +18 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/models.py +1 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/response/webhook.py +8 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/views.py +28 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme_pkg.egg-info/PKG-INFO +1 -1
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme_pkg.egg-info/SOURCES.txt +2 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/setup.py +1 -1
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/LICENSE.txt +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/README.md +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/admin.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/apps.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/cards.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/client.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/http.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/initializer.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/classes/receipts.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/const.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/exceptions/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/exceptions/general.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/migrations/0001_initial.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/migrations/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/request/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/response/__init__.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/response/cards.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/types/response/receipts.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/urls.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme/util.py +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme_pkg.egg-info/dependency_links.txt +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme_pkg.egg-info/requires.txt +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/payme_pkg.egg-info/top_level.txt +0 -0
- {payme_pkg-3.0.22 → payme_pkg-3.0.23b0}/setup.cfg +0 -0
|
@@ -116,10 +116,42 @@ class TransactionAlreadyExists(BasePaymeException):
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
|
|
119
|
+
class InvalidFiscalParams(BasePaymeException):
|
|
120
|
+
"""
|
|
121
|
+
InvalidFiscalParams APIException.
|
|
122
|
+
|
|
123
|
+
Raised when the provided fiscal parameters are invalid.
|
|
124
|
+
"""
|
|
125
|
+
status_code = 200
|
|
126
|
+
error_code = -32602
|
|
127
|
+
message = {
|
|
128
|
+
"uz": "Fiskal parameterlarida kamchiliklar bor",
|
|
129
|
+
"ru": "Неверные фискальные параметры.",
|
|
130
|
+
"en": "Invalid fiscal parameters."
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class InvalidAccount(BasePaymeException):
|
|
135
|
+
"""
|
|
136
|
+
InvalidAccount APIException.
|
|
137
|
+
|
|
138
|
+
Raised when the provided account is invalid.
|
|
139
|
+
"""
|
|
140
|
+
status_code = 200
|
|
141
|
+
error_code = -32400
|
|
142
|
+
message = {
|
|
143
|
+
"uz": "Hisob nomida kamchilik bor",
|
|
144
|
+
"ru": "Неверный номер счета.",
|
|
145
|
+
"en": "Invalid account."
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
119
149
|
exception_whitelist = (
|
|
120
150
|
IncorrectAmount,
|
|
121
151
|
MethodNotFound,
|
|
122
152
|
PermissionDenied,
|
|
123
153
|
AccountDoesNotExist,
|
|
124
|
-
TransactionAlreadyExists
|
|
154
|
+
TransactionAlreadyExists,
|
|
155
|
+
InvalidFiscalParams,
|
|
156
|
+
InvalidAccount
|
|
125
157
|
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 5.1.2 on 2025-03-14 08:01
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("payme", "0001_initial"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="paymetransactions",
|
|
15
|
+
name="fiscal_data",
|
|
16
|
+
field=models.JSONField(blank=True, null=True),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 5.1.2 on 2025-03-14 08:20
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("payme", "0002_paymetransactions_fiscal_data"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="paymetransactions",
|
|
15
|
+
name="fiscal_data",
|
|
16
|
+
field=models.JSONField(default=dict),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -29,6 +29,7 @@ class PaymeTransactions(models.Model):
|
|
|
29
29
|
account_id = models.BigIntegerField(null=False)
|
|
30
30
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
31
31
|
state = models.IntegerField(choices=STATE, default=CREATED)
|
|
32
|
+
fiscal_data = models.JSONField(default=dict)
|
|
32
33
|
cancel_reason = models.IntegerField(null=True, blank=True)
|
|
33
34
|
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
|
|
34
35
|
updated_at = models.DateTimeField(auto_now=True, db_index=True)
|
|
@@ -66,6 +66,7 @@ class PaymeWebHookAPIView(views.APIView):
|
|
|
66
66
|
"CreateTransaction": self.create_transaction,
|
|
67
67
|
"CheckTransaction": self.check_transaction,
|
|
68
68
|
"CheckPerformTransaction": self.check_perform_transaction,
|
|
69
|
+
"SetFiscalData": self.set_fiscal_data,
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
try:
|
|
@@ -300,6 +301,33 @@ class PaymeWebHookAPIView(views.APIView):
|
|
|
300
301
|
|
|
301
302
|
return result.as_resp()
|
|
302
303
|
|
|
304
|
+
@handle_exceptions
|
|
305
|
+
def set_fiscal_data(self, params):
|
|
306
|
+
"""
|
|
307
|
+
Set fiscal data for the given transaction.
|
|
308
|
+
"""
|
|
309
|
+
transaction = PaymeTransactions.get_by_transaction_id(transaction_id=params["id"])
|
|
310
|
+
|
|
311
|
+
fiscal_data = params.get("fiscal_data")
|
|
312
|
+
if not fiscal_data:
|
|
313
|
+
raise exceptions.InvalidFiscalParams(
|
|
314
|
+
"Missing fiscal_data field in parameters."
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
fiscal_type = params.get("type")
|
|
318
|
+
|
|
319
|
+
if fiscal_type not in ("PERFORM", "CANCEL"):
|
|
320
|
+
raise exceptions.InvalidFiscalParams(
|
|
321
|
+
f"Invalid fiscal type. Expected 'PERFORM' or 'CANCEL', got: {fiscal_type}"
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
fiscal_data["type"] = fiscal_type
|
|
325
|
+
transaction.fiscal_data = fiscal_data
|
|
326
|
+
transaction.save()
|
|
327
|
+
|
|
328
|
+
result = response.SetFiscalData(success=True)
|
|
329
|
+
return result.as_resp()
|
|
330
|
+
|
|
303
331
|
def _cancel_response(self, transaction):
|
|
304
332
|
"""
|
|
305
333
|
Helper method to generate cancel transaction response.
|
|
@@ -20,6 +20,8 @@ payme/exceptions/__init__.py
|
|
|
20
20
|
payme/exceptions/general.py
|
|
21
21
|
payme/exceptions/webhook.py
|
|
22
22
|
payme/migrations/0001_initial.py
|
|
23
|
+
payme/migrations/0002_paymetransactions_fiscal_data.py
|
|
24
|
+
payme/migrations/0003_alter_paymetransactions_fiscal_data.py
|
|
23
25
|
payme/migrations/__init__.py
|
|
24
26
|
payme/types/__init__.py
|
|
25
27
|
payme/types/request/__init__.py
|
|
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
|