payme-pkg 3.0.19__py3-none-any.whl → 3.0.20__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 +1 -2
- payme/migrations/0001_initial.py +60 -0
- payme/models.py +2 -11
- payme/views.py +5 -6
- {payme_pkg-3.0.19.dist-info → payme_pkg-3.0.20.dist-info}/METADATA +5 -5
- {payme_pkg-3.0.19.dist-info → payme_pkg-3.0.20.dist-info}/RECORD +9 -8
- {payme_pkg-3.0.19.dist-info → payme_pkg-3.0.20.dist-info}/WHEEL +1 -1
- {payme_pkg-3.0.19.dist-info → payme_pkg-3.0.20.dist-info}/LICENSE.txt +0 -0
- {payme_pkg-3.0.19.dist-info → payme_pkg-3.0.20.dist-info}/top_level.txt +0 -0
payme/admin.py
CHANGED
|
@@ -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', '
|
|
12
|
+
search_fields = ('transaction_id', 'account_id')
|
|
14
13
|
ordering = ('-created_at',)
|
|
15
14
|
|
|
16
15
|
|
|
@@ -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
|
+
]
|
payme/models.py
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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):
|
payme/views.py
CHANGED
|
@@ -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
|
-
"
|
|
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(
|
|
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.
|
|
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.
|
|
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
|
|
@@ -8,9 +8,9 @@ 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
|
|
12
|
-
Requires-Dist: djangorestframework
|
|
13
|
-
Requires-Dist: dataclasses
|
|
11
|
+
Requires-Dist: requests ==2.*
|
|
12
|
+
Requires-Dist: djangorestframework ==3.*
|
|
13
|
+
Requires-Dist: dataclasses ==0.* ; python_version < "3.7"
|
|
14
14
|
|
|
15
15
|
<h1 align="center">Payme Software Development Kit</h1>
|
|
16
16
|
|
|
@@ -139,7 +139,7 @@ urlpatterns = [
|
|
|
139
139
|
|
|
140
140
|
Run migrations
|
|
141
141
|
```shell
|
|
142
|
-
|
|
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
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
payme/__init__.py,sha256=dzLIyA9kQl0sO6z9nHkZDTjkfiI1BepdifKtJbjX2Cw,46
|
|
2
|
-
payme/admin.py,sha256=
|
|
2
|
+
payme/admin.py,sha256=QW93VTNRZ3qr2eMySX0odyQDmBXJDMXVPCzJPLH78GI,468
|
|
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=C0-dbXEpzZBx1-GsdBXwKQt7gJ6AvgPO6l-3VljfNtw,4130
|
|
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=AYWXP9zJGcLkTM91RIiL6Ou4RHqLph3NyYIlzPAN3fU,11939
|
|
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=_eMcSTiwMdwIe0aeccVav-43Uq7ORdH7idOuSTPjpcg,837
|
|
@@ -15,6 +15,7 @@ payme/classes/receipts.py,sha256=KU4qyGHWZpWW88SjmmTD_N2Tz8pWOCvBbOPnw5tcS3Y,100
|
|
|
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=f0J-fmCW_wpgsTmjGAOtyoZjIOoFpbQwkh_7cZUZkv0,3046
|
|
18
|
+
payme/migrations/0001_initial.py,sha256=jdtGB6bN-Za6N9XU8IuWsa5FbonGIRH5ro9xHwT7JmU,2128
|
|
18
19
|
payme/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
20
|
payme/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
21
|
payme/types/request/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -22,8 +23,8 @@ payme/types/response/__init__.py,sha256=GAj5pjZ9oIO67T6YMiPd1fhTIvGrPfTv96tykfeC
|
|
|
22
23
|
payme/types/response/cards.py,sha256=ilXFDUOPNabVsrQN1KWEzDiL6cDxdVvCbfEl6jCzGpU,1997
|
|
23
24
|
payme/types/response/receipts.py,sha256=TlZeJyymRVHIorg0kbUaogy6MZxN1oq2jHGVRUnlY5A,4070
|
|
24
25
|
payme/types/response/webhook.py,sha256=Br6Gr_-h7sCmOc3ag7H5yBryB8j-bm2mrt39Cy_Fy2E,2918
|
|
25
|
-
payme_pkg-3.0.
|
|
26
|
-
payme_pkg-3.0.
|
|
27
|
-
payme_pkg-3.0.
|
|
28
|
-
payme_pkg-3.0.
|
|
29
|
-
payme_pkg-3.0.
|
|
26
|
+
payme_pkg-3.0.20.dist-info/LICENSE.txt,sha256=75dBVYmbzWUhwtaB1MSZfj-M-PGaMmeT9UVPli2-ZJ0,1086
|
|
27
|
+
payme_pkg-3.0.20.dist-info/METADATA,sha256=T_NZ7hWGdfTLYcgTYfq7QG693MG088odgIQYz1ZdrKY,5492
|
|
28
|
+
payme_pkg-3.0.20.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
payme_pkg-3.0.20.dist-info/top_level.txt,sha256=8mN-hGAa38pWbhrKHFs9CZywPCdidhMuwPKwuFJa0qw,6
|
|
30
|
+
payme_pkg-3.0.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|