Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix review remarks

fowczarekf6a298bbcda0
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.py
index 2ad8c078d9..efa1bb3d9f 100644
--- a/saleor/checkout/utils.py
+++ b/saleor/checkout/utils.py
@@ -131,7 +131,7 @@ def get_prices_of_discounted_specific_product(lines, voucher, discounts=None):
discounted_lines.extend(list(lines))
for line in discounted_lines:
- line_total = calculate_checkout_line_total(line, discounts).gross
+ line_total = calculate_checkout_line_total(line, discounts or []).gross
line_unit_price = quantize_price(
(line_total / line.quantity), line_total.currency
)
@@ -148,7 +148,7 @@ def get_prices_of_discounted_products(checkout, discounted_products, discounts=N
if discounted_products:
for line in checkout:
if line.variant.product in discounted_products:
- line_total = calculate_checkout_line_total(line, discounts).gross
+ line_total = calculate_checkout_line_total(line, discounts or []).gross
line_unit_price = quantize_price(
(line_total / line.quantity), line_total.currency
)
@@ -169,7 +169,7 @@ def get_prices_of_products_in_discounted_collections(
continue
product_collections = line.variant.product.collections.all()
if set(product_collections).intersection(discounted_collections):
- line_total = calculate_checkout_line_total(line, discounts).gross
+ line_total = calculate_checkout_line_total(line, discounts or []).gross
line_unit_price = quantize_price(
(line_total / line.quantity), line_total.currency
)
@@ -195,7 +195,7 @@ def get_prices_of_products_in_discounted_categories(
continue
product_category = line.variant.product.category
if product_category in discounted_categories:
- line_total = calculate_checkout_line_total(line, discounts).gross
+ line_total = calculate_checkout_line_total(line, discounts or []).gross
line_unit_price = quantize_price(
(line_total / line.quantity), line_total.currency
)
diff --git a/saleor/dashboard/discount/forms.py b/saleor/dashboard/discount/forms.py
index 7509c9b910..36c802a291 100644
--- a/saleor/dashboard/discount/forms.py
+++ b/saleor/dashboard/discount/forms.py
@@ -93,7 +93,7 @@ class VoucherForm(forms.ModelForm):
"name": pgettext_lazy("Item name", "Name"),
"code": pgettext_lazy("Coupon code", "Code"),
"usage_limit": pgettext_lazy("Usage limit", "Usage limit"),
- "min_quantity_of_products": pgettext_lazy(
+ "min_checkout_items_quantity": pgettext_lazy(
"Voucher: discount with", "Minimal quantity of products"
),
"start_date": pgettext_lazy("Voucher date restrictions", "Start date"),
@@ -128,7 +128,7 @@ class ShippingVoucherForm(forms.ModelForm):
class Meta:
model = Voucher
- fields = ["countries", "min_amount_spent", "min_quantity_of_products"]
+ fields = ["countries", "min_amount_spent", "min_checkout_items_quantity"]
class EntireOrderVoucherForm(forms.ModelForm):
@@ -136,7 +136,7 @@ class EntireOrderVoucherForm(forms.ModelForm):
class Meta:
model = Voucher
- fields = ["min_amount_spent", "min_quantity_of_products"]
+ fields = ["min_amount_spent", "min_checkout_items_quantity"]
def save(self, commit=True):
self.instance.category = None
@@ -187,7 +187,7 @@ class SpecificProductVoucherForm(CommonVoucherForm):
"categories",
"apply_once_per_order",
"min_amount_spent",
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
]
labels = {
"collections": pgettext_lazy(
@@ -217,7 +217,7 @@ class ProductVoucherForm(CommonVoucherForm):
"products",
"apply_once_per_order",
"min_amount_spent",
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
]
def __init__(self, *args, **kwargs):
@@ -233,7 +233,7 @@ class CollectionVoucherForm(CommonVoucherForm):
"collections",
"apply_once_per_order",
"min_amount_spent",
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
]
labels = {"collections": pgettext_lazy("Collections", "Collections")}
@@ -255,5 +255,5 @@ class CategoryVoucherForm(CommonVoucherForm):
"categories",
"apply_once_per_order",
"min_amount_spent",
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
]
diff --git a/saleor/discount/migrations/0015_voucher_min_quantity_of_products.py b/saleor/discount/migrations/0015_voucher_min_quantity_of_products.py
index b97e782982..a02951e62d 100644
--- a/saleor/discount/migrations/0015_voucher_min_quantity_of_products.py
+++ b/saleor/discount/migrations/0015_voucher_min_quantity_of_products.py
@@ -10,7 +10,7 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name="voucher",
- name="min_quantity_of_products",
+ name="min_checkout_items_quantity",
field=models.PositiveIntegerField(blank=True, null=True),
)
]
diff --git a/saleor/discount/models.py b/saleor/discount/models.py
index 50831d152a..d7a2eca496 100644
--- a/saleor/discount/models.py
+++ b/saleor/discount/models.py
@@ -21,13 +21,13 @@ class NotApplicable(ValueError):
The error is raised if the order value is below the minimum required
price or the order quantity is below the minimum quantity of items.
Minimum price will be available as the `min_amount_spent` attribute.
- Minimum quantity will be available as the `min_quantity_of_products` attribute.
+ Minimum quantity will be available as the `min_checkout_items_quantity` attribute.
"""
- def __init__(self, msg, min_amount_spent=None, min_quantity_of_products=None):
+ def __init__(self, msg, min_amount_spent=None, min_checkout_items_quantity=None):
super().__init__(msg)
self.min_amount_spent = min_amount_spent
- self.min_quantity_of_products = min_quantity_of_products
+ self.min_checkout_items_quantity = min_checkout_items_quantity
class VoucherQueryset(models.QuerySet):
@@ -75,7 +75,7 @@ class Voucher(models.Model):
null=True,
blank=True,
)
- min_quantity_of_products = models.PositiveIntegerField(null=True, blank=True)
+ min_checkout_items_quantity = models.PositiveIntegerField(null=True, blank=True)
products = models.ManyToManyField("product.Product", blank=True)
collections = models.ManyToManyField("product.Collection", blank=True)
categories = models.ManyToManyField("product.Category", blank=True)
@@ -150,19 +150,19 @@ class Voucher(models.Model):
min_amount_spent=min_amount_spent,
)
- def validate_min_quantity_of_products(self, quantity):
- min_quantity_of_products = self.min_quantity_of_products
- if min_quantity_of_products and min_quantity_of_products > quantity:
+ def validate_min_checkout_items_quantity(self, quantity):
+ min_checkout_items_quantity = self.min_checkout_items_quantity
+ if min_checkout_items_quantity and min_checkout_items_quantity > quantity:
msg = pgettext(
"Voucher not applicable",
(
"This offer is only valid for orders with a minimum of "
- "%(min_quantity_of_products)d quantity."
+ "%(min_checkout_items_quantity)d quantity."
),
)
raise NotApplicable(
- msg % {"min_quantity_of_products": min_quantity_of_products},
- min_quantity_of_products=min_quantity_of_products,
+ msg % {"min_checkout_items_quantity": min_checkout_items_quantity},
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
diff --git a/saleor/discount/utils.py b/saleor/discount/utils.py
index 3b1f303ef8..674293e01d 100644
--- a/saleor/discount/utils.py
+++ b/saleor/discount/utils.py
@@ -64,21 +64,21 @@ def calculate_discounted_price(product, price, discounts: Iterable[DiscountInfo]
def get_value_voucher_discount(voucher, total_price, quantity):
"""Calculate discount value for a voucher of value type."""
voucher.validate_min_amount_spent(total_price)
- voucher.validate_min_quantity_of_products(quantity)
+ voucher.validate_min_checkout_items_quantity(quantity)
return voucher.get_discount_amount_for(total_price)
def get_shipping_voucher_discount(voucher, total_price, shipping_price, quantity):
"""Calculate discount value for a voucher of shipping type."""
voucher.validate_min_amount_spent(total_price)
- voucher.validate_min_quantity_of_products(quantity)
+ voucher.validate_min_checkout_items_quantity(quantity)
return voucher.get_discount_amount_for(shipping_price)
def get_products_voucher_discount(voucher, prices, total_price, quantity):
"""Calculate discount value for a voucher of product or category type."""
voucher.validate_min_amount_spent(total_price)
- voucher.validate_min_quantity_of_products(quantity)
+ voucher.validate_min_checkout_items_quantity(quantity)
if voucher.apply_once_per_order:
return voucher.get_discount_amount_for(min(prices))
discounts = (voucher.get_discount_amount_for(price) for price in prices)
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.py
index 286d55cc8c..f44dc82ae3 100644
--- a/saleor/graphql/discount/mutations.py
+++ b/saleor/graphql/discount/mutations.py
@@ -101,8 +101,8 @@ class VoucherInput(graphene.InputObjectType):
min_amount_spent = Decimal(
description="Min purchase amount required to apply the voucher."
)
- min_quantity_of_products = graphene.Int(
- description="Minimal quantity of products required to apply the voucher."
+ min_checkout_items_quantity = graphene.Int(
+ description="Minimal quantity of checkout items required to apply the voucher."
)
countries = graphene.List(
graphene.String,
diff --git a/saleor/graphql/discount/types.py b/saleor/graphql/discount/types.py
index 8d0c3e8bc3..88710c0714 100644
--- a/saleor/graphql/discount/types.py
+++ b/saleor/graphql/discount/types.py
@@ -116,7 +116,7 @@ class Voucher(CountableDjangoObjectType):
"end_date",
"id",
"min_amount_spent",
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
"name",
"start_date",
"type",
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 5da99f3bac..1589badc3e 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3131,7 +3131,7 @@ type Voucher implements Node {
discountValueType: DiscountValueTypeEnum!
discountValue: Float!
minAmountSpent: Money
- minQuantityOfProducts: Int
+ minCheckoutItemsQuantity: Int
categories(before: String, after: String, first: Int, last: Int): CategoryCountableConnection
collections(before: String, after: String, first: Int, last: Int): CollectionCountableConnection
products(before: String, after: String, first: Int, last: Int): ProductCountableConnection
@@ -3196,7 +3196,7 @@ input VoucherInput {
collections: [ID]
categories: [ID]
minAmountSpent: Decimal
- minQuantityOfProducts: Int
+ minCheckoutItemsQuantity: Int
countries: [String]
applyOncePerOrder: Boolean
usageLimit: Int
diff --git a/tests/api/test_discount.py b/tests/api/test_discount.py
index ad4ff9ea17..44b5d670ad 100644
--- a/tests/api/test_discount.py
+++ b/tests/api/test_discount.py
@@ -141,14 +141,14 @@ CREATE_VOUCHER_MUTATION = """
mutation voucherCreate(
$type: VoucherTypeEnum, $name: String, $code: String,
$discountValueType: DiscountValueTypeEnum, $usageLimit: Int,
- $discountValue: Decimal, $minAmountSpent: Decimal, $minQuantityOfProducts: Int,
+ $discountValue: Decimal, $minAmountSpent: Decimal, $minCheckoutItemsQuantity: Int,
$startDate: DateTime, $endDate: DateTime, $applyOncePerOrder: Boolean) {
voucherCreate(input: {
name: $name, type: $type, code: $code,
discountValueType: $discountValueType,
discountValue: $discountValue,
minAmountSpent: $minAmountSpent,
- minQuantityOfProducts: $minQuantityOfProducts,
+ minCheckoutItemsQuantity: $minCheckoutItemsQuantity,
startDate: $startDate, endDate: $endDate,
applyOncePerOrder: $applyOncePerOrder, usageLimit: $usageLimit}) {
errors {
@@ -160,7 +160,7 @@ mutation voucherCreate(
minAmountSpent {
amount
}
- minQuantityOfProducts
+ minCheckoutItemsQuantity
name
code
discountValueType
@@ -184,7 +184,7 @@ def test_create_voucher(staff_api_client, permission_manage_discounts):
"discountValueType": DiscountValueTypeEnum.FIXED.name,
"discountValue": 10.12,
"minAmountSpent": 1.12,
- "minQuantityOfProducts": 10,
+ "minCheckoutItemsQuantity": 10,
"startDate": start_date.isoformat(),
"endDate": end_date.isoformat(),
"applyOncePerOrder": True,
@@ -319,11 +319,11 @@ def test_update_voucher(staff_api_client, voucher, permission_manage_discounts):
query = """
mutation voucherUpdate($code: String,
$discountValueType: DiscountValueTypeEnum, $id: ID!,
- $applyOncePerOrder: Boolean, $minQuantityOfProducts: Int) {
+ $applyOncePerOrder: Boolean, $minCheckoutItemsQuantity: Int) {
voucherUpdate(id: $id, input: {
code: $code, discountValueType: $discountValueType,
applyOncePerOrder: $applyOncePerOrder,
- minQuantityOfProducts: $minQuantityOfProducts
+ minCheckoutItemsQuantity: $minCheckoutItemsQuantity
}) {
errors {
field
@@ -333,7 +333,7 @@ def test_update_voucher(staff_api_client, voucher, permission_manage_discounts):
code
discountValueType
applyOncePerOrder
- minQuantityOfProducts
+ minCheckoutItemsQuantity
}
}
}
@@ -348,7 +348,7 @@ def test_update_voucher(staff_api_client, voucher, permission_manage_discounts):
"code": "testcode123",
"discountValueType": DiscountValueTypeEnum.PERCENTAGE.name,
"applyOncePerOrder": apply_once_per_order,
- "minQuantityOfProducts": 10,
+ "minCheckoutItemsQuantity": 10,
}
response = staff_api_client.post_graphql(
@@ -359,7 +359,7 @@ def test_update_voucher(staff_api_client, voucher, permission_manage_discounts):
assert data["code"] == "testcode123"
assert data["discountValueType"] == DiscountValueType.PERCENTAGE.upper()
assert data["applyOncePerOrder"] == apply_once_per_order
- assert data["minQuantityOfProducts"] == 10
+ assert data["minCheckoutItemsQuantity"] == 10
def test_voucher_delete_mutation(
diff --git a/tests/dashboard/test_discounts.py b/tests/dashboard/test_discounts.py
index 7df7c4ffe3..d49118ce6b 100644
--- a/tests/dashboard/test_discounts.py
+++ b/tests/dashboard/test_discounts.py
@@ -154,7 +154,8 @@ def test_shipping_voucher_order_discount(
@pytest.mark.parametrize(
- "total, total_quantity, min_amount_spent, min_quantity_of_products, voucher_type",
+ "total, total_quantity, min_amount_spent, min_checkout_items_quantity,"
+ "voucher_type",
[
(99, 10, 100, 10, VoucherType.SHIPPING),
(100, 9, 100, 10, VoucherType.SHIPPING),
@@ -168,7 +169,7 @@ def test_shipping_voucher_order_discount(
],
)
def test_shipping_voucher_checkout_discount_not_applicable_returns_zero(
- total, total_quantity, min_amount_spent, min_quantity_of_products, voucher_type
+ total, total_quantity, min_amount_spent, min_checkout_items_quantity, voucher_type
):
voucher = Voucher(
code="unique",
@@ -178,7 +179,7 @@ def test_shipping_voucher_checkout_discount_not_applicable_returns_zero(
min_amount_spent=(
Money(min_amount_spent, "USD") if min_amount_spent is not None else None
),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
price = Money(total, "USD")
price = TaxedMoney(net=price, gross=price)
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index e8ade8f36b..d6162098f5 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -850,7 +850,7 @@ def test_get_discount_for_checkout_value_voucher(
@pytest.mark.parametrize(
"total, total_quantity, discount_value, discount_type, min_amount_spent, "
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
[
("99", 9, 10, DiscountValueType.FIXED, None, 10),
("99", 9, 10, DiscountValueType.FIXED, 100, None),
@@ -865,7 +865,7 @@ def test_get_discount_for_checkout_value_voucher_not_applicable(
discount_value,
discount_type,
min_amount_spent,
- min_quantity_of_products,
+ min_checkout_items_quantity,
):
voucher = Voucher(
code="unique",
@@ -875,7 +875,7 @@ def test_get_discount_for_checkout_value_voucher_not_applicable(
min_amount_spent=(
Money(min_amount_spent, "USD") if min_amount_spent is not None else None
),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
checkout = Mock(
get_subtotal=Mock(return_value=Money(total, "USD")), quantity=total_quantity
@@ -917,7 +917,7 @@ def test_get_discount_for_checkout_specific_products_voucher(
@pytest.mark.parametrize(
"total, total_quantity, discount_value, discount_type, min_amount_spent,"
- "min_quantity_of_products",
+ "min_checkout_items_quantity",
[
("99", 9, 10, DiscountValueType.FIXED, None, 10),
("99", 9, 10, DiscountValueType.FIXED, 100, None),
@@ -933,7 +933,7 @@ def test_get_discount_for_checkout_specific_products_voucher_not_applicable(
discount_value,
discount_type,
min_amount_spent,
- min_quantity_of_products,
+ min_checkout_items_quantity,
):
discounts = []
monkeypatch.setattr(
@@ -948,7 +948,7 @@ def test_get_discount_for_checkout_specific_products_voucher_not_applicable(
min_amount_spent=(
Money(min_amount_spent, "USD") if min_amount_spent is not None else None
),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
checkout = Mock(
get_subtotal=Mock(return_value=Money(total, "USD")), quantity=total_quantity
@@ -1041,8 +1041,8 @@ def test_get_discount_for_checkout_shipping_voucher_limited_countries():
@pytest.mark.parametrize(
"is_shipping_required, shipping_method, discount_value, discount_type,"
- "countries, min_amount_spent, min_quantity_of_products, subtotal, total_quantity,"
- "error_msg",
+ "countries, min_amount_spent, min_checkout_items_quantity, subtotal,"
+ "total_quantity, error_msg",
[
(
True,
@@ -1125,7 +1125,7 @@ def test_get_discount_for_checkout_shipping_voucher_not_applicable(
discount_type,
countries,
min_amount_spent,
- min_quantity_of_products,
+ min_checkout_items_quantity,
subtotal,
total_quantity,
error_msg,
@@ -1145,7 +1145,7 @@ def test_get_discount_for_checkout_shipping_voucher_not_applicable(
min_amount_spent=(
Money(min_amount_spent, "USD") if min_amount_spent is not None else None
),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
countries=countries,
)
with pytest.raises(NotApplicable) as e:
diff --git a/tests/test_discounts.py b/tests/test_discounts.py
index 37d41aff13..4242b12739 100644
--- a/tests/test_discounts.py
+++ b/tests/test_discounts.py
@@ -182,7 +182,7 @@ def test_decrease_voucher_usage():
@pytest.mark.parametrize(
- "total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"discount_value, discount_value_type, expected_value",
[
(20, 20, 2, 2, 50, DiscountValueType.PERCENTAGE, 10),
@@ -195,7 +195,7 @@ def test_get_value_voucher_discount(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
discount_value,
discount_value_type,
expected_value,
@@ -206,7 +206,7 @@ def test_get_value_voucher_discount(
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total_price = Money(total, "USD")
@@ -215,7 +215,7 @@ def test_get_value_voucher_discount(
@pytest.mark.parametrize(
- "total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"discount_value, discount_value_type",
[
(20, 50, 2, 10, 50, DiscountValueType.PERCENTAGE),
@@ -227,7 +227,7 @@ def test_get_value_voucher_discount_not_applicable(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
discount_value,
discount_value_type,
):
@@ -237,7 +237,7 @@ def test_get_value_voucher_discount_not_applicable(
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total_price = Money(total, "USD")
@@ -246,7 +246,7 @@ def test_get_value_voucher_discount_not_applicable(
@pytest.mark.parametrize(
- "total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"shipping_price, discount_value, discount_value_type, expected_value",
[
(20, 20, 2, 2, 10, 50, DiscountValueType.PERCENTAGE, 5),
@@ -259,7 +259,7 @@ def test_get_shipping_voucher_discount(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
shipping_price,
discount_value,
discount_value_type,
@@ -271,7 +271,7 @@ def test_get_shipping_voucher_discount(
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total = Money(total, "USD")
@@ -283,7 +283,7 @@ def test_get_shipping_voucher_discount(
@pytest.mark.parametrize(
- "total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"shipping_price, discount_value, discount_value_type",
[
(20, 50, 2, 10, 10, 50, DiscountValueType.PERCENTAGE),
@@ -295,7 +295,7 @@ def test_get_shipping_voucher_discount_not_applicable(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
shipping_price,
discount_value,
discount_value_type,
@@ -306,7 +306,7 @@ def test_get_shipping_voucher_discount_not_applicable(
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total = Money(total, "USD")
@@ -316,7 +316,7 @@ def test_get_shipping_voucher_discount_not_applicable(
@pytest.mark.parametrize(
- "prices, total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "prices, total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"discount_value_type, discount_value, voucher_type, apply_once_per_order, "
"expected_value",
[ # noqa
@@ -375,7 +375,7 @@ def test_get_voucher_discount_all_products(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
discount_value_type,
discount_value,
voucher_type,
@@ -390,7 +390,7 @@ def test_get_voucher_discount_all_products(
discount_value=discount_value,
apply_once_per_order=apply_once_per_order,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total = Money(total, "USD")
@@ -399,7 +399,7 @@ def test_get_voucher_discount_all_products(
@pytest.mark.parametrize(
- "prices, total, min_amount_spent, total_quantity, min_quantity_of_products, "
+ "prices, total, min_amount_spent, total_quantity, min_checkout_items_quantity, "
"discount_value_type, discount_value, voucher_type, apply_once_per_order, ",
[ # noqa
(
@@ -453,7 +453,7 @@ def test_get_voucher_discount_all_products_not_applicable(
total,
min_amount_spent,
total_quantity,
- min_quantity_of_products,
+ min_checkout_items_quantity,
discount_value_type,
discount_value,
voucher_type,
@@ -467,7 +467,7 @@ def test_get_voucher_discount_all_products_not_applicable(
discount_value=discount_value,
apply_once_per_order=apply_once_per_order,
min_amount_spent=get_min_amount_spent(min_amount_spent),
- min_quantity_of_products=min_quantity_of_products,
+ min_checkout_items_quantity=min_checkout_items_quantity,
)
voucher.save()
total = Money(total, "USD")