ob-dj-store 0.0.20.1__py3-none-any.whl → 0.0.20.5__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/filters.py +5 -19
- ob_dj_store/apis/stores/rest/serializers/serializers.py +26 -35
- ob_dj_store/apis/stores/views.py +74 -226
- ob_dj_store/apis/tap/views.py +2 -6
- ob_dj_store/core/stores/admin.py +3 -21
- ob_dj_store/core/stores/admin_inlines.py +2 -7
- ob_dj_store/core/stores/gateway/tap/admin.py +1 -3
- ob_dj_store/core/stores/gateway/tap/managers.py +1 -6
- ob_dj_store/core/stores/gateway/tap/migrations/0001_initial.py +1 -3
- ob_dj_store/core/stores/gateway/tap/models.py +3 -12
- ob_dj_store/core/stores/gateway/tap/utils.py +2 -7
- ob_dj_store/core/stores/managers.py +1 -3
- ob_dj_store/core/stores/migrations/0001_initial.py +1 -4
- ob_dj_store/core/stores/migrations/0005_auto_20220425_2119.py +2 -5
- ob_dj_store/core/stores/migrations/0005_auto_20220427_1729.py +1 -2
- ob_dj_store/core/stores/migrations/0006_auto_20220428_0100.py +2 -8
- ob_dj_store/core/stores/migrations/0007_cart_cartitem_order_orderitem.py +2 -8
- ob_dj_store/core/stores/migrations/0010_auto_20220509_1633.py +1 -4
- ob_dj_store/core/stores/migrations/0012_auto_20220514_0633.py +1 -4
- ob_dj_store/core/stores/migrations/0013_auto_20220518_1539.py +1 -4
- ob_dj_store/core/stores/migrations/0014_auto_20220519_0018.py +3 -12
- ob_dj_store/core/stores/migrations/0017_auto_20220524_0912.py +3 -10
- ob_dj_store/core/stores/migrations/0018_auto_20220524_1613.py +1 -3
- ob_dj_store/core/stores/migrations/0021_auto_20220531_1849.py +1 -4
- ob_dj_store/core/stores/migrations/0026_auto_20220630_1913.py +8 -32
- ob_dj_store/core/stores/migrations/0031_auto_20220811_1733.py +1 -4
- ob_dj_store/core/stores/migrations/0033_auto_20220815_0133.py +2 -8
- ob_dj_store/core/stores/migrations/0039_auto_20220831_1521.py +1 -4
- ob_dj_store/core/stores/migrations/0044_remove_productvariant_has_inventory.py +1 -4
- ob_dj_store/core/stores/migrations/0049_auto_20221029_1524.py +2 -8
- ob_dj_store/core/stores/migrations/0050_favoriteextra.py +1 -3
- ob_dj_store/core/stores/migrations/0052_auto_20221129_1732.py +2 -8
- ob_dj_store/core/stores/migrations/0059_auto_20230217_2006.py +2 -8
- ob_dj_store/core/stores/migrations/0062_auto_20230226_2005.py +2 -6
- ob_dj_store/core/stores/migrations/0064_auto_20230228_1814.py +1 -2
- ob_dj_store/core/stores/migrations/0066_auto_20230304_1532.py +2 -8
- ob_dj_store/core/stores/migrations/0070_auto_20230323_1628.py +1 -4
- ob_dj_store/core/stores/migrations/0071_auto_20230328_1825.py +2 -5
- ob_dj_store/core/stores/migrations/0082_auto_20230613_1424.py +1 -4
- ob_dj_store/core/stores/migrations/0084_payment_result.py +1 -3
- ob_dj_store/core/stores/migrations/0087_auto_20230828_2138.py +1 -4
- ob_dj_store/core/stores/migrations/0097_auto_20231108_1939.py +1 -4
- ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py +1 -4
- ob_dj_store/core/stores/migrations/0106_alter_paymentmethod_payment_provider.py +35 -0
- ob_dj_store/core/stores/migrations/0107_auto_20250425_2059.py +29 -0
- ob_dj_store/core/stores/migrations/0108_alter_paymentmethod_payment_provider.py +35 -0
- ob_dj_store/core/stores/models/_address.py +1 -3
- ob_dj_store/core/stores/models/_cart.py +1 -3
- ob_dj_store/core/stores/models/_feedback.py +1 -3
- ob_dj_store/core/stores/models/_inventory.py +1 -2
- ob_dj_store/core/stores/models/_order.py +7 -20
- ob_dj_store/core/stores/models/_payment.py +3 -12
- ob_dj_store/core/stores/models/_product.py +5 -17
- ob_dj_store/core/stores/models/_store.py +5 -13
- ob_dj_store/core/stores/models/_wallet.py +7 -23
- ob_dj_store/core/stores/receivers.py +7 -20
- ob_dj_store/core/stores/utils.py +1 -2
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.5.dist-info}/METADATA +3 -2
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.5.dist-info}/RECORD +61 -58
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.5.dist-info}/WHEEL +1 -1
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.5.dist-info}/top_level.txt +0 -0
@@ -49,11 +49,7 @@ class StoreFilter(filters.FilterSet):
|
|
49
49
|
return queryset.filter(address__country=value)
|
50
50
|
|
51
51
|
def by_shipping_methods_names(self, queryset, name, value):
|
52
|
-
return queryset.filter(
|
53
|
-
shipping_methods__name__in=[
|
54
|
-
value,
|
55
|
-
]
|
56
|
-
)
|
52
|
+
return queryset.filter(shipping_methods__name__in=[value,])
|
57
53
|
|
58
54
|
def by_open_stores(self, queryset, name, value):
|
59
55
|
if value:
|
@@ -186,9 +182,7 @@ class CategoryFilter(filters.FilterSet):
|
|
186
182
|
|
187
183
|
def by_type(self, queryset, name, value):
|
188
184
|
return (
|
189
|
-
queryset.filter(
|
190
|
-
subcategories__products__type=value,
|
191
|
-
)
|
185
|
+
queryset.filter(subcategories__products__type=value,)
|
192
186
|
.prefetch_related(
|
193
187
|
Prefetch(
|
194
188
|
"subcategories",
|
@@ -198,9 +192,7 @@ class CategoryFilter(filters.FilterSet):
|
|
198
192
|
),
|
199
193
|
Prefetch(
|
200
194
|
"subcategories__products",
|
201
|
-
queryset=Product.objects.filter(
|
202
|
-
is_active=True,
|
203
|
-
).distinct(),
|
195
|
+
queryset=Product.objects.filter(is_active=True,).distinct(),
|
204
196
|
),
|
205
197
|
)
|
206
198
|
.distinct()
|
@@ -241,10 +233,7 @@ class FavoriteFilter(filters.FilterSet):
|
|
241
233
|
product_variants__inventories__store__pk=value
|
242
234
|
).values_list("id", flat=True)
|
243
235
|
content_type = ContentType.objects.get_for_model(Product)
|
244
|
-
return queryset.filter(
|
245
|
-
content_type=content_type,
|
246
|
-
object_id__in=products_ids,
|
247
|
-
)
|
236
|
+
return queryset.filter(content_type=content_type, object_id__in=products_ids,)
|
248
237
|
|
249
238
|
|
250
239
|
class PaymentMethodFilter(filters.FilterSet):
|
@@ -267,10 +256,7 @@ class PaymentMethodFilter(filters.FilterSet):
|
|
267
256
|
|
268
257
|
class WalletFilter(filters.FilterSet):
|
269
258
|
currency = filters.CharFilter(
|
270
|
-
method="by_currency",
|
271
|
-
validators=[
|
272
|
-
validate_currency,
|
273
|
-
],
|
259
|
+
method="by_currency", validators=[validate_currency,],
|
274
260
|
)
|
275
261
|
country = filters.CharFilter(method="by_country")
|
276
262
|
|
@@ -329,8 +329,7 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
329
329
|
return store
|
330
330
|
|
331
331
|
def _validate_user_address(
|
332
|
-
self,
|
333
|
-
attrs,
|
332
|
+
self, attrs,
|
334
333
|
):
|
335
334
|
if "shipping_address" not in attrs:
|
336
335
|
raise ValidationError(
|
@@ -362,7 +361,7 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
362
361
|
raise serializers.ValidationError(errors)
|
363
362
|
email = gift_details.get("email")
|
364
363
|
phone_number = gift_details.get("phone_number")
|
365
|
-
|
364
|
+
user = self.context["request"].user
|
366
365
|
if email and phone_number:
|
367
366
|
raise serializers.ValidationError(
|
368
367
|
_("Both Email and Phone number cannot be provided.")
|
@@ -376,7 +375,12 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
376
375
|
validate_email(email)
|
377
376
|
except ValidationError:
|
378
377
|
raise serializers.ValidationError(_("Invalid Email format."))
|
378
|
+
try:
|
379
|
+
if not gift_details["currency"]:
|
380
|
+
gift_details["currency"] = get_currency_by_country(user.country.code)
|
379
381
|
|
382
|
+
except Exception:
|
383
|
+
raise serializers.ValidationError("Currency is required")
|
380
384
|
if not pycountry.currencies.get(alpha_3=gift_details["currency"]):
|
381
385
|
raise serializers.ValidationError("Gift currency is not valid")
|
382
386
|
try:
|
@@ -412,13 +416,9 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
412
416
|
logger.info(
|
413
417
|
f"The fix for UAE stores timezone failed due to this error {e}"
|
414
418
|
)
|
415
|
-
if
|
416
|
-
|
417
|
-
|
418
|
-
_("Pickup time must be between store's opening hours")
|
419
|
-
)
|
420
|
-
elif (
|
421
|
-
not op_hour.always_open
|
419
|
+
if (
|
420
|
+
op_hour.is_open_after_midnight
|
421
|
+
and not op_hour.always_open
|
422
422
|
and pickup_time_time > to_hour
|
423
423
|
or pickup_time_time < from_hour
|
424
424
|
):
|
@@ -731,9 +731,7 @@ class CartItemSerializer(
|
|
731
731
|
"is_multi_variant",
|
732
732
|
)
|
733
733
|
extra_kwargs = {
|
734
|
-
"store": {
|
735
|
-
"required": True,
|
736
|
-
},
|
734
|
+
"store": {"required": True,},
|
737
735
|
}
|
738
736
|
|
739
737
|
def get_is_multi_variant(self, obj):
|
@@ -774,9 +772,9 @@ class CartItemSerializer(
|
|
774
772
|
favorites = Favorite.objects.favorites_for_object(
|
775
773
|
obj.product_variant.product, user
|
776
774
|
)
|
777
|
-
customization = [
|
778
|
-
obj.
|
779
|
-
]
|
775
|
+
customization = [obj.product_variant,] + [
|
776
|
+
attribute_choice for attribute_choice in obj.attribute_choices.all()
|
777
|
+
]
|
780
778
|
for favorite in favorites:
|
781
779
|
content_objects = [
|
782
780
|
instance.content_object for instance in favorite.extras.all()
|
@@ -1167,7 +1165,6 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
|
|
1167
1165
|
"image",
|
1168
1166
|
"busy_mode",
|
1169
1167
|
"name_arabic",
|
1170
|
-
"is_open_after_midnight",
|
1171
1168
|
)
|
1172
1169
|
extra_kwargs = {
|
1173
1170
|
"image": {"read_only": True, "required": False},
|
@@ -1181,16 +1178,16 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
|
|
1181
1178
|
if current_op_hour:
|
1182
1179
|
from_hour = current_op_hour.from_hour
|
1183
1180
|
to_hour = current_op_hour.to_hour
|
1184
|
-
if current_time.tzinfo.zone != "Asia/Dubai":
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
if
|
1181
|
+
# if current_time.tzinfo.zone != "Asia/Dubai":
|
1182
|
+
# if obj.currency == "AED":
|
1183
|
+
# try:
|
1184
|
+
# current_time += timedelta(hours=1)
|
1185
|
+
# except Exception as e:
|
1186
|
+
# logger.info(
|
1187
|
+
# f"The fix for UAE stores timezone failed due to this error {e}"
|
1188
|
+
# )
|
1189
|
+
|
1190
|
+
if current_op_hour.is_open_after_midnight:
|
1194
1191
|
return True if to_hour < current_time.time() < from_hour else False
|
1195
1192
|
|
1196
1193
|
if current_op_hour.always_open:
|
@@ -1812,9 +1809,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1812
1809
|
status=OneTruePairing.Statuses.init,
|
1813
1810
|
created_at__gte=timeout,
|
1814
1811
|
).get(
|
1815
|
-
email=attrs["email"],
|
1816
|
-
partner_otp_auth__partner=partner,
|
1817
|
-
user=user,
|
1812
|
+
email=attrs["email"], partner_otp_auth__partner=partner, user=user,
|
1818
1813
|
)
|
1819
1814
|
self.context["otp"] = otp
|
1820
1815
|
except ObjectDoesNotExist as e:
|
@@ -1851,11 +1846,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1851
1846
|
otp.status = OneTruePairing.Statuses.used
|
1852
1847
|
otp.save()
|
1853
1848
|
partner_auth_info = PartnerAuthInfo.objects.update_or_create(
|
1854
|
-
user=user,
|
1855
|
-
defaults={
|
1856
|
-
"partner": partner,
|
1857
|
-
"email": validated_data["email"],
|
1858
|
-
},
|
1849
|
+
user=user, defaults={"partner": partner, "email": validated_data["email"],},
|
1859
1850
|
)
|
1860
1851
|
return partner_auth_info
|
1861
1852
|
|