Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update PaymentData.store type
Mateusz Grzyb6ce1313778d4
diff --git a/saleor/graphql/payment/tests/test_payment.py b/saleor/graphql/payment/tests/test_payment.pyindex fa0d9c8a5e..ddbbdcff97 100644--- a/saleor/graphql/payment/tests/test_payment.py+++ b/saleor/graphql/payment/tests/test_payment.py@@ -104,7 +104,6 @@ CREATE_PAYMENT_MUTATION = """metadata: $metadata) {payment {- idtransactions {kind,tokendiff --git a/saleor/payment/interface.py b/saleor/payment/interface.pyindex ff7462d91c..d3e3cf95c0 100644--- a/saleor/payment/interface.py+++ b/saleor/payment/interface.py@@ -1,9 +1,8 @@from dataclasses import dataclass, fieldfrom decimal import Decimal+from enum import Enumfrom typing import Any, Dict, List, Optional, Union-from saleor.payment import Store-JSONValue = Union[str, int, float, bool, None, Dict[str, Any], List[Any]]JSONType = Union[Dict[str, JSONValue], List[JSONValue]]@@ -61,6 +60,12 @@ class AddressData:phone: str+class StoreEnum(str, Enum):+ NONE = "NONE"+ ON_SESSION = "ON_SESSION"+ OFF_SESSION = "OFF_SESSION"++@dataclassclass PaymentData:"""Dataclass for storing all payment information.@@ -84,7 +89,7 @@ class PaymentData:reuse_source: bool = False # Note: this field will be removed in 4.0.data: Optional[dict] = Nonegraphql_customer_id: Optional[str] = None- store: str = Store.NONE+ store: StoreEnum = StoreEnum.NONEpayment_metadata: Dict[str, str] = field(default_factory=dict)diff --git a/saleor/payment/tests/test_payment.py b/saleor/payment/tests/test_payment.pyindex 37e46f103b..90d3d8bc99 100644--- a/saleor/payment/tests/test_payment.py+++ b/saleor/payment/tests/test_payment.py@@ -24,8 +24,6 @@ from ..utils import (validate_gateway_response,)-pytest_plugins = ["saleor.plugins.webhook.tests.test_payment_webhook"]-NOT_ACTIVE_PAYMENT_ERROR = "This payment is no longer active."EXAMPLE_ERROR = "Example dummy error"diff --git a/saleor/payment/utils.py b/saleor/payment/utils.pyindex 5fedea3e68..8d9e604444 100644--- a/saleor/payment/utils.py+++ b/saleor/payment/utils.py@@ -15,7 +15,13 @@ from ..core.tracing import traced_atomic_transactionfrom ..order.models import Orderfrom . import ChargeStatus, GatewayError, PaymentError, Store, TransactionKindfrom .error_codes import PaymentErrorCode-from .interface import AddressData, GatewayResponse, PaymentData, PaymentMethodInfo+from .interface import (+ AddressData,+ GatewayResponse,+ PaymentData,+ PaymentMethodInfo,+ StoreEnum,+)from .models import Payment, Transactionif TYPE_CHECKING:@@ -80,7 +86,7 @@ def create_payment_information(reuse_source=store_source,data=additional_data or {},graphql_customer_id=graphql_customer_id,- store=payment.store,+ store=StoreEnum[payment.store.upper()],payment_metadata=payment.metadata,)