payme-pkg 3.0.24__tar.gz → 3.0.26b0__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.24 → payme_pkg-3.0.26b0}/PKG-INFO +11 -2
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/receipts.py +32 -0
- payme_pkg-3.0.26b0/payme/migrations/0004_alter_paymetransactions_account_id.py +18 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/models.py +1 -1
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/response/receipts.py +8 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/views.py +12 -10
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme_pkg.egg-info/PKG-INFO +11 -2
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme_pkg.egg-info/SOURCES.txt +1 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/setup.py +1 -1
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/LICENSE.txt +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/README.md +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/admin.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/apps.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/cards.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/client.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/http.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/classes/initializer.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/const.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/exceptions/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/exceptions/general.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/exceptions/webhook.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/0001_initial.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/0002_paymetransactions_fiscal_data.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/0003_alter_paymetransactions_fiscal_data.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/request/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/response/__init__.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/response/cards.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/types/response/webhook.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/urls.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/util.py +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme_pkg.egg-info/dependency_links.txt +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme_pkg.egg-info/requires.txt +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme_pkg.egg-info/top_level.txt +0 -0
- {payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: payme-pkg
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.26b0
|
|
4
4
|
Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
|
|
5
5
|
Author: Muhammadali Akbarov
|
|
6
6
|
Author-email: muhammadali17abc@gmail.com
|
|
@@ -11,6 +11,15 @@ License-File: LICENSE.txt
|
|
|
11
11
|
Requires-Dist: requests==2.*
|
|
12
12
|
Requires-Dist: dataclasses==0.*; python_version < "3.7"
|
|
13
13
|
Requires-Dist: djangorestframework==3.*
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: keywords
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: requires-dist
|
|
14
23
|
|
|
15
24
|
<h1 align="center">Payme Software Development Kit</h1>
|
|
16
25
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import Union, Optional
|
|
2
|
+
from urllib.parse import parse_qs
|
|
2
3
|
|
|
3
4
|
from payme.classes.cards import Cards
|
|
4
5
|
from payme.classes.http import HttpClient
|
|
@@ -13,6 +14,7 @@ ALLOWED_METHODS = {
|
|
|
13
14
|
"receipts.check": response.CheckResponse,
|
|
14
15
|
"receipts.get": response.GetResponse,
|
|
15
16
|
"receipts.get_all": response.GetAllResponse,
|
|
17
|
+
"receipts.set_fiscal_data": response.SetFiscalDataResponse,
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
|
|
@@ -163,6 +165,36 @@ class Receipts:
|
|
|
163
165
|
}
|
|
164
166
|
return self._post_request(method, params, timeout)
|
|
165
167
|
|
|
168
|
+
def set_fiscal_data(
|
|
169
|
+
self, receipt_id: str, qr_code_url: str, timeout: int = 10
|
|
170
|
+
) -> response.SetFiscalDataResponse:
|
|
171
|
+
"""
|
|
172
|
+
Get all cheques for a specific account.
|
|
173
|
+
|
|
174
|
+
:param receipt_id: The ID of the check used for payment.
|
|
175
|
+
:param qr_code_url: URL of the fiscal check from the ofd.uz.
|
|
176
|
+
:param timeout: The request timeout duration in seconds (default 10).
|
|
177
|
+
"""
|
|
178
|
+
method = "receipts.set_fiscal_data"
|
|
179
|
+
|
|
180
|
+
check_params = parse_qs(qr_code_url.split("?")[1])
|
|
181
|
+
terminal_id = check_params["t"][0]
|
|
182
|
+
fiscal_sign = check_params["s"][0]
|
|
183
|
+
fiscal_receipt_id = check_params["r"][0]
|
|
184
|
+
fiscal_date = check_params["c"][0]
|
|
185
|
+
|
|
186
|
+
params = {
|
|
187
|
+
"id": receipt_id, # required
|
|
188
|
+
"fiscal_data": {
|
|
189
|
+
"terminal_id": terminal_id,
|
|
190
|
+
"receipt_id": int(fiscal_receipt_id), # required
|
|
191
|
+
"date": fiscal_date,
|
|
192
|
+
"fiscal_sign": fiscal_sign,
|
|
193
|
+
"qr_code_url": qr_code_url, # required
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return self._post_request(method, params, timeout)
|
|
197
|
+
|
|
166
198
|
def _post_request(
|
|
167
199
|
self, method: str, params: dict, timeout: int = 10
|
|
168
200
|
) -> response.Common:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 5.2.5 on 2025-08-25 19:12
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("payme", "0003_alter_paymetransactions_fiscal_data"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="paymetransactions",
|
|
15
|
+
name="account_id",
|
|
16
|
+
field=models.CharField(max_length=256),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -26,7 +26,7 @@ class PaymeTransactions(models.Model):
|
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
transaction_id = models.CharField(max_length=50)
|
|
29
|
-
account_id = models.
|
|
29
|
+
account_id = models.CharField(max_length=256, null=False)
|
|
30
30
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
31
31
|
state = models.IntegerField(choices=STATE, default=CREATED)
|
|
32
32
|
fiscal_data = models.JSONField(default=dict)
|
|
@@ -213,3 +213,11 @@ class GetAllResponse(Common):
|
|
|
213
213
|
The result object for the get all response.
|
|
214
214
|
"""
|
|
215
215
|
result: list[Receipt] = None
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@dataclass
|
|
219
|
+
class SetFiscalDataResponse(Common):
|
|
220
|
+
"""
|
|
221
|
+
The result object for the set_fiscal_data response.
|
|
222
|
+
"""
|
|
223
|
+
result: SendResult
|
|
@@ -4,6 +4,7 @@ import logging
|
|
|
4
4
|
from decimal import Decimal
|
|
5
5
|
|
|
6
6
|
from django.conf import settings
|
|
7
|
+
from django.core.exceptions import ValidationError
|
|
7
8
|
from django.utils.module_loading import import_string
|
|
8
9
|
from rest_framework import views
|
|
9
10
|
from rest_framework.response import Response
|
|
@@ -33,6 +34,9 @@ def handle_exceptions(func):
|
|
|
33
34
|
logger.error(f"Account does not exist: {exc} {args} {kwargs}")
|
|
34
35
|
raise exceptions.AccountDoesNotExist(str(exc)) from exc
|
|
35
36
|
|
|
37
|
+
except ValidationError:
|
|
38
|
+
raise exceptions.AccountDoesNotExist("Invalid account identifier.")
|
|
39
|
+
|
|
36
40
|
except PaymeTransactions.DoesNotExist as exc:
|
|
37
41
|
logger.error(f"Transaction does not exist: {exc} {args} {kwargs}")
|
|
38
42
|
raise exceptions.AccountDoesNotExist(str(exc)) from exc
|
|
@@ -112,17 +116,11 @@ class PaymeWebHookAPIView(views.APIView):
|
|
|
112
116
|
"""
|
|
113
117
|
Fetch account based on settings and params.
|
|
114
118
|
"""
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
account_value = params['account'].get(account_field)
|
|
119
|
+
account_value = params["account"].get(settings.PAYME_ACCOUNT_FIELD)
|
|
118
120
|
if not account_value:
|
|
119
121
|
raise exceptions.InvalidAccount("Missing account field in parameters.")
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
if account_field == "order_id":
|
|
123
|
-
account_field = "id"
|
|
124
|
-
|
|
125
|
-
account = AccountModel.objects.get(**{account_field: account_value})
|
|
123
|
+
account = AccountModel.objects.get(pk=account_value)
|
|
126
124
|
|
|
127
125
|
return account
|
|
128
126
|
|
|
@@ -169,13 +167,17 @@ class PaymeWebHookAPIView(views.APIView):
|
|
|
169
167
|
defaults = {
|
|
170
168
|
"amount": amount,
|
|
171
169
|
"state": PaymeTransactions.INITIATING,
|
|
172
|
-
"account_id": account.
|
|
170
|
+
"account_id": account.pk,
|
|
173
171
|
}
|
|
174
172
|
|
|
175
173
|
# Handle already existing transaction with the same ID for one-time payments
|
|
176
174
|
if settings.PAYME_ONE_TIME_PAYMENT:
|
|
177
175
|
# Check for an existing transaction with a different transaction_id for the given account
|
|
178
|
-
if
|
|
176
|
+
if (
|
|
177
|
+
PaymeTransactions.objects.filter(account_id=account.pk)
|
|
178
|
+
.exclude(transaction_id=transaction_id)
|
|
179
|
+
.exists()
|
|
180
|
+
):
|
|
179
181
|
message = f"Transaction {transaction_id} already exists (Payme)."
|
|
180
182
|
logger.warning(message)
|
|
181
183
|
raise exceptions.TransactionAlreadyExists(message)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: payme-pkg
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.26b0
|
|
4
4
|
Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
|
|
5
5
|
Author: Muhammadali Akbarov
|
|
6
6
|
Author-email: muhammadali17abc@gmail.com
|
|
@@ -11,6 +11,15 @@ License-File: LICENSE.txt
|
|
|
11
11
|
Requires-Dist: requests==2.*
|
|
12
12
|
Requires-Dist: dataclasses==0.*; python_version < "3.7"
|
|
13
13
|
Requires-Dist: djangorestframework==3.*
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: keywords
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: requires-dist
|
|
14
23
|
|
|
15
24
|
<h1 align="center">Payme Software Development Kit</h1>
|
|
16
25
|
|
|
@@ -22,6 +22,7 @@ payme/exceptions/webhook.py
|
|
|
22
22
|
payme/migrations/0001_initial.py
|
|
23
23
|
payme/migrations/0002_paymetransactions_fiscal_data.py
|
|
24
24
|
payme/migrations/0003_alter_paymetransactions_fiscal_data.py
|
|
25
|
+
payme/migrations/0004_alter_paymetransactions_account_id.py
|
|
25
26
|
payme/migrations/__init__.py
|
|
26
27
|
payme/types/__init__.py
|
|
27
28
|
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
|
{payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/0002_paymetransactions_fiscal_data.py
RENAMED
|
File without changes
|
{payme_pkg-3.0.24 → payme_pkg-3.0.26b0}/payme/migrations/0003_alter_paymetransactions_fiscal_data.py
RENAMED
|
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
|