ob-dj-store 0.0.17.9__py3-none-any.whl → 0.0.18.1__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.
- ob_dj_store/apis/stores/rest/serializers/serializers.py +8 -2
- ob_dj_store/core/stores/admin.py +26 -1
- ob_dj_store/core/stores/gateway/tap/utils.py +2 -0
- ob_dj_store/core/stores/managers.py +2 -0
- ob_dj_store/core/stores/migrations/0103_alter_paymentmethod_payment_provider.py +35 -0
- ob_dj_store/core/stores/models/_payment.py +2 -0
- ob_dj_store/core/stores/models/_store.py +1 -1
- {ob_dj_store-0.0.17.9.dist-info → ob_dj_store-0.0.18.1.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.17.9.dist-info → ob_dj_store-0.0.18.1.dist-info}/RECORD +11 -10
- {ob_dj_store-0.0.17.9.dist-info → ob_dj_store-0.0.18.1.dist-info}/WHEEL +0 -0
- {ob_dj_store-0.0.17.9.dist-info → ob_dj_store-0.0.18.1.dist-info}/top_level.txt +0 -0
@@ -480,9 +480,10 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
480
480
|
def perform_payment(self, amount, payment_method, order_store, orders, currency):
|
481
481
|
from ob_dj_store.core.stores.gateway.tap.utils import TapException
|
482
482
|
|
483
|
+
user = self.context["request"].user
|
483
484
|
try:
|
484
485
|
payment = Payment.objects.create(
|
485
|
-
user=
|
486
|
+
user=user,
|
486
487
|
amount=amount,
|
487
488
|
method=payment_method,
|
488
489
|
currency=currency,
|
@@ -493,7 +494,10 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
493
494
|
raise serializers.ValidationError(detail=err.messages)
|
494
495
|
except TapException as err:
|
495
496
|
raise serializers.ValidationError({"tap": _(str(err))})
|
496
|
-
except ObjectDoesNotExist:
|
497
|
+
except ObjectDoesNotExist as err:
|
498
|
+
logger.error(
|
499
|
+
f"Payment Object not created: user:{user}, method:{payment_method}, currency:{currency}, error:{err}"
|
500
|
+
)
|
497
501
|
tap_transaction = None
|
498
502
|
|
499
503
|
return {
|
@@ -1527,6 +1531,8 @@ class WalletTopUpSerializer(serializers.Serializer):
|
|
1527
1531
|
store_settings.TAP_ALL,
|
1528
1532
|
store_settings.APPLE_PAY,
|
1529
1533
|
store_settings.GOOGLE_PAY,
|
1534
|
+
store_settings.MADA,
|
1535
|
+
store_settings.BENEFIT,
|
1530
1536
|
]
|
1531
1537
|
),
|
1532
1538
|
required=True,
|
ob_dj_store/core/stores/admin.py
CHANGED
@@ -3,6 +3,7 @@ from typing import Any
|
|
3
3
|
|
4
4
|
from django import forms
|
5
5
|
from django.contrib import admin
|
6
|
+
from django.db.models.functions import ExtractWeek
|
6
7
|
from django.utils.translation import gettext_lazy as _
|
7
8
|
from import_export.admin import ImportExportModelAdmin
|
8
9
|
from leaflet.admin import LeafletGeoAdmin
|
@@ -300,6 +301,26 @@ class AdressAdmin(LeafletGeoAdmin):
|
|
300
301
|
]
|
301
302
|
|
302
303
|
|
304
|
+
class WeekNumberFilter(admin.SimpleListFilter):
|
305
|
+
title = _("Week Number")
|
306
|
+
parameter_name = "week_number"
|
307
|
+
|
308
|
+
def lookups(self, request, model_admin):
|
309
|
+
return (
|
310
|
+
("1", _("Week 1")),
|
311
|
+
("2", _("Week 2")),
|
312
|
+
("3", _("Week 3")),
|
313
|
+
("4", _("Week 4")),
|
314
|
+
)
|
315
|
+
|
316
|
+
def queryset(self, request, queryset):
|
317
|
+
if self.value():
|
318
|
+
queryset = queryset.annotate(week_number=ExtractWeek("created_at")).filter(
|
319
|
+
week_number=self.value()
|
320
|
+
)
|
321
|
+
return queryset
|
322
|
+
|
323
|
+
|
303
324
|
class OrderAdmin(ImportExportModelAdmin, admin.ModelAdmin):
|
304
325
|
list_display = [
|
305
326
|
"id",
|
@@ -318,11 +339,13 @@ class OrderAdmin(ImportExportModelAdmin, admin.ModelAdmin):
|
|
318
339
|
"id",
|
319
340
|
]
|
320
341
|
date_hierarchy = "created_at"
|
342
|
+
|
321
343
|
list_filter = [
|
322
344
|
"payment_method",
|
323
345
|
"shipping_method",
|
324
346
|
"store",
|
325
347
|
"status",
|
348
|
+
WeekNumberFilter, # Include the filter instance instead of the class name
|
326
349
|
]
|
327
350
|
|
328
351
|
def get_queryset(self, request):
|
@@ -422,9 +445,11 @@ class WalletTransactionAdmin(ImportExportModelAdmin, admin.ModelAdmin):
|
|
422
445
|
]
|
423
446
|
search_fields = [
|
424
447
|
"wallet__user__email",
|
425
|
-
"
|
448
|
+
"wallet__currency",
|
426
449
|
]
|
427
450
|
|
451
|
+
autocomplete_fields = ["wallet"]
|
452
|
+
|
428
453
|
def user(self, obj) -> typing.Text:
|
429
454
|
return obj.wallet.user.email
|
430
455
|
|
@@ -133,6 +133,8 @@ def initiate_payment(
|
|
133
133
|
settings.TAP_CREDIT_CARD,
|
134
134
|
settings.TAP_KNET,
|
135
135
|
settings.TAP_ALL,
|
136
|
+
settings.MADA,
|
137
|
+
settings.BENEFIT,
|
136
138
|
]
|
137
139
|
if not payment_transaction and source in tap_sources:
|
138
140
|
# TODO: How does this issue occur and is this the best way to handle it?
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Generated by Django 3.2.8 on 2024-01-04 14:53
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("stores", "0102_partner_name_arabic"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AlterField(
|
14
|
+
model_name="paymentmethod",
|
15
|
+
name="payment_provider",
|
16
|
+
field=models.CharField(
|
17
|
+
choices=[
|
18
|
+
("cod", "cash on delivery"),
|
19
|
+
("src_all", "TAP all payment methods"),
|
20
|
+
("src_card", "Tap Credit Card"),
|
21
|
+
("src_kw.knet", "Tap knet"),
|
22
|
+
("paypal", "Paypal"),
|
23
|
+
("stripe", "Stripe"),
|
24
|
+
("wallet", "Wallet"),
|
25
|
+
("gift", "Gift"),
|
26
|
+
("apple_pay", "Apple Pay"),
|
27
|
+
("google_pay", "Google Pay"),
|
28
|
+
("src_sa.mada", "Mada"),
|
29
|
+
("src_bh.benefit", "Benefit"),
|
30
|
+
],
|
31
|
+
default="cod",
|
32
|
+
max_length=20,
|
33
|
+
),
|
34
|
+
),
|
35
|
+
]
|
@@ -3,17 +3,17 @@ ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
3
3
|
ob_dj_store/apis/stores/filters.py,sha256=zKBXPBoqIyFlSeZOECp97RTWvSLqNPnlPhEp7p8W5tE,9702
|
4
4
|
ob_dj_store/apis/stores/urls.py,sha256=7vwogfIGcKS0hHYK3iBXKQwi1kCA_vuHY1eZt8rAspg,2021
|
5
5
|
ob_dj_store/apis/stores/views.py,sha256=aE4LFPHzs_CtzZ8K5-vAbDn_51hyhi0KIsi7cV8dpkA,43372
|
6
|
-
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=
|
6
|
+
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=kgLC1H2hjfKDRgvdwCp7ok7em73FtaxoiSF8sacXAIY,62012
|
7
7
|
ob_dj_store/apis/tap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
ob_dj_store/apis/tap/serializers.py,sha256=KPrBK4h2-fWvEVf6vOj2ww5-USV9WqpyYicIqoHIiXI,1065
|
9
9
|
ob_dj_store/apis/tap/urls.py,sha256=bnOTv6an11kxpo_FdqlhsizlGPLVpNxBjCyKcf3_C9M,367
|
10
10
|
ob_dj_store/apis/tap/views.py,sha256=VnVquybTHlJquxsC0RNTy20dtLXalchO0SlGjSDaBng,2666
|
11
11
|
ob_dj_store/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
ob_dj_store/core/stores/__init__.py,sha256=-izNGrxNn_nn3IQXd5pkuES9lSF-AHYb14yhNPozYCI,65
|
13
|
-
ob_dj_store/core/stores/admin.py,sha256=
|
13
|
+
ob_dj_store/core/stores/admin.py,sha256=_zg10EVLLOfL8CdSsG7mRpZmxrigBS6tx25XU55caJ8,13453
|
14
14
|
ob_dj_store/core/stores/admin_inlines.py,sha256=2K8iDmP4h0CLIOqy3x-ZXXpgYnT2jqL4cg5YFdiho8s,2976
|
15
15
|
ob_dj_store/core/stores/apps.py,sha256=ZadmEER_dNcQTH617b3fAsYZJSyRw0g46Kjp4eOAsOU,498
|
16
|
-
ob_dj_store/core/stores/managers.py,sha256=
|
16
|
+
ob_dj_store/core/stores/managers.py,sha256=lz2CE4PJCI1ViO-CU61LqTr43O41aGRQkbWZUR5Fmfg,9909
|
17
17
|
ob_dj_store/core/stores/receivers.py,sha256=DljYC97C_e1mHduKw9Un6YQmxIdwSIter7yVVZwggFA,3768
|
18
18
|
ob_dj_store/core/stores/settings_validation.py,sha256=eTkRaI6CG5OEJQyI5CF-cNAcvjzXf3GwX5sR97O3v98,3977
|
19
19
|
ob_dj_store/core/stores/utils.py,sha256=l09CT9rst0DtcyUTlDQ47yjOxqI_ilN-Du0jbVGZF3c,3081
|
@@ -23,7 +23,7 @@ ob_dj_store/core/stores/gateway/tap/admin.py,sha256=3KgawxLjvpMsYXl_hx1DlKYpsMd-
|
|
23
23
|
ob_dj_store/core/stores/gateway/tap/apps.py,sha256=kWwPjuAJeEmEasVDzUbvRsGaQWL-aYe4JDHNLvCVXPs,212
|
24
24
|
ob_dj_store/core/stores/gateway/tap/managers.py,sha256=vjZAVFwV7FMIzNeaTh-A68RfFrfSoKEkuBI16VIAa10,875
|
25
25
|
ob_dj_store/core/stores/gateway/tap/models.py,sha256=CG5lSG97xUX172zw2FKjYrgMEKxTPRxE0TB64I5KXQM,4852
|
26
|
-
ob_dj_store/core/stores/gateway/tap/utils.py,sha256=
|
26
|
+
ob_dj_store/core/stores/gateway/tap/utils.py,sha256=jsdE-ACKy7hUYXgQXCg1NFNF5H9I3mGVJabZHWhmKdg,5240
|
27
27
|
ob_dj_store/core/stores/gateway/tap/migrations/0001_initial.py,sha256=_303R1R2tVVdPSMtwpuLUxvWbxQ2BML1Gsd-VhfnZEM,4808
|
28
28
|
ob_dj_store/core/stores/gateway/tap/migrations/0002_auto_20220815_1610.py,sha256=gRsekTbqUH4h5yg5d1zWuai7Wiv6-rfsmjnXundgin8,674
|
29
29
|
ob_dj_store/core/stores/gateway/tap/migrations/0003_auto_20220818_1938.py,sha256=pptUxq-AZtziRen5EvuahAVihcINEx_WTdpI28HBVUs,598
|
@@ -135,6 +135,7 @@ ob_dj_store/core/stores/migrations/0099_alter_product_name_arabic.py,sha256=dVv6
|
|
135
135
|
ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py,sha256=3rwZhXsOqbo4jdW6AT5ClaDqXPYbMfP1JOesNzy-Ldw,347
|
136
136
|
ob_dj_store/core/stores/migrations/0101_store_is_digital.py,sha256=yDs7c23WLdhnx82VBw0Fs_YJ0-IgfxLMvMsCkIiThFU,404
|
137
137
|
ob_dj_store/core/stores/migrations/0102_partner_name_arabic.py,sha256=iJIiy5isLYv9Jv2sd-NOyZkwySNlXOEqGTOWE3wLH5w,411
|
138
|
+
ob_dj_store/core/stores/migrations/0103_alter_paymentmethod_payment_provider.py,sha256=yCDvU60LMCrJM4BDdyl1PpMcAirJDAyjpqTDH_cjC8g,1079
|
138
139
|
ob_dj_store/core/stores/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
139
140
|
ob_dj_store/core/stores/models/__init__.py,sha256=VeWrDiIbw94ZDSFD-62rz9iTTW87iPdwDW5jcjxm7bs,2045
|
140
141
|
ob_dj_store/core/stores/models/_address.py,sha256=8zV444A8M7P8yqQHjEOCROUykWPQ1ndSdd2IIX8wwWY,2207
|
@@ -144,15 +145,15 @@ ob_dj_store/core/stores/models/_feedback.py,sha256=eCUVgprNK5hSRKOS4M_pdR7QH2-rq
|
|
144
145
|
ob_dj_store/core/stores/models/_inventory.py,sha256=ZU8xDMQZxLnFehkBEGWr-os4AF1IlCn5XnBxvRq9IAs,4314
|
145
146
|
ob_dj_store/core/stores/models/_order.py,sha256=hFdlAQcN-iZM6_RaIWJ_FATwTER7pHCGoGSqc2prWBM,9710
|
146
147
|
ob_dj_store/core/stores/models/_partner.py,sha256=Rm7viyuJWGT2abZcqu1axmLvi7bdlfmgL1qd2gzshVA,4544
|
147
|
-
ob_dj_store/core/stores/models/_payment.py,sha256=
|
148
|
+
ob_dj_store/core/stores/models/_payment.py,sha256=bzuf9J0rh1LwKrS_krtxa55x2rHYvwehupJop9zRy6A,6491
|
148
149
|
ob_dj_store/core/stores/models/_product.py,sha256=F4GPoYXxmw-LC8Gben7RRFly-NmnjcvQhT6hrDggKbw,17665
|
149
|
-
ob_dj_store/core/stores/models/_store.py,sha256=
|
150
|
+
ob_dj_store/core/stores/models/_store.py,sha256=BVvxzhZbBj7bAtHljmodjCTsqCO2uKReyHmx-9r5zro,9633
|
150
151
|
ob_dj_store/core/stores/models/_wallet.py,sha256=Eb1Sy79_M8PGrcfd5Bri0fT-bkwyqfkPHNyC2T7CR_0,5454
|
151
152
|
ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
152
153
|
ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
|
153
154
|
ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
|
154
155
|
ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
|
155
|
-
ob_dj_store-0.0.
|
156
|
-
ob_dj_store-0.0.
|
157
|
-
ob_dj_store-0.0.
|
158
|
-
ob_dj_store-0.0.
|
156
|
+
ob_dj_store-0.0.18.1.dist-info/METADATA,sha256=vvIqd9hwnFkSm7YxiXHZwFmwVC35vzpXTNJB7PCCFkI,2827
|
157
|
+
ob_dj_store-0.0.18.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
158
|
+
ob_dj_store-0.0.18.1.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
|
159
|
+
ob_dj_store-0.0.18.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|