Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Allow updating gift card balance with 0 amount
IKarbowiak232ed6a0d0c7
diff --git a/saleor/graphql/giftcard/mutations.py b/saleor/graphql/giftcard/mutations.pyindex 58edb9993d..0042f99cf4 100644--- a/saleor/graphql/giftcard/mutations.py+++ b/saleor/graphql/giftcard/mutations.py@@ -254,7 +254,7 @@ class GiftCardUpdate(GiftCardCreate):def clean_balance(cleaned_input, instance):amount = cleaned_input.pop("balance_amount", None)- if not amount:+ if amount is None:returncurrency = instance.currencydiff --git a/saleor/graphql/giftcard/tests/mutations/test_gift_card_update.py b/saleor/graphql/giftcard/tests/mutations/test_gift_card_update.pyindex a4e5da23ac..00e2b8b0bd 100644--- a/saleor/graphql/giftcard/tests/mutations/test_gift_card_update.py+++ b/saleor/graphql/giftcard/tests/mutations/test_gift_card_update.py@@ -1,6 +1,7 @@from datetime import date, timedeltaimport graphene+import pytestfrom .....giftcard import GiftCardEventsfrom .....giftcard.error_codes import GiftCardErrorCode@@ -341,7 +342,9 @@ def test_update_gift_card_by_customer(api_client, customer_user, gift_card):assert_no_permission(response)[email protected]("initial_balance", [100.0, 0.0])def test_update_gift_card_balance(+ initial_balance,staff_api_client,gift_card,permission_manage_gift_card,@@ -352,7 +355,6 @@ def test_update_gift_card_balance(old_initial_balance = float(gift_card.initial_balance.amount)old_current_balance = float(gift_card.current_balance.amount)- initial_balance = 100.0currency = gift_card.currencyvariables = {"id": graphene.Node.to_global_id("GiftCard", gift_card.pk),