payme-pkg 3.0.25b0__py3-none-any.whl → 3.0.29__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 CHANGED
@@ -8,7 +8,7 @@ class PaymeTransactionsUI(admin.ModelAdmin):
8
8
  """
9
9
  Custom admin interface for PaymeTransactions model.
10
10
  """
11
- list_display = ('id', 'state', 'cancel_reason', 'created_at')
11
+ list_display = ('pk', 'state', 'cancel_reason', 'created_at')
12
12
  list_filter = ('state', 'cancel_reason', 'created_at')
13
13
  search_fields = ('transaction_id', 'account_id')
14
14
  ordering = ('-created_at',)
payme/classes/receipts.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import typing as t
2
2
 
3
+ from urllib.parse import parse_qs
4
+
3
5
  from payme.classes.cards import Cards
4
6
  from payme.classes.http import HttpClient
5
7
  from payme.types.response import receipts as response
@@ -13,6 +15,7 @@ ALLOWED_METHODS = {
13
15
  "receipts.check": response.CheckResponse,
14
16
  "receipts.get": response.GetResponse,
15
17
  "receipts.get_all": response.GetAllResponse,
18
+ "receipts.set_fiscal_data": response.SetFiscalDataResponse,
16
19
  }
17
20
 
18
21
 
@@ -141,6 +144,36 @@ class Receipts:
141
144
  params = {"count": count, "from": from_, "to": to, "offset": offset}
142
145
  return self._post_request(method, params, timeout)
143
146
 
147
+ def set_fiscal_data(
148
+ self, receipt_id: str, qr_code_url: str, timeout: int = 10
149
+ ) -> response.SetFiscalDataResponse:
150
+ """
151
+ Get all cheques for a specific account.
152
+
153
+ :param receipt_id: The ID of the check used for payment.
154
+ :param qr_code_url: URL of the fiscal check from the ofd.uz.
155
+ :param timeout: The request timeout duration in seconds (default 10).
156
+ """
157
+ method = "receipts.set_fiscal_data"
158
+
159
+ check_params = parse_qs(qr_code_url.split("?")[1])
160
+ terminal_id = check_params["t"][0]
161
+ fiscal_sign = check_params["s"][0]
162
+ fiscal_receipt_id = check_params["r"][0]
163
+ fiscal_date = check_params["c"][0]
164
+
165
+ params = {
166
+ "id": receipt_id, # required
167
+ "fiscal_data": {
168
+ "terminal_id": terminal_id,
169
+ "receipt_id": int(fiscal_receipt_id), # required
170
+ "date": fiscal_date,
171
+ "fiscal_sign": fiscal_sign,
172
+ "qr_code_url": qr_code_url, # required
173
+ }
174
+ }
175
+ return self._post_request(method, params, timeout)
176
+
144
177
  def _post_request(
145
178
  self, method: str, params: dict, timeout: int = 10
146
179
  ) -> 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
+ ]
@@ -0,0 +1,19 @@
1
+ # Generated migration to increase amount field precision
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("payme", "0004_alter_paymetransactions_account_id"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name="paymetransactions",
15
+ name="amount",
16
+ field=models.DecimalField(decimal_places=2, max_digits=15),
17
+ ),
18
+ ]
19
+
payme/models.py CHANGED
@@ -26,8 +26,8 @@ class PaymeTransactions(models.Model):
26
26
  ]
27
27
 
28
28
  transaction_id = models.CharField(max_length=50)
29
- account_id = models.BigIntegerField(null=False)
30
- amount = models.DecimalField(max_digits=10, decimal_places=2)
29
+ account_id = models.CharField(max_length=256, null=False)
30
+ amount = models.DecimalField(max_digits=15, decimal_places=2)
31
31
  state = models.IntegerField(choices=STATE, default=CREATED)
32
32
  fiscal_data = models.JSONField(default=dict)
33
33
  cancel_reason = models.IntegerField(null=True, blank=True)
@@ -228,5 +228,12 @@ class GetAllResponse(Common):
228
228
  """
229
229
  The result object for the get all response.
230
230
  """
231
+ result: list[Receipt] = None
231
232
 
232
- result: t.Optional[t.List[Receipt]] = None
233
+
234
+ @dataclass
235
+ class SetFiscalDataResponse(Common):
236
+ """
237
+ The result object for the set_fiscal_data response.
238
+ """
239
+ result: SendResult
payme/views.py CHANGED
@@ -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,10 @@ 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 as exc:
38
+ logger.error(f"Invalid account identifier {exc}")
39
+ raise exceptions.AccountDoesNotExist("Invalid account identifier.")
40
+
36
41
  except PaymeTransactions.DoesNotExist as exc:
37
42
  logger.error(f"Transaction does not exist: {exc} {args} {kwargs}")
38
43
  raise exceptions.AccountDoesNotExist(str(exc)) from exc
@@ -112,17 +117,11 @@ class PaymeWebHookAPIView(views.APIView):
112
117
  """
113
118
  Fetch account based on settings and params.
114
119
  """
115
- account_field = settings.PAYME_ACCOUNT_FIELD
116
-
117
- account_value = params['account'].get(account_field)
120
+ account_value = params["account"].get(settings.PAYME_ACCOUNT_FIELD)
118
121
  if not account_value:
119
122
  raise exceptions.InvalidAccount("Missing account field in parameters.")
120
123
 
121
- # hard change
122
- if account_field == "order_id":
123
- account_field = "id"
124
-
125
- account = AccountModel.objects.get(**{account_field: account_value})
124
+ account = AccountModel.objects.get(pk=account_value)
126
125
 
127
126
  return account
128
127
 
@@ -169,13 +168,17 @@ class PaymeWebHookAPIView(views.APIView):
169
168
  defaults = {
170
169
  "amount": amount,
171
170
  "state": PaymeTransactions.INITIATING,
172
- "account_id": account.id,
171
+ "account_id": account.pk,
173
172
  }
174
173
 
175
174
  # Handle already existing transaction with the same ID for one-time payments
176
175
  if settings.PAYME_ONE_TIME_PAYMENT:
177
176
  # Check for an existing transaction with a different transaction_id for the given account
178
- if PaymeTransactions.objects.filter(account_id=account.id).exclude(transaction_id=transaction_id).exists():
177
+ if (
178
+ PaymeTransactions.objects.filter(account_id=account.pk)
179
+ .exclude(transaction_id=transaction_id)
180
+ .exists()
181
+ ):
179
182
  message = f"Transaction {transaction_id} already exists (Payme)."
180
183
  logger.warning(message)
181
184
  raise exceptions.TransactionAlreadyExists(message)
@@ -297,6 +300,7 @@ class PaymeWebHookAPIView(views.APIView):
297
300
  "create_time": time_to_payme(transaction.created_at),
298
301
  "perform_time": time_to_payme(transaction.performed_at),
299
302
  "cancel_time": time_to_payme(transaction.cancelled_at),
303
+ "time": time_to_payme(transaction.created_at),
300
304
  })
301
305
 
302
306
  return result.as_resp()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: payme-pkg
3
- Version: 3.0.25b0
3
+ Version: 3.0.29
4
4
  Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
5
5
  Author: Muhammadali Akbarov
6
6
  Author-email: muhammadali17abc@gmail.com
@@ -8,9 +8,18 @@ License: MIT
8
8
  Keywords: paymeuz paycomuz payme-merchant merchant-api subscribe-api payme-pkg payme-api
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
- Requires-Dist: requests (==2.*)
12
- Requires-Dist: djangorestframework (==3.*)
13
- Requires-Dist: dataclasses (==0.*) ; python_version < "3.7"
11
+ Requires-Dist: requests==2.*
12
+ Requires-Dist: dataclasses==0.*; python_version < "3.7"
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,32 +1,34 @@
1
1
  payme/__init__.py,sha256=dzLIyA9kQl0sO6z9nHkZDTjkfiI1BepdifKtJbjX2Cw,46
2
- payme/admin.py,sha256=k4_kAX6k8993aQo_7xokIc7InUVw4LGZT5ROn-C9EYU,561
2
+ payme/admin.py,sha256=dEpd49Qo-LqhRH5FgZ8EiwVYOL4RxNrJa3uP_bkOoSE,561
3
3
  payme/apps.py,sha256=HHCY4zUNKPcjz25z0MahZcks0lsAxTGPS0Ml3U4DhZc,142
4
4
  payme/const.py,sha256=azndfKR53fe7mDfGW82Q-kwWdMu3x4S1upKc4gkYdlA,214
5
- payme/models.py,sha256=nOVmknNjQkBos7w069ddAp_wTBj14UssdTgO8w8sTdI,4179
5
+ payme/models.py,sha256=bolFZdw3_Qx1cNAgjG8A6UfXgnCxQZNw3IbjFc_WqqU,4189
6
6
  payme/urls.py,sha256=_oUOwxW1Suc5TUmnj--lySYbotRg4yTDkDLJU20CGjE,145
7
7
  payme/util.py,sha256=UFb4cEnaufS_hh9C_0z079CSgJGivYjIgOl2iAFrBMs,625
8
- payme/views.py,sha256=gSQgctinjjAWhEO-kCIF4Jn01yapzHRi2ovtkc6JgJw,12873
8
+ payme/views.py,sha256=Zd9bp1ZBwRsfQ3IPhwf6dLkXnBr9nuCfP83V0K6VBu8,13084
9
9
  payme/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  payme/classes/cards.py,sha256=hjg3Wg189INeStGArQUnoxAAutKFbB6BnwYtMGLA0x0,7621
11
11
  payme/classes/client.py,sha256=HqJdFvgSBKxYsitAukYp6_UEa3J6ChVBUbUC1aGR2XM,904
12
12
  payme/classes/http.py,sha256=OufMeHrj0jTomDJx_6go9GC1NtA6QpQCxIiM3ISy3Eo,3530
13
13
  payme/classes/initializer.py,sha256=Pwb1oCUZzcW-ftFzaLMr8ySguC7fKsbeQ4vGmupYliw,2448
14
- payme/classes/receipts.py,sha256=dnaK-cNcw09tC4x7d_dEdIIxas9YGPhlJCDgCKtKCgo,9789
14
+ payme/classes/receipts.py,sha256=J_ubm1zpqqUY9vOCeSUzJkwtRXYxagaRzzvJZmuP74Q,11010
15
15
  payme/exceptions/__init__.py,sha256=HoBFnDA3eW_xWZiFlonJK4vhBDTsuik91tvgzXTy8KA,94
16
16
  payme/exceptions/general.py,sha256=-rkzvuLi6VoITMLrszrP7c-gM8X6lM8AWttd770KSJc,7679
17
17
  payme/exceptions/webhook.py,sha256=ZW6HnjxZDQScaX0WLXltcEllCwl1m0JuCtEnR28shME,4090
18
18
  payme/migrations/0001_initial.py,sha256=jdtGB6bN-Za6N9XU8IuWsa5FbonGIRH5ro9xHwT7JmU,2128
19
19
  payme/migrations/0002_paymetransactions_fiscal_data.py,sha256=z-gxPP3IgN-XNPx6DEZUQ4E1XZceVnnpvUTcSkcv70c,395
20
20
  payme/migrations/0003_alter_paymetransactions_fiscal_data.py,sha256=Ish4Seup9pdEM0g4q4RQKrvUOWB2DXPN0RmIScKI2IQ,410
21
+ payme/migrations/0004_alter_paymetransactions_account_id.py,sha256=Kzihw4-HHBG43fZ2WU-qLLU-kxN-plfS3mLeIEZGKxA,417
22
+ payme/migrations/0005_alter_paymetransactions_amount.py,sha256=q1oXti3OVmRi0C7fyuD_BgDtH_XW1lMN_rXB72976S8,442
21
23
  payme/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
24
  payme/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
25
  payme/types/request/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
26
  payme/types/response/__init__.py,sha256=GAj5pjZ9oIO67T6YMiPd1fhTIvGrPfTv96tykfeChQc,81
25
27
  payme/types/response/cards.py,sha256=ncGaE5NzI5AJLbrzR41G7jkUHXO71BnrIiaiV-lKsPo,2006
26
- payme/types/response/receipts.py,sha256=nFTMwL2CEGo-7BcdZ9p3wiqYjzYHnMk5nZgsTi6KHcs,4271
28
+ payme/types/response/receipts.py,sha256=zwbe74sKS9lQ7VSz5LnPkdlZZ_WCWorU-P2J0uxRuic,4401
27
29
  payme/types/response/webhook.py,sha256=E8IVD683T7wra4OxUWq5T6y7HGpjwOVk8ak0tS0b-_o,3084
28
- payme_pkg-3.0.25b0.dist-info/LICENSE.txt,sha256=75dBVYmbzWUhwtaB1MSZfj-M-PGaMmeT9UVPli2-ZJ0,1086
29
- payme_pkg-3.0.25b0.dist-info/METADATA,sha256=GM8XhXu03CMEMt8nAfagFPue0LratiNjj_xYC2F5siA,5374
30
- payme_pkg-3.0.25b0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
31
- payme_pkg-3.0.25b0.dist-info/top_level.txt,sha256=8mN-hGAa38pWbhrKHFs9CZywPCdidhMuwPKwuFJa0qw,6
32
- payme_pkg-3.0.25b0.dist-info/RECORD,,
30
+ payme_pkg-3.0.29.dist-info/licenses/LICENSE.txt,sha256=75dBVYmbzWUhwtaB1MSZfj-M-PGaMmeT9UVPli2-ZJ0,1086
31
+ payme_pkg-3.0.29.dist-info/METADATA,sha256=RuAtpUPtv4KZ4MpMsHpydopRIUYedWGOFVGZuzS9DP0,5554
32
+ payme_pkg-3.0.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ payme_pkg-3.0.29.dist-info/top_level.txt,sha256=8mN-hGAa38pWbhrKHFs9CZywPCdidhMuwPKwuFJa0qw,6
34
+ payme_pkg-3.0.29.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5