From a691ef674490871fe12ae687ad148e3601c8e2b2 Mon Sep 17 00:00:00 2001 From: Samar Hassan Date: Thu, 3 Apr 2025 13:14:37 +0100 Subject: [PATCH 1/5] =?UTF-8?q?feat=20=E2=AD=90=20verify=20shipping=20char?= =?UTF-8?q?ge=20upto=204=20decimal=20places?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oscarapi/serializers/checkout.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oscarapi/serializers/checkout.py b/oscarapi/serializers/checkout.py index 59cf9273..e7d0b056 100644 --- a/oscarapi/serializers/checkout.py +++ b/oscarapi/serializers/checkout.py @@ -49,12 +49,12 @@ class PriceSerializer(serializers.Serializer): currency = serializers.CharField( max_length=12, default=django_settings.OSCAR_DEFAULT_CURRENCY, required=False ) - excl_tax = serializers.DecimalField(decimal_places=2, max_digits=12, required=True) + excl_tax = serializers.DecimalField(decimal_places=4, max_digits=12, required=True) incl_tax = TaxIncludedDecimalField( - excl_tax_field="excl_tax", decimal_places=2, max_digits=12, required=False + excl_tax_field="excl_tax", decimal_places=4, max_digits=12, required=False ) tax = TaxIncludedDecimalField( - excl_tax_value="0.00", decimal_places=2, max_digits=12, required=False + excl_tax_value="0.00", decimal_places=4, max_digits=12, required=False ) From a6c3861c9550c99e64577348d79c4f435f4e4f6a Mon Sep 17 00:00:00 2001 From: Samar Hassan Date: Thu, 3 Apr 2025 13:14:52 +0100 Subject: [PATCH 2/5] lint --- oscarapi/basket/operations.py | 1 + oscarapi/serializers/product.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/oscarapi/basket/operations.py b/oscarapi/basket/operations.py index 34e9d766..bd417dda 100644 --- a/oscarapi/basket/operations.py +++ b/oscarapi/basket/operations.py @@ -1,4 +1,5 @@ "This module contains operation on baskets and lines" + from django.conf import settings from oscar.core.loading import get_class, get_model diff --git a/oscarapi/serializers/product.py b/oscarapi/serializers/product.py index aaec8c0f..c127deed 100644 --- a/oscarapi/serializers/product.py +++ b/oscarapi/serializers/product.py @@ -440,6 +440,7 @@ class Meta: class BaseProductSerializer(OscarModelSerializer): "Base class shared by admin and public serializer" + attributes = ProductAttributeValueSerializer( many=True, required=False, source="attribute_values" ) @@ -476,6 +477,7 @@ class Meta: class PublicProductSerializer(BaseProductSerializer): "Serializer base class used for public products api" + url = serializers.HyperlinkedIdentityField(view_name="product-detail") price = serializers.HyperlinkedIdentityField( view_name="product-price", read_only=True @@ -494,6 +496,7 @@ def get_field_names(self, declared_fields, info): class ChildProductSerializer(PublicProductSerializer): "Serializer for child products" + parent = serializers.HyperlinkedRelatedField( view_name="product-detail", queryset=Product.objects.filter(structure=Product.PARENT), @@ -508,6 +511,7 @@ class Meta(PublicProductSerializer.Meta): class ProductSerializer(PublicProductSerializer): "Serializer for public api with strategy fields added for price and availability" + url = serializers.HyperlinkedIdentityField(view_name="product-detail") price = serializers.HyperlinkedIdentityField( view_name="product-price", read_only=True From feea09f50d0d8c94af56b3d65710eb31ed31c3af Mon Sep 17 00:00:00 2001 From: Samar Hassan Date: Tue, 8 Apr 2025 21:23:46 +0100 Subject: [PATCH 3/5] =?UTF-8?q?tests=20=F0=9F=94=A7=20check=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d6b47ce6..6f3546b9 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ clean: rm -Rf build/ install: - pip install -e .[dev] --upgrade --upgrade-strategy=eager --pre + pip install -e .[dev] sandbox: install python sandbox/manage.py migrate From 994ab2faf6af3dabb43101fbd06e1c4bd6f38895 Mon Sep 17 00:00:00 2001 From: Samar Hassan Date: Wed, 9 Apr 2025 07:10:03 +0100 Subject: [PATCH 4/5] =?UTF-8?q?tests=20=E2=9C=85=20use=204=20decimal=20dig?= =?UTF-8?q?its=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oscarapi/tests/unit/testcheckout.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/oscarapi/tests/unit/testcheckout.py b/oscarapi/tests/unit/testcheckout.py index 4d71a3e9..6529e10e 100644 --- a/oscarapi/tests/unit/testcheckout.py +++ b/oscarapi/tests/unit/testcheckout.py @@ -490,9 +490,9 @@ def test_shipping_methods(self): "discount": 0, "price": { "currency": None, - "excl_tax": "0.00", - "incl_tax": "0.00", - "tax": "0.00", + "excl_tax": "0.0000", + "incl_tax": "0.0000", + "tax": "0.0000", }, }, ) @@ -516,9 +516,9 @@ def test_shipping_methods(self): "discount": 0, "price": { "currency": "EUR", - "excl_tax": "0.00", - "incl_tax": "0.00", - "tax": "0.00", + "excl_tax": "0.0000", + "incl_tax": "0.0000", + "tax": "0.0000", }, }, ) From 153fc8c847043cd3a2083647db9df60a6e07e0d6 Mon Sep 17 00:00:00 2001 From: Samar Hassan Date: Thu, 10 Apr 2025 16:44:15 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Revert=20"tests=20=F0=9F=94=A7=20check=20te?= =?UTF-8?q?sts"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit feea09f50d0d8c94af56b3d65710eb31ed31c3af. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6f3546b9..d6b47ce6 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ clean: rm -Rf build/ install: - pip install -e .[dev] + pip install -e .[dev] --upgrade --upgrade-strategy=eager --pre sandbox: install python sandbox/manage.py migrate