Skip to content

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

Use graphene ID in gift card payment log (#16533)

Iga Karbowiak152fc05a346e
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
index 8e8ef7d0e2..1b2518eb00 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py
@@ -287,7 +287,10 @@ def test_checkout_complete(
assert not len(Reservation.objects.all())
- assert str(checkout_info.checkout.pk) == caplog.records[0].checkout_id
+ assert (
+ graphene.Node.to_global_id("Checkout", checkout_info.checkout.pk)
+ == caplog.records[0].checkout_id
+ )
assert gift_card.initial_balance_amount == Decimal(
caplog.records[0].gift_card_compensation
)
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
index 43ce928272..dc295bf6c8 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py
@@ -1300,7 +1300,10 @@ def test_checkout_complete(
assert not len(Reservation.objects.all())
- assert str(checkout_info.checkout.pk) == caplog.records[0].checkout_id
+ assert (
+ graphene.Node.to_global_id("Checkout", checkout_info.checkout.pk)
+ == caplog.records[0].checkout_id
+ )
assert gift_card.initial_balance_amount == Decimal(
caplog.records[0].gift_card_compensation
)
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 90188fb3b9..fe1bbf4bee 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -3,6 +3,7 @@ from collections.abc import Iterable
from decimal import Decimal
from typing import TYPE_CHECKING, Optional, cast
+import graphene
from django.conf import settings
from django.db.models import QuerySet, Sum
from django.utils import timezone
@@ -476,7 +477,9 @@ def add_gift_cards_to_order(
gift_card_compensation = total_before_gift_card_compensation - total_price_left
if gift_card_compensation.amount > 0:
details = {
- "checkout_id": str(checkout_info.checkout.pk),
+ "checkout_id": graphene.Node.to_global_id(
+ "Checkout", checkout_info.checkout.pk
+ ),
"gift_card_compensation": str(gift_card_compensation.amount),
"total_after_gift_card_compensation": str(total_price_left.amount),
}