payme-pkg 3.0.18__tar.gz → 3.0.20__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.

Files changed (35) hide show
  1. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/PKG-INFO +2 -2
  2. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/README.md +1 -1
  3. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/admin.py +1 -2
  4. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/exceptions/general.py +1 -0
  5. payme_pkg-3.0.20/payme/migrations/0001_initial.py +60 -0
  6. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/models.py +2 -11
  7. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/views.py +5 -6
  8. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme_pkg.egg-info/PKG-INFO +2 -2
  9. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme_pkg.egg-info/SOURCES.txt +1 -0
  10. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/setup.py +3 -2
  11. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/LICENSE.txt +0 -0
  12. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/__init__.py +0 -0
  13. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/apps.py +0 -0
  14. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/__init__.py +0 -0
  15. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/cards.py +0 -0
  16. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/client.py +0 -0
  17. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/http.py +0 -0
  18. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/initializer.py +0 -0
  19. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/classes/receipts.py +0 -0
  20. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/const.py +0 -0
  21. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/exceptions/__init__.py +0 -0
  22. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/exceptions/webhook.py +0 -0
  23. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/migrations/__init__.py +0 -0
  24. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/__init__.py +0 -0
  25. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/request/__init__.py +0 -0
  26. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/response/__init__.py +0 -0
  27. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/response/cards.py +0 -0
  28. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/response/receipts.py +0 -0
  29. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/types/response/webhook.py +0 -0
  30. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/urls.py +0 -0
  31. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme/util.py +0 -0
  32. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme_pkg.egg-info/dependency_links.txt +0 -0
  33. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme_pkg.egg-info/requires.txt +0 -0
  34. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/payme_pkg.egg-info/top_level.txt +0 -0
  35. {payme_pkg-3.0.18 → payme_pkg-3.0.20}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: payme-pkg
3
- Version: 3.0.18
3
+ Version: 3.0.20
4
4
  Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
5
5
  Author: Muhammadali Akbarov
6
6
  Author-email: muhammadali17abc@gmail.com
@@ -139,7 +139,7 @@ urlpatterns = [
139
139
 
140
140
  Run migrations
141
141
  ```shell
142
- python3 manage.py makemigrations && python manage.py migrate
142
+ python manage.py migrate
143
143
  ```
144
144
  🎉 Congratulations you have been integrated merchant api methods with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.
145
145
 
@@ -125,7 +125,7 @@ urlpatterns = [
125
125
 
126
126
  Run migrations
127
127
  ```shell
128
- python3 manage.py makemigrations && python manage.py migrate
128
+ python manage.py migrate
129
129
  ```
130
130
  🎉 Congratulations you have been integrated merchant api methods with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.
131
131
 
@@ -1,6 +1,5 @@
1
1
  from django.contrib import admin
2
2
 
3
-
4
3
  from payme.models import PaymeTransactions
5
4
 
6
5
 
@@ -10,7 +9,7 @@ class PaymeTransactionsUI(admin.ModelAdmin):
10
9
  """
11
10
  list_display = ('id', 'state', 'cancel_reason', 'created_at')
12
11
  list_filter = ('state', 'cancel_reason', 'created_at')
13
- search_fields = ('transaction_id', 'account__id')
12
+ search_fields = ('transaction_id', 'account_id')
14
13
  ordering = ('-created_at',)
15
14
 
16
15
 
@@ -272,4 +272,5 @@ errors_map = {
272
272
  -31602: ReceiptsNotFoundError,
273
273
  -32500: InvalidTokenFormat,
274
274
  -31601: UnknownPartnerError,
275
+ -32400: SystemError
275
276
  }
@@ -0,0 +1,60 @@
1
+ # Generated by Django 5.1.2 on 2024-12-22 05:15
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ initial = True
9
+
10
+ dependencies = []
11
+
12
+ operations = [
13
+ migrations.CreateModel(
14
+ name="PaymeTransactions",
15
+ fields=[
16
+ (
17
+ "id",
18
+ models.BigAutoField(
19
+ auto_created=True,
20
+ primary_key=True,
21
+ serialize=False,
22
+ verbose_name="ID",
23
+ ),
24
+ ),
25
+ ("transaction_id", models.CharField(max_length=50)),
26
+ ("account_id", models.BigIntegerField()),
27
+ ("amount", models.DecimalField(decimal_places=2, max_digits=10)),
28
+ (
29
+ "state",
30
+ models.IntegerField(
31
+ choices=[
32
+ (0, "Created"),
33
+ (1, "Initiating"),
34
+ (2, "Successfully"),
35
+ (-2, "Canceled after successful performed"),
36
+ (-1, "Canceled during initiation"),
37
+ ],
38
+ default=0,
39
+ ),
40
+ ),
41
+ ("cancel_reason", models.IntegerField(blank=True, null=True)),
42
+ ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
43
+ ("updated_at", models.DateTimeField(auto_now=True, db_index=True)),
44
+ (
45
+ "performed_at",
46
+ models.DateTimeField(blank=True, db_index=True, null=True),
47
+ ),
48
+ (
49
+ "cancelled_at",
50
+ models.DateTimeField(blank=True, db_index=True, null=True),
51
+ ),
52
+ ],
53
+ options={
54
+ "verbose_name": "Payme Transaction",
55
+ "verbose_name_plural": "Payme Transactions",
56
+ "db_table": "payme_transactions",
57
+ "ordering": ["-created_at"],
58
+ },
59
+ ),
60
+ ]
@@ -4,13 +4,8 @@ It logs any significant modifications to payment transactions such as amount, st
4
4
  allowing for a detailed historical record of each transaction's state over time.
5
5
  """
6
6
  from django.db import models
7
- from django.conf import settings
8
7
  from django.utils import timezone
9
8
 
10
- from django.utils.module_loading import import_string
11
-
12
- AccountModel = import_string(settings.PAYME_ACCOUNT_MODEL)
13
-
14
9
 
15
10
  class PaymeTransactions(models.Model):
16
11
  """
@@ -31,11 +26,7 @@ class PaymeTransactions(models.Model):
31
26
  ]
32
27
 
33
28
  transaction_id = models.CharField(max_length=50)
34
- account = models.ForeignKey(
35
- AccountModel,
36
- related_name="payme_transactions",
37
- on_delete=models.CASCADE
38
- )
29
+ account_id = models.BigIntegerField(null=False)
39
30
  amount = models.DecimalField(max_digits=10, decimal_places=2)
40
31
  state = models.IntegerField(choices=STATE, default=CREATED)
41
32
  cancel_reason = models.IntegerField(null=True, blank=True)
@@ -57,7 +48,7 @@ class PaymeTransactions(models.Model):
57
48
  """
58
49
  String representation of the PaymentTransaction model.
59
50
  """
60
- return f"Payme Transaction #{self.transaction_id} Account: {self.account} - {self.state}"
51
+ return f"Payme Transaction #{self.transaction_id} Account: {self.account_id} - {self.state}"
61
52
 
62
53
  @classmethod
63
54
  def get_by_transaction_id(cls, transaction_id):
@@ -1,17 +1,16 @@
1
1
  import base64
2
- import logging
3
2
  import binascii
3
+ import logging
4
4
  from decimal import Decimal
5
5
 
6
6
  from django.conf import settings
7
7
  from django.utils.module_loading import import_string
8
-
9
8
  from rest_framework import views
10
9
  from rest_framework.response import Response
11
10
 
12
11
  from payme import exceptions
13
- from payme.types import response
14
12
  from payme.models import PaymeTransactions
13
+ from payme.types import response
15
14
  from payme.util import time_to_payme, time_to_service
16
15
 
17
16
  logger = logging.getLogger(__name__)
@@ -169,13 +168,13 @@ class PaymeWebHookAPIView(views.APIView):
169
168
  defaults = {
170
169
  "amount": amount,
171
170
  "state": PaymeTransactions.INITIATING,
172
- "account": account,
171
+ "account_id": account.id,
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=account).exclude(transaction_id=transaction_id).exists():
177
+ if PaymeTransactions.objects.filter(account_id=account.id).exclude(transaction_id=transaction_id).exists():
179
178
  message = f"Transaction {transaction_id} already exists (Payme)."
180
179
  logger.warning(message)
181
180
  raise exceptions.TransactionAlreadyExists(message)
@@ -290,7 +289,7 @@ class PaymeWebHookAPIView(views.APIView):
290
289
  "transaction": transaction.transaction_id,
291
290
  "amount": transaction.amount,
292
291
  "account": {
293
- settings.PAYME_ACCOUNT_FIELD: transaction.account.id
292
+ settings.PAYME_ACCOUNT_FIELD: transaction.account_id
294
293
  },
295
294
  "reason": transaction.cancel_reason,
296
295
  "state": transaction.state,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: payme-pkg
3
- Version: 3.0.18
3
+ Version: 3.0.20
4
4
  Home-page: https://github.com/Muhammadali-Akbarov/payme-pkg
5
5
  Author: Muhammadali Akbarov
6
6
  Author-email: muhammadali17abc@gmail.com
@@ -139,7 +139,7 @@ urlpatterns = [
139
139
 
140
140
  Run migrations
141
141
  ```shell
142
- python3 manage.py makemigrations && python manage.py migrate
142
+ python manage.py migrate
143
143
  ```
144
144
  🎉 Congratulations you have been integrated merchant api methods with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.
145
145
 
@@ -19,6 +19,7 @@ payme/classes/receipts.py
19
19
  payme/exceptions/__init__.py
20
20
  payme/exceptions/general.py
21
21
  payme/exceptions/webhook.py
22
+ payme/migrations/0001_initial.py
22
23
  payme/migrations/__init__.py
23
24
  payme/types/__init__.py
24
25
  payme/types/request/__init__.py
@@ -1,5 +1,6 @@
1
1
  import pathlib
2
- from setuptools import setup, find_packages
2
+
3
+ from setuptools import find_packages, setup
3
4
 
4
5
  here = pathlib.Path(__file__).parent.resolve()
5
6
 
@@ -7,7 +8,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
7
8
 
8
9
  setup(
9
10
  name='payme-pkg',
10
- version='3.0.18',
11
+ version='3.0.20',
11
12
  license='MIT',
12
13
  author="Muhammadali Akbarov",
13
14
  author_email='muhammadali17abc@gmail.com',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes