payme-pkg 3.0.21__py3-none-any.whl → 3.0.24__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 payme-pkg might be problematic. Click here for more details.
- payme/admin.py +3 -1
- payme/exceptions/webhook.py +33 -1
- payme/migrations/0002_paymetransactions_fiscal_data.py +18 -0
- payme/migrations/0003_alter_paymetransactions_fiscal_data.py +18 -0
- payme/models.py +1 -0
- payme/types/response/webhook.py +8 -0
- payme/views.py +28 -0
- {payme_pkg-3.0.21.dist-info → payme_pkg-3.0.24.dist-info}/METADATA +3 -7
- {payme_pkg-3.0.21.dist-info → payme_pkg-3.0.24.dist-info}/RECORD +12 -10
- {payme_pkg-3.0.21.dist-info → payme_pkg-3.0.24.dist-info}/LICENSE.txt +0 -0
- {payme_pkg-3.0.21.dist-info → payme_pkg-3.0.24.dist-info}/WHEEL +0 -0
- {payme_pkg-3.0.21.dist-info → payme_pkg-3.0.24.dist-info}/top_level.txt +0 -0
payme/admin.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from django.conf import settings
|
|
1
2
|
from django.contrib import admin
|
|
2
3
|
|
|
3
4
|
from payme.models import PaymeTransactions
|
|
@@ -13,4 +14,5 @@ class PaymeTransactionsUI(admin.ModelAdmin):
|
|
|
13
14
|
ordering = ('-created_at',)
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
if not getattr(settings, 'PAYME_DISABLE_ADMIN', False):
|
|
18
|
+
admin.site.register(PaymeTransactions, PaymeTransactionsUI)
|
payme/exceptions/webhook.py
CHANGED
|
@@ -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
|
+
]
|
payme/models.py
CHANGED
|
@@ -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)
|
payme/types/response/webhook.py
CHANGED
payme/views.py
CHANGED
|
@@ -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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: payme-pkg
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.24
|
|
4
4
|
Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
|
|
5
5
|
Author: Muhammadali Akbarov
|
|
6
6
|
Author-email: muhammadali17abc@gmail.com
|
|
@@ -39,12 +39,6 @@ Requires-Dist: dataclasses (==0.*) ; python_version < "3.7"
|
|
|
39
39
|
<p align="center">Visit the full documentation for Merchant and Subscribe API</p>
|
|
40
40
|
</a>
|
|
41
41
|
|
|
42
|
-
<a href="https://youtu.be/xxiIggu_RNk?si=Idpg8omFvFDCYtcm" target="_blank">
|
|
43
|
-
<p align="center">
|
|
44
|
-
<img style="width: 60%;" src="https://i.postimg.cc/WbD32bHC/payme-pkg-demo-m4a.gif" alt="Payme PKG Demo">
|
|
45
|
-
</p>
|
|
46
|
-
</a>
|
|
47
|
-
|
|
48
42
|
<p align="center">
|
|
49
43
|
<a href="https://youtu.be/7q7-c72tHpc?si=Sr0EAmEawWAFRk1m" target="_blank">
|
|
50
44
|
<img src="https://img.shields.io/badge/Watch%20Demo-red?logo=youtube&logoColor=white&style=for-the-badge"
|
|
@@ -95,6 +89,8 @@ PAYME_KEY = "your-payme-key"
|
|
|
95
89
|
PAYME_ACCOUNT_FIELD = "id"
|
|
96
90
|
PAYME_ACCOUNT_MODEL = "clients.models.Client"
|
|
97
91
|
PAYME_ONE_TIME_PAYMENT = False
|
|
92
|
+
|
|
93
|
+
PAYME_DISABLE_ADMIN = False (optionally configuration if you want to disable change to True)
|
|
98
94
|
```
|
|
99
95
|
|
|
100
96
|
Create a new View that about handling call backs
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
payme/__init__.py,sha256=dzLIyA9kQl0sO6z9nHkZDTjkfiI1BepdifKtJbjX2Cw,46
|
|
2
|
-
payme/admin.py,sha256=
|
|
2
|
+
payme/admin.py,sha256=k4_kAX6k8993aQo_7xokIc7InUVw4LGZT5ROn-C9EYU,561
|
|
3
3
|
payme/apps.py,sha256=HHCY4zUNKPcjz25z0MahZcks0lsAxTGPS0Ml3U4DhZc,142
|
|
4
4
|
payme/const.py,sha256=azndfKR53fe7mDfGW82Q-kwWdMu3x4S1upKc4gkYdlA,214
|
|
5
|
-
payme/models.py,sha256=
|
|
5
|
+
payme/models.py,sha256=nOVmknNjQkBos7w069ddAp_wTBj14UssdTgO8w8sTdI,4179
|
|
6
6
|
payme/urls.py,sha256=_oUOwxW1Suc5TUmnj--lySYbotRg4yTDkDLJU20CGjE,145
|
|
7
7
|
payme/util.py,sha256=UFb4cEnaufS_hh9C_0z079CSgJGivYjIgOl2iAFrBMs,625
|
|
8
|
-
payme/views.py,sha256=
|
|
8
|
+
payme/views.py,sha256=gSQgctinjjAWhEO-kCIF4Jn01yapzHRi2ovtkc6JgJw,12873
|
|
9
9
|
payme/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
payme/classes/cards.py,sha256=dr3SQdKAhfQmECtwHYW2nmx8wXaNYQFkg5uQU9z8vs4,7624
|
|
11
11
|
payme/classes/client.py,sha256=Fjck3vSRh8-NQ8HnxwytCn_qZm6UfwMKCBYDHtUSJAs,864
|
|
@@ -14,17 +14,19 @@ payme/classes/initializer.py,sha256=TWJnlJTXefROMleIvJeT64xjIVWQU-LIXai8TZ_M7nw,
|
|
|
14
14
|
payme/classes/receipts.py,sha256=KU4qyGHWZpWW88SjmmTD_N2Tz8pWOCvBbOPnw5tcS3Y,10094
|
|
15
15
|
payme/exceptions/__init__.py,sha256=HoBFnDA3eW_xWZiFlonJK4vhBDTsuik91tvgzXTy8KA,94
|
|
16
16
|
payme/exceptions/general.py,sha256=-rkzvuLi6VoITMLrszrP7c-gM8X6lM8AWttd770KSJc,7679
|
|
17
|
-
payme/exceptions/webhook.py,sha256=
|
|
17
|
+
payme/exceptions/webhook.py,sha256=hiX3CEjlPsFkliJm7SNM3XImU1IBscPhiwsnJJqhku4,3843
|
|
18
18
|
payme/migrations/0001_initial.py,sha256=jdtGB6bN-Za6N9XU8IuWsa5FbonGIRH5ro9xHwT7JmU,2128
|
|
19
|
+
payme/migrations/0002_paymetransactions_fiscal_data.py,sha256=z-gxPP3IgN-XNPx6DEZUQ4E1XZceVnnpvUTcSkcv70c,395
|
|
20
|
+
payme/migrations/0003_alter_paymetransactions_fiscal_data.py,sha256=Ish4Seup9pdEM0g4q4RQKrvUOWB2DXPN0RmIScKI2IQ,410
|
|
19
21
|
payme/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
22
|
payme/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
23
|
payme/types/request/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
24
|
payme/types/response/__init__.py,sha256=GAj5pjZ9oIO67T6YMiPd1fhTIvGrPfTv96tykfeChQc,81
|
|
23
25
|
payme/types/response/cards.py,sha256=ilXFDUOPNabVsrQN1KWEzDiL6cDxdVvCbfEl6jCzGpU,1997
|
|
24
26
|
payme/types/response/receipts.py,sha256=TlZeJyymRVHIorg0kbUaogy6MZxN1oq2jHGVRUnlY5A,4070
|
|
25
|
-
payme/types/response/webhook.py,sha256=
|
|
26
|
-
payme_pkg-3.0.
|
|
27
|
-
payme_pkg-3.0.
|
|
28
|
-
payme_pkg-3.0.
|
|
29
|
-
payme_pkg-3.0.
|
|
30
|
-
payme_pkg-3.0.
|
|
27
|
+
payme/types/response/webhook.py,sha256=9tw_QsKNAUqgZLwL7Pg0SIVAry0BlxlWOu8BDmKewzc,3034
|
|
28
|
+
payme_pkg-3.0.24.dist-info/LICENSE.txt,sha256=75dBVYmbzWUhwtaB1MSZfj-M-PGaMmeT9UVPli2-ZJ0,1086
|
|
29
|
+
payme_pkg-3.0.24.dist-info/METADATA,sha256=5M5dOOlQtVeu9ZFGxxpAL2zuHWzvWm4TWC4XSXQuUoQ,5372
|
|
30
|
+
payme_pkg-3.0.24.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
31
|
+
payme_pkg-3.0.24.dist-info/top_level.txt,sha256=8mN-hGAa38pWbhrKHFs9CZywPCdidhMuwPKwuFJa0qw,6
|
|
32
|
+
payme_pkg-3.0.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|