Skip to content

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

Deprecate legacy Payments API in favor of Transactions API (#19477)

Lukasz Ostrowski95b1b60f8a20
diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.py
index 14b7fff09f..feaa75cccf 100644
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@ -35,7 +35,11 @@ from ..core.connection import (
filter_connection_queryset,
)
from ..core.context import SyncWebhookControlContext, get_database_connection_name
-from ..core.descriptions import ADDED_IN_322, PREVIEW_FEATURE
+from ..core.descriptions import (
+ ADDED_IN_322,
+ DEPRECATED_LEGACY_PAYMENTS,
+ PREVIEW_FEATURE,
+)
from ..core.doc_category import DOC_CATEGORY_USERS
from ..core.enums import LanguageCodeEnum
from ..core.federation import federated_entity, resolve_federation_references
@@ -443,6 +447,7 @@ class User(ModelObjectType[models.User]):
channel=graphene.String(
description="Slug of a channel for which the data should be returned."
),
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
language_code = graphene.Field(
LanguageCodeEnum, description="User language code.", required=True
diff --git a/saleor/graphql/channel/enums.py b/saleor/graphql/channel/enums.py
index 4819d06ffe..3e9df9eb7e 100644
--- a/saleor/graphql/channel/enums.py
+++ b/saleor/graphql/channel/enums.py
@@ -3,6 +3,7 @@ from typing import Final
import graphene
from ...channel import AllocationStrategy, MarkAsPaidStrategy, TransactionFlowStrategy
+from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import (
DOC_CATEGORY_CHANNELS,
DOC_CATEGORY_PAYMENTS,
@@ -17,10 +18,18 @@ AllocationStrategyEnum: Final[graphene.Enum] = to_enum(
)
AllocationStrategyEnum.doc_category = DOC_CATEGORY_PRODUCTS
+
+def mark_as_paid_strategy_deprecation_reason(enum):
+ if enum.value == MarkAsPaidStrategy.PAYMENT_FLOW:
+ return DEPRECATED_LEGACY_PAYMENTS
+ return None
+
+
MarkAsPaidStrategyEnum: Final[graphene.Enum] = to_enum(
MarkAsPaidStrategy,
type_name="MarkAsPaidStrategyEnum",
description=MarkAsPaidStrategy.__doc__,
+ deprecation_reason=mark_as_paid_strategy_deprecation_reason,
)
MarkAsPaidStrategyEnum.doc_category = DOC_CATEGORY_CHANNELS
diff --git a/saleor/graphql/checkout/schema.py b/saleor/graphql/checkout/schema.py
index b22ba1fc88..52827999a9 100644
--- a/saleor/graphql/checkout/schema.py
+++ b/saleor/graphql/checkout/schema.py
@@ -10,7 +10,7 @@ from ..core.connection import (
create_connection_slice_for_sync_webhook_control_context,
filter_connection_queryset,
)
-from ..core.descriptions import DEPRECATED_IN_3X_INPUT
+from ..core.descriptions import DEPRECATED_IN_3X_INPUT, DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import DOC_CATEGORY_CHECKOUT
from ..core.fields import BaseField, ConnectionField, FilterConnectionField
from ..core.scalars import UUID
@@ -142,7 +142,9 @@ class CheckoutMutations(graphene.ObjectType):
checkout_lines_add = CheckoutLinesAdd.Field()
checkout_lines_update = CheckoutLinesUpdate.Field()
checkout_remove_promo_code = CheckoutRemovePromoCode.Field()
- checkout_payment_create = CheckoutPaymentCreate.Field()
+ checkout_payment_create = CheckoutPaymentCreate.Field(
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS
+ )
checkout_shipping_address_update = CheckoutShippingAddressUpdate.Field()
checkout_shipping_method_update = CheckoutShippingMethodUpdate.Field(
deprecation_reason="Use `checkoutDeliveryMethodUpdate` instead."
diff --git a/saleor/graphql/checkout/sorters.py b/saleor/graphql/checkout/sorters.py
index f8ee8103e0..d306edc20a 100644
--- a/saleor/graphql/checkout/sorters.py
+++ b/saleor/graphql/checkout/sorters.py
@@ -1,6 +1,7 @@
from django.db.models import CharField, ExpressionWrapper, OuterRef, QuerySet, Subquery
from ...payment.models import Payment
+from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import DOC_CATEGORY_CHECKOUT
from ..core.types import BaseEnum, SortInputObjectType
@@ -28,6 +29,12 @@ class CheckoutSortField(BaseEnum):
return f"Sort checkouts by {sort_name}."
raise ValueError(f"Unsupported enum value: {self.value}")
+ @property
+ def deprecation_reason(self):
+ if self == CheckoutSortField.PAYMENT:
+ return DEPRECATED_LEGACY_PAYMENTS
+ return None
+
@staticmethod
def qs_with_payment(queryset: QuerySet, **_kwargs) -> QuerySet:
subquery = Subquery(
diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.py
index 1c017ca1a3..d10da652c9 100644
--- a/saleor/graphql/checkout/types.py
+++ b/saleor/graphql/checkout/types.py
@@ -46,6 +46,7 @@ from ..core.connection import CountableConnection
from ..core.context import ChannelContext
from ..core.descriptions import (
ADDED_IN_323,
+ DEPRECATED_LEGACY_PAYMENTS,
PREVIEW_FEATURE,
)
from ..core.doc_category import DOC_CATEGORY_CHECKOUT
@@ -690,6 +691,7 @@ class Checkout(SyncWebhookControlContextModelObjectType[models.Checkout]):
description="Fetch payment gateways available for checkout.",
),
],
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
email = graphene.String(description="Email of a customer.", required=False)
gift_cards = NonNullList(
diff --git a/saleor/graphql/core/descriptions.py b/saleor/graphql/core/descriptions.py
index 78bcde14d7..99b2df0a2b 100644
--- a/saleor/graphql/core/descriptions.py
+++ b/saleor/graphql/core/descriptions.py
@@ -19,6 +19,13 @@ DEPRECATED_EXPORT_MUTATIONS = (
"All data can be fetched via the GraphQL API and parsed into the desired format by apps or external tools."
)
+DEPRECATED_LEGACY_PAYMENTS = (
+ "The legacy Payments API is deprecated and will be removed. "
+ "Use the Transactions API instead."
+)
+
+DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION = "\n\n" + DEPRECATED_LEGACY_PAYMENTS
+
PREVIEW_FEATURE = (
"\n\nNote: this API is currently in Feature Preview and can be subject to "
diff --git a/saleor/graphql/order/schema.py b/saleor/graphql/order/schema.py
index 0727c571cc..598ffb1e53 100644
--- a/saleor/graphql/order/schema.py
+++ b/saleor/graphql/order/schema.py
@@ -16,6 +16,7 @@ from ..core.descriptions import (
ADDED_IN_322,
DEFAULT_DEPRECATION_REASON,
DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_LEGACY_PAYMENTS,
)
from ..core.doc_category import DOC_CATEGORY_ORDERS
from ..core.enums import ReportingPeriod
@@ -27,13 +28,14 @@ from ..core.fields import (
)
from ..core.filters import FilterInputObjectType
from ..core.scalars import UUID
-from ..core.types import TaxedMoney
+from ..core.types import NonNullList, TaxedMoney
from ..core.utils import (
ext_ref_to_global_id_or_error,
from_global_id_or_error,
validate_and_apply_search_rank_sorting,
)
from ..core.validators import validate_one_of_args_is_in_query
+from ..payment.enums import PaymentChargeStatusEnum
from ..utils import get_user_or_app_from_context
from .bulk_mutations.draft_orders import DraftOrderBulkDelete, DraftOrderLinesBulkDelete
from .bulk_mutations.order_bulk_cancel import OrderBulkCancel
@@ -88,6 +90,14 @@ from .types import Order, OrderCountableConnection, OrderEventCountableConnectio
class OrderFilterInput(FilterInputObjectType):
+ payment_status = NonNullList(
+ PaymentChargeStatusEnum,
+ description=(
+ "Filter orders by payment charge status."
+ f"{DEPRECATED_IN_3X_INPUT} {DEPRECATED_LEGACY_PAYMENTS}"
+ ),
+ )
+
class Meta:
doc_category = DOC_CATEGORY_ORDERS
filterset_class = OrderFilter
@@ -285,7 +295,7 @@ class OrderMutations(graphene.ObjectType):
deprecation_reason="Use `orderNoteAdd` instead."
)
order_cancel = OrderCancel.Field()
- order_capture = OrderCapture.Field()
+ order_capture = OrderCapture.Field(deprecation_reason=DEPRECATED_LEGACY_PAYMENTS)
order_confirm = OrderConfirm.Field()
order_fulfill = OrderFulfill.Field()
@@ -313,9 +323,9 @@ class OrderMutations(graphene.ObjectType):
order_note_update = OrderNoteUpdate.Field()
order_mark_as_paid = OrderMarkAsPaid.Field()
- order_refund = OrderRefund.Field()
+ order_refund = OrderRefund.Field(deprecation_reason=DEPRECATED_LEGACY_PAYMENTS)
order_update = OrderUpdate.Field()
order_update_shipping = OrderUpdateShipping.Field()
- order_void = OrderVoid.Field()
+ order_void = OrderVoid.Field(deprecation_reason=DEPRECATED_LEGACY_PAYMENTS)
order_bulk_cancel = OrderBulkCancel.Field()
order_bulk_create = OrderBulkCreate.Field()
diff --git a/saleor/graphql/order/sorters.py b/saleor/graphql/order/sorters.py
index aeea607d3d..2894bed347 100644
--- a/saleor/graphql/order/sorters.py
+++ b/saleor/graphql/order/sorters.py
@@ -1,7 +1,7 @@
from django.db.models import CharField, ExpressionWrapper, OuterRef, QuerySet, Subquery
from ...payment.models import Payment
-from ..core.descriptions import ADDED_IN_322
+from ..core.descriptions import ADDED_IN_322, DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import DOC_CATEGORY_ORDERS
from ..core.types import BaseEnum, SortInputObjectType
@@ -44,6 +44,7 @@ class OrderSortField(BaseEnum):
deprecations = {
OrderSortField.CREATION_DATE.name: "Use `CREATED_AT` instead.", # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501
OrderSortField.FULFILLMENT_STATUS.name: "Use `STATUS` instead.", # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501
+ OrderSortField.PAYMENT.name: DEPRECATED_LEGACY_PAYMENTS, # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501
}
if self.name in deprecations:
return deprecations[self.name]
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 9a71a8efd3..3be1ff980f 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -78,6 +78,7 @@ from ..core.descriptions import (
ADDED_IN_322,
ADDED_IN_323,
DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_LEGACY_PAYMENTS,
PREVIEW_FEATURE,
)
from ..core.doc_category import DOC_CATEGORY_ORDERS
@@ -1714,7 +1715,10 @@ class Order(SyncWebhookControlContextModelObjectType[ModelObjectType[models.Orde
required=True,
)
payments = NonNullList(
- Payment, description="List of payments for the order.", required=True
+ Payment,
+ description="List of payments for the order.",
+ required=True,
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
total = graphene.Field(
TaxedMoney, description="Total amount of the order.", required=True
diff --git a/saleor/graphql/payment/enums.py b/saleor/graphql/payment/enums.py
index 76f7f19d8d..8890c721da 100644
--- a/saleor/graphql/payment/enums.py
+++ b/saleor/graphql/payment/enums.py
@@ -16,12 +16,15 @@ from ...payment.interface import (
PaymentMethodTokenizationResult,
StoredPaymentMethodRequestDeleteResult,
)
+from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import DOC_CATEGORY_PAYMENTS
from ..core.enums import to_enum
from ..core.types import BaseEnum
TransactionKindEnum: Final[graphene.Enum] = to_enum(
- TransactionKind, type_name="TransactionKind"
+ TransactionKind,
+ type_name="TransactionKind",
+ deprecation_reason=lambda _enum: DEPRECATED_LEGACY_PAYMENTS,
)
TransactionKindEnum.doc_category = DOC_CATEGORY_PAYMENTS
@@ -71,6 +74,12 @@ class OrderAction(BaseEnum):
return "Represents a void action."
raise ValueError(f"Unsupported enum value: {self.value}")
+ @property
+ def deprecation_reason(self):
+ if self in [OrderAction.CAPTURE, OrderAction.REFUND, OrderAction.VOID]:
+ return DEPRECATED_LEGACY_PAYMENTS
+ return None
+
def description(enum):
if enum is None:
@@ -92,7 +101,10 @@ def description(enum):
StorePaymentMethodEnum: Final[graphene.Enum] = to_enum(
- StorePaymentMethod, type_name="StorePaymentMethodEnum", description=description
+ StorePaymentMethod,
+ type_name="StorePaymentMethodEnum",
+ description=description,
+ deprecation_reason=lambda _enum: DEPRECATED_LEGACY_PAYMENTS,
)
StorePaymentMethodEnum.doc_category = DOC_CATEGORY_PAYMENTS
diff --git a/saleor/graphql/payment/filters.py b/saleor/graphql/payment/filters.py
index cb91b2633e..cb69ff57d2 100644
--- a/saleor/graphql/payment/filters.py
+++ b/saleor/graphql/payment/filters.py
@@ -3,7 +3,10 @@ import graphene
from django.db.models import Exists, OuterRef, Q
from ...payment.models import TransactionEvent
-from ..core.descriptions import ADDED_IN_323
+from ..core.descriptions import (
+ ADDED_IN_323,
+ DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION,
+)
from ..core.doc_category import DOC_CATEGORY_PAYMENTS
from ..core.filters import (
FilterInputObjectType,
@@ -40,6 +43,10 @@ class PaymentFilterInput(FilterInputObjectType):
class Meta:
doc_category = DOC_CATEGORY_PAYMENTS
filterset_class = PaymentFilter
+ description = (
+ "Filtering options for payments."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
class TransactionEventTypeEnumFilterInput(BaseInputObjectType):
diff --git a/saleor/graphql/payment/mutations/payment/checkout_payment_create.py b/saleor/graphql/payment/mutations/payment/checkout_payment_create.py
index f71f26f1c4..6d605d6059 100644
--- a/saleor/graphql/payment/mutations/payment/checkout_payment_create.py
+++ b/saleor/graphql/payment/mutations/payment/checkout_payment_create.py
@@ -24,7 +24,10 @@ from ....checkout.mutations.utils import get_checkout
from ....checkout.types import Checkout
from ....core import ResolveInfo
from ....core.context import SyncWebhookControlContext
-from ....core.descriptions import DEPRECATED_IN_3X_INPUT
+from ....core.descriptions import (
+ DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION,
+)
from ....core.doc_category import DOC_CATEGORY_CHECKOUT, DOC_CATEGORY_PAYMENTS
from ....core.mutations import BaseMutation
from ....core.scalars import UUID, PositiveDecimal
@@ -80,6 +83,10 @@ class PaymentInput(BaseInputObjectType):
class Meta:
doc_category = DOC_CATEGORY_PAYMENTS
+ description = (
+ "Fields required to create a payment."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
class CheckoutPaymentCreate(BaseMutation, I18nMixin):
diff --git a/saleor/graphql/payment/mutations/payment/payment_check_balance.py b/saleor/graphql/payment/mutations/payment/payment_check_balance.py
index 6226e10522..55badaff91 100644
--- a/saleor/graphql/payment/mutations/payment/payment_check_balance.py
+++ b/saleor/graphql/payment/mutations/payment/payment_check_balance.py
@@ -6,6 +6,7 @@ from .....payment.error_codes import PaymentErrorCode
from .....payment.gateway import get_payment_gateways, is_currency_supported
from ....channel.utils import validate_channel
from ....core import ResolveInfo
+from ....core.descriptions import DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
from ....core.doc_category import DOC_CATEGORY_PAYMENTS
from ....core.fields import JSONString
from ....core.mutations import BaseMutation
@@ -32,6 +33,12 @@ class CardInput(graphene.InputObjectType):
description="Information about currency and amount.", required=True
)
+ class Meta:
+ description = (
+ "Card data used to check a payment balance."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
+
class PaymentCheckBalanceInput(BaseInputObjectType):
gateway_id = graphene.types.String(
@@ -46,6 +53,10 @@ class PaymentCheckBalanceInput(BaseInputObjectType):
class Meta:
doc_category = DOC_CATEGORY_PAYMENTS
+ description = (
+ "Fields required to check a payment balance."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
class PaymentCheckBalance(BaseMutation):
diff --git a/saleor/graphql/payment/schema.py b/saleor/graphql/payment/schema.py
index 5b7babc50d..8af3269ebf 100644
--- a/saleor/graphql/payment/schema.py
+++ b/saleor/graphql/payment/schema.py
@@ -3,7 +3,11 @@ import graphene
from ...permission.enums import OrderPermissions, PaymentPermissions
from ..core import ResolveInfo
from ..core.connection import create_connection_slice, filter_connection_queryset
-from ..core.descriptions import ADDED_IN_322, ADDED_IN_323
+from ..core.descriptions import (
+ ADDED_IN_322,
+ ADDED_IN_323,
+ DEPRECATED_LEGACY_PAYMENTS,
+)
from ..core.doc_category import DOC_CATEGORY_PAYMENTS
from ..core.fields import FilterConnectionField, PermissionsField
from ..core.scalars import UUID
@@ -63,6 +67,7 @@ class PaymentQueries(graphene.ObjectType):
OrderPermissions.MANAGE_ORDERS,
],
doc_category=DOC_CATEGORY_PAYMENTS,
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
payments = FilterConnectionField(
PaymentCountableConnection,
@@ -72,6 +77,7 @@ class PaymentQueries(graphene.ObjectType):
OrderPermissions.MANAGE_ORDERS,
],
doc_category=DOC_CATEGORY_PAYMENTS,
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
transaction = PermissionsField(
TransactionItem,
@@ -158,11 +164,17 @@ class PaymentQueries(graphene.ObjectType):
class PaymentMutations(graphene.ObjectType):
- payment_capture = PaymentCapture.Field()
- payment_refund = PaymentRefund.Field()
- payment_void = PaymentVoid.Field()
- payment_initialize = PaymentInitialize.Field()
- payment_check_balance = PaymentCheckBalance.Field()
+ payment_capture = PaymentCapture.Field(
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS
+ )
+ payment_refund = PaymentRefund.Field(deprecation_reason=DEPRECATED_LEGACY_PAYMENTS)
+ payment_void = PaymentVoid.Field(deprecation_reason=DEPRECATED_LEGACY_PAYMENTS)
+ payment_initialize = PaymentInitialize.Field(
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS
+ )
+ payment_check_balance = PaymentCheckBalance.Field(
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS
+ )
transaction_create = TransactionCreate.Field()
transaction_update = TransactionUpdate.Field()
diff --git a/saleor/graphql/payment/tests/test_legacy_api_deprecation.py b/saleor/graphql/payment/tests/test_legacy_api_deprecation.py
new file mode 100644
index 0000000000..bb30584aa0
--- /dev/null
+++ b/saleor/graphql/payment/tests/test_legacy_api_deprecation.py
@@ -0,0 +1,167 @@
+from ...api import schema
+from ...core.descriptions import (
+ DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_LEGACY_PAYMENTS,
+)
+from ...schema_printer import print_type
+
+DEPRECATED_FIELDS = {
+ "Query": ["payment", "payments"],
+ "Mutation": [
+ "checkoutPaymentCreate",
+ "orderCapture",
+ "orderRefund",
+ "orderVoid",
+ "paymentCapture",
+ "paymentCheckBalance",
+ "paymentInitialize",
+ "paymentRefund",
+ "paymentVoid",
+ ],
+ "Checkout": ["availablePaymentGateways"],
+ "Order": ["payments"],
+ "PaymentAuthorize": ["payment"],
+ "PaymentCaptureEvent": ["payment"],
+ "PaymentConfirmEvent": ["payment"],
+ "PaymentProcessEvent": ["payment"],
+ "PaymentRefundEvent": ["payment"],
+ "PaymentVoidEvent": ["payment"],
+ "Shop": ["availablePaymentGateways"],
+ "Transaction": ["gatewayResponse"],
+ "User": ["storedPaymentSources"],
+}
+
+DEPRECATED_ENUM_VALUES = {
+ "CheckoutSortField": ["PAYMENT"],
+ "MarkAsPaidStrategyEnum": ["PAYMENT_FLOW"],
+ "OrderAction": ["CAPTURE", "REFUND", "VOID"],
+ "OrderSortField": ["PAYMENT"],
+ "StorePaymentMethodEnum": ["NONE", "OFF_SESSION", "ON_SESSION"],
+ "TransactionKind": [
+ "ACTION_TO_CONFIRM",
+ "AUTH",
+ "CANCEL",
+ "CAPTURE",
+ "CONFIRM",
+ "EXTERNAL",
+ "PENDING",
+ "REFUND",
+ "REFUND_ONGOING",
+ "VOID",
+ ],
+ "WebhookEventTypeEnum": [
+ "PAYMENT_AUTHORIZE",
+ "PAYMENT_CAPTURE",
+ "PAYMENT_CONFIRM",
+ "PAYMENT_LIST_GATEWAYS",
+ "PAYMENT_PROCESS",
+ "PAYMENT_REFUND",
+ "PAYMENT_VOID",
+ ],
+ "WebhookEventTypeSyncEnum": [
+ "PAYMENT_AUTHORIZE",
+ "PAYMENT_CAPTURE",
+ "PAYMENT_CONFIRM",
+ "PAYMENT_LIST_GATEWAYS",
+ "PAYMENT_PROCESS",
+ "PAYMENT_REFUND",
+ "PAYMENT_VOID",
+ ],
+}
+
+DEPRECATED_TYPE_DESCRIPTIONS = [
+ "CardInput",
+ "Payment",
+ "PaymentAuthorize",
+ "PaymentCaptureEvent",
+ "PaymentCheckBalanceInput",
+ "PaymentConfirmEvent",
+ "PaymentFilterInput",
+ "PaymentInitialized",
+ "PaymentInput",
+ "PaymentListGateways",
+ "PaymentProcessEvent",
+ "PaymentRefundEvent",
+ "PaymentSource",
+ "PaymentVoidEvent",
+ "Transaction",
+]
+
+TRANSACTIONS_API_FIELDS = {
+ "Checkout": ["storedPaymentMethods", "transactions"],
+ "Mutation": [
+ "paymentGatewayInitialize",
+ "transactionCreate",
+ "transactionEventReport",
+ "transactionInitialize",
+ "transactionProcess",
+ "transactionRequestAction",
+ "transactionRequestRefundForGrantedRefund",
+ "transactionUpdate",
+ ],
+ "Order": ["transactions"],
+ "Query": ["transaction", "transactions"],
+ "StoredPaymentMethod": ["gateway"],
+ "User": ["storedPaymentMethods"],
+}
+
+
+def test_legacy_payment_fields_are_deprecated():
+ for type_name, field_names in DEPRECATED_FIELDS.items():
+ graphql_type = schema.get_type(type_name)
+
+ for field_name in field_names:
+ field = graphql_type.fields[field_name]
+
+ assert field.deprecation_reason == DEPRECATED_LEGACY_PAYMENTS
+
+
+def test_legacy_payment_enum_values_are_deprecated():
+ for type_name, value_names in DEPRECATED_ENUM_VALUES.items():
+ graphql_type = schema.get_type(type_name)
+ enum_values = {value.name: value for value in graphql_type.values}
+
+ for value_name in value_names:
+ value = enum_values[value_name]
+
+ assert value.deprecation_reason == DEPRECATED_LEGACY_PAYMENTS
+
+
+def test_legacy_payment_types_have_deprecation_description():
+ for type_name in DEPRECATED_TYPE_DESCRIPTIONS:
+ graphql_type = schema.get_type(type_name)
+
+ assert DEPRECATED_LEGACY_PAYMENTS in graphql_type.description
+
+
+def test_order_payment_status_filter_is_deprecated_in_printed_schema():
+ graphql_type = schema.get_type("OrderFilterInput")
+
+ field = graphql_type.fields["paymentStatus"]
+ printed_type = print_type(graphql_type)
+
+ assert field.description == (
+ "Filter orders by payment charge status."
+ f"{DEPRECATED_IN_3X_INPUT} {DEPRECATED_LEGACY_PAYMENTS}"
+ )
+ assert '"""Filter orders by payment charge status."""' in printed_type
+ assert (
+ 'paymentStatus: [PaymentChargeStatusEnum!] @deprecated(reason: "'
+ f'{DEPRECATED_LEGACY_PAYMENTS}")'
+ ) in printed_type
+
+
+def test_shared_payment_gateway_type_is_not_deprecated():
+ graphql_type = schema.get_type("PaymentGateway")
+
+ assert DEPRECATED_LEGACY_PAYMENTS not in graphql_type.description
+
+
+def test_transactions_api_fields_are_not_deprecated():
+ for type_name, field_names in TRANSACTIONS_API_FIELDS.items():
+ graphql_type = schema.get_type(type_name)
+
+ for field_name in field_names:
+ field = graphql_type.fields[field_name]
+
+ assert field.deprecation_reason is None
diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.py
index e3de78680e..0ab25d30f7 100644
--- a/saleor/graphql/payment/types.py
+++ b/saleor/graphql/payment/types.py
@@ -7,7 +7,12 @@ from graphene import relay
from promise import Promise
from ...core.exceptions import PermissionDenied
-from ...graphql.core.descriptions import ADDED_IN_322, ADDED_IN_323
+from ...graphql.core.descriptions import (
+ ADDED_IN_322,
+ ADDED_IN_323,
+ DEPRECATED_LEGACY_PAYMENTS,
+ DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION,
+)
from ...payment import PaymentMethodType, models
from ...payment.interface import PaymentMethodData
from ...permission.enums import OrderPermissions
@@ -66,14 +71,17 @@ class Transaction(ModelObjectType[models.Transaction]):
)
error = graphene.String(description="Error associated with transaction, if any.")
gateway_response = JSONString(
- deprecation_reason="This field is a part of a legacy Payments API. Please use apps instead.",
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
required=True,
description="Response returned by payment gateway.",
)
amount = graphene.Field(Money, description="Total amount of the transaction.")
class Meta:
- description = "An object representing a single payment."
+ description = (
+ "An object representing a single payment."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
interfaces = [relay.Node]
model = models.Transaction
@@ -112,6 +120,7 @@ class PaymentSource(BaseObjectType):
description = (
"Represents a payment source stored "
"for user in payment gateway, such as credit card."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
)
doc_category = DOC_CATEGORY_PAYMENTS
@@ -205,7 +214,10 @@ class Payment(ModelObjectType[models.Payment]):
)
class Meta:
- description = "Represents a payment of a given type."
+ description = (
+ "Represents a payment of a given type."
+ + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
interfaces = [relay.Node, ObjectWithMetadata]
model = models.Payment
@@ -322,7 +334,7 @@ class PaymentInitialized(BaseObjectType):
description = (
"Server-side data generated by a payment gateway. Optional step when the "
"payment provider requires an additional action to initialize payment "
- "session."
+ "session." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
)
doc_category = DOC_CATEGORY_PAYMENTS
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index bd6079b812..9c4d038de2 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -583,7 +583,7 @@ type Query {
payment(
"""ID of the payment."""
id: ID!
- ): Payment @doc(category: "Payments")
+ ): Payment @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
List of payments.
@@ -609,7 +609,7 @@ type Query {
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
last: Int
- ): PaymentCountableConnection @doc(category: "Payments")
+ ): PaymentCountableConnection @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Look up a transaction by ID.
@@ -2208,25 +2208,25 @@ enum WebhookEventTypeEnum @doc(category: "Webhooks") {
SHOP_METADATA_UPDATED
"""Listing available payment gateways."""
- PAYMENT_LIST_GATEWAYS
+ PAYMENT_LIST_GATEWAYS @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Authorize payment."""
- PAYMENT_AUTHORIZE
+ PAYMENT_AUTHORIZE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Capture payment."""
- PAYMENT_CAPTURE
+ PAYMENT_CAPTURE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Refund payment."""
- PAYMENT_REFUND
+ PAYMENT_REFUND @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Void payment."""
- PAYMENT_VOID
+ PAYMENT_VOID @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Confirm payment."""
- PAYMENT_CONFIRM
+ PAYMENT_CONFIRM @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Process payment."""
- PAYMENT_PROCESS
+ PAYMENT_PROCESS @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Event called for checkout tax calculation."""
CHECKOUT_CALCULATE_TAXES
@@ -2273,25 +2273,25 @@ type WebhookEventSync @doc(category: "Webhooks") {
"""Enum determining type of webhook."""
enum WebhookEventTypeSyncEnum @doc(category: "Webhooks") {
"""Listing available payment gateways."""
- PAYMENT_LIST_GATEWAYS
+ PAYMENT_LIST_GATEWAYS @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Authorize payment."""
- PAYMENT_AUTHORIZE
+ PAYMENT_AUTHORIZE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Capture payment."""
- PAYMENT_CAPTURE
+ PAYMENT_CAPTURE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Refund payment."""
- PAYMENT_REFUND
+ PAYMENT_REFUND @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Void payment."""
- PAYMENT_VOID
+ PAYMENT_VOID @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Confirm payment."""
- PAYMENT_CONFIRM
+ PAYMENT_CONFIRM @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Process payment."""
- PAYMENT_PROCESS
+ PAYMENT_PROCESS @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Event called for checkout tax calculation."""
CHECKOUT_CALCULATE_TAXES
@@ -3410,7 +3410,7 @@ type User implements Node & ObjectWithMetadata @doc(category: "Users") {
storedPaymentSources(
"""Slug of a channel for which the data should be returned."""
channel: String
- ): [PaymentSource!]
+ ): [PaymentSource!] @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""User language code."""
languageCode: LanguageCodeEnum!
@@ -3658,7 +3658,7 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
Triggers the following webhook events:
- PAYMENT_LIST_GATEWAYS (sync): Fetch payment gateways available for checkout.
"""
- availablePaymentGateways: [PaymentGateway!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [PAYMENT_LIST_GATEWAYS])
+ availablePaymentGateways: [PaymentGateway!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [PAYMENT_LIST_GATEWAYS]) @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Email of a customer."""
email: String
@@ -10645,7 +10645,7 @@ Determine the mark as paid strategy for the channel.
"""
enum MarkAsPaidStrategyEnum @doc(category: "Channels") {
TRANSACTION_FLOW
- PAYMENT_FLOW
+ PAYMENT_FLOW @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
"""The `Day` scalar type represents number of days by integer value."""
@@ -11845,7 +11845,7 @@ type Order implements Node & ObjectWithMetadata @doc(category: "Orders") {
transactions: [TransactionItem!]!
"""List of payments for the order."""
- payments: [Payment!]!
+ payments: [Payment!]! @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Total amount of the order."""
total: TaxedMoney!
@@ -12591,16 +12591,16 @@ type PageTranslatableContent implements Node @doc(category: "Pages") {
enum OrderAction @doc(category: "Payments") {
"""Represents the capture action."""
- CAPTURE
+ CAPTURE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Represents a mark-as-paid action."""
MARK_AS_PAID
"""Represents a refund action."""
- REFUND
+ REFUND @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Represents a void action."""
- VOID
+ VOID @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
"""Represents an Invoice."""
@@ -12751,7 +12751,11 @@ enum OrderChargeStatusEnum @doc(category: "Orders") {
OVERCHARGED
}
-"""Represents a payment of a given type."""
+"""
+Represents a payment of a given type.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
"""ID of the payment."""
id: ID!
@@ -12861,7 +12865,11 @@ type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
pspReference: String
}
-"""An object representing a single payment."""
+"""
+An object representing a single payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type Transaction implements Node @doc(category: "Payments") {
"""ID of the transaction."""
id: ID!
@@ -12885,23 +12893,23 @@ type Transaction implements Node @doc(category: "Payments") {
error: String
"""Response returned by payment gateway."""
- gatewayResponse: JSONString! @deprecated(reason: "This field is a part of a legacy Payments API. Please use apps instead.")
+ gatewayResponse: JSONString! @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Total amount of the transaction."""
amount: Money
}
enum TransactionKind @doc(category: "Payments") {
- EXTERNAL
- AUTH
- PENDING
- ACTION_TO_CONFIRM
- REFUND
- REFUND_ONGOING
- CAPTURE
- VOID
- CONFIRM
- CANCEL
+ EXTERNAL @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ AUTH @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ PENDING @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ ACTION_TO_CONFIRM @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ REFUND @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ REFUND_ONGOING @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ CAPTURE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ VOID @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ CONFIRM @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
+ CANCEL @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
type CreditCard @doc(category: "Payments") {
@@ -13840,6 +13848,8 @@ enum CustomerEventsEnum @doc(category: "Users") {
"""
Represents a payment source stored for user in payment gateway, such as credit card.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
"""
type PaymentSource @doc(category: "Payments") {
"""Payment gateway name."""
@@ -14885,7 +14895,7 @@ type Shop implements ObjectWithMetadata {
"""Slug of a channel for which the data should be returned."""
channel: String
- ): [PaymentGateway!]!
+ ): [PaymentGateway!]! @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""List of available external authentications."""
availableExternalAuthentications: [ExternalAuthentication!]!
@@ -15458,6 +15468,11 @@ type PaymentCountableEdge @doc(category: "Payments") {
cursor: String!
}
+"""
+Filtering options for payments.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
input PaymentFilterInput @doc(category: "Payments") {
"""Filter by ids."""
ids: [ID!]
@@ -15738,7 +15753,7 @@ enum OrderSortField @doc(category: "Orders") {
CUSTOMER
"""Sort orders by payment status."""
- PAYMENT
+ PAYMENT @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Sort orders by fulfillment status."""
FULFILLMENT_STATUS @deprecated(reason: "Use `STATUS` instead.")
@@ -15752,7 +15767,8 @@ enum OrderSortField @doc(category: "Orders") {
}
input OrderFilterInput @doc(category: "Orders") {
- paymentStatus: [PaymentChargeStatusEnum!]
+ """Filter orders by payment charge status."""
+ paymentStatus: [PaymentChargeStatusEnum!] @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
status: [OrderStatusFilter!]
customer: String
created: DateRangeInput
@@ -17007,7 +17023,7 @@ enum CheckoutSortField @doc(category: "Checkout") {
CUSTOMER
"""Sort checkouts by payment."""
- PAYMENT
+ PAYMENT @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Sort checkouts by rank. Note: This option is available only with the `search` filter.
@@ -18737,7 +18753,7 @@ type Mutation {
"""Payment ID."""
paymentId: ID!
- ): PaymentCapture @doc(category: "Payments")
+ ): PaymentCapture @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Refunds the captured payment amount.
@@ -18750,7 +18766,7 @@ type Mutation {
"""Payment ID."""
paymentId: ID!
- ): PaymentRefund @doc(category: "Payments")
+ ): PaymentRefund @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Voids the authorized payment.
@@ -18760,7 +18776,7 @@ type Mutation {
paymentVoid(
"""Payment ID."""
paymentId: ID!
- ): PaymentVoid @doc(category: "Payments")
+ ): PaymentVoid @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Initializes payment process when it is required by gateway."""
paymentInitialize(
@@ -18772,13 +18788,13 @@ type Mutation {
"""Client-side generated data required to initialize the payment."""
paymentData: JSONString
- ): PaymentInitialize @doc(category: "Payments")
+ ): PaymentInitialize @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Check payment balance."""
paymentCheckBalance(
"""Fields required to check payment balance."""
input: PaymentCheckBalanceInput!
- ): PaymentCheckBalance @doc(category: "Payments")
+ ): PaymentCheckBalance @doc(category: "Payments") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Creates transaction for checkout or order.
@@ -19373,7 +19389,7 @@ type Mutation {
"""ID of the order to capture."""
id: ID!
- ): OrderCapture @doc(category: "Orders")
+ ): OrderCapture @doc(category: "Orders") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Confirms an unconfirmed order by changing status to unfulfilled.
@@ -19649,7 +19665,7 @@ type Mutation {
"""ID of the order to refund."""
id: ID!
- ): OrderRefund @doc(category: "Orders")
+ ): OrderRefund @doc(category: "Orders") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Updates an order.
@@ -19688,7 +19704,7 @@ type Mutation {
orderVoid(
"""ID of the order to void."""
id: ID!
- ): OrderVoid @doc(category: "Orders")
+ ): OrderVoid @doc(category: "Orders") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Cancels orders.
@@ -21006,7 +21022,7 @@ type Mutation {
"""Checkout token."""
token: UUID @deprecated(reason: "Use `id` instead.")
- ): CheckoutPaymentCreate @doc(category: "Checkout")
+ ): CheckoutPaymentCreate @doc(category: "Checkout") @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Updates shipping address in the existing checkout.
@@ -25943,6 +25959,8 @@ type PaymentInitialize @doc(category: "Payments") {
"""
Server-side data generated by a payment gateway. Optional step when the payment provider requires an additional action to initialize payment session.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
"""
type PaymentInitialized @doc(category: "Payments") {
"""ID of a payment gateway."""
@@ -25963,6 +25981,11 @@ type PaymentCheckBalance @doc(category: "Payments") {
errors: [PaymentError!]!
}
+"""
+Fields required to check a payment balance.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
input PaymentCheckBalanceInput @doc(category: "Payments") {
"""An ID of a payment gateway to check."""
gatewayId: String!
@@ -25977,6 +26000,11 @@ input PaymentCheckBalanceInput @doc(category: "Payments") {
card: CardInput!
}
+"""
+Card data used to check a payment balance.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
input CardInput {
"""
Payment method nonce, a token returned by the appropriate provider's SDK.
@@ -31028,6 +31056,11 @@ type CheckoutPaymentCreate @doc(category: "Checkout") {
errors: [PaymentError!]!
}
+"""
+Fields required to create a payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
input PaymentInput @doc(category: "Payments") {
"""A gateway to use with that payment."""
gateway: String!
@@ -31063,15 +31096,15 @@ enum StorePaymentMethodEnum @doc(category: "Payments") {
"""
On session storage type. The payment is stored only to be reused when the customer is present in the checkout flow.
"""
- ON_SESSION
+ ON_SESSION @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""
Off session storage type. The payment is stored to be reused even if the customer is absent.
"""
- OFF_SESSION
+ OFF_SESSION @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
"""Storage is disabled. The payment is not stored."""
- NONE
+ NONE @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
"""
@@ -37169,7 +37202,11 @@ type ThumbnailCreated implements Event @doc(category: "Miscellaneous") {
mediaUrl: String
}
-"""Authorize payment."""
+"""
+Authorize payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentAuthorize implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37184,10 +37221,14 @@ type PaymentAuthorize implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""Capture payment."""
+"""
+Capture payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentCaptureEvent implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37202,10 +37243,14 @@ type PaymentCaptureEvent implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""Refund payment."""
+"""
+Refund payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentRefundEvent implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37220,10 +37265,14 @@ type PaymentRefundEvent implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""Void payment."""
+"""
+Void payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentVoidEvent implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37238,10 +37287,14 @@ type PaymentVoidEvent implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""Confirm payment."""
+"""
+Confirm payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentConfirmEvent implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37256,10 +37309,14 @@ type PaymentConfirmEvent implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""Process payment."""
+"""
+Process payment.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentProcessEvent implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
@@ -37274,10 +37331,14 @@ type PaymentProcessEvent implements Event @doc(category: "Payments") {
recipient: App
"""Look up a payment."""
- payment: Payment
+ payment: Payment @deprecated(reason: "The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.")
}
-"""List payment gateways."""
+"""
+List payment gateways.
+
+The legacy Payments API is deprecated and will be removed. Use the Transactions API instead.
+"""
type PaymentListGateways implements Event @doc(category: "Payments") {
"""Time of the event."""
issuedAt: DateTime
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index 63d1bee74d..09b6f65c94 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -23,6 +23,7 @@ from ..core.descriptions import (
ADDED_IN_323,
DEFAULT_DEPRECATION_REASON,
DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_LEGACY_PAYMENTS,
)
from ..core.doc_category import (
DOC_CATEGORY_AUTH,
@@ -241,6 +242,7 @@ class Shop(graphene.ObjectType):
),
description="List of available payment gateways.",
required=True,
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
available_external_authentications = NonNullList(
ExternalAuthentication,
diff --git a/saleor/graphql/webhook/enums.py b/saleor/graphql/webhook/enums.py
index b68303c098..6c79a79ff3 100644
--- a/saleor/graphql/webhook/enums.py
+++ b/saleor/graphql/webhook/enums.py
@@ -3,6 +3,7 @@ import graphene
from ...webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ..core.descriptions import (
DEFAULT_DEPRECATION_REASON,
+ DEPRECATED_LEGACY_PAYMENTS,
)
from ..core.doc_category import DOC_CATEGORY_WEBHOOKS
from ..core.types import BaseEnum
@@ -291,6 +292,8 @@ def deprecation_reason(enum):
)
if enum.value == WebhookEventAsyncType.ANY:
return DEFAULT_DEPRECATION_REASON
+ if enum.value in WebhookEventSyncType.PAYMENT_EVENTS:
+ return DEPRECATED_LEGACY_PAYMENTS
return None
diff --git a/saleor/graphql/webhook/subscription_types.py b/saleor/graphql/webhook/subscription_types.py
index 5b97b6abb9..e87010d48d 100644
--- a/saleor/graphql/webhook/subscription_types.py
+++ b/saleor/graphql/webhook/subscription_types.py
@@ -54,6 +54,8 @@ from ..core.descriptions import (
ADDED_IN_323,
ADDED_IN_324,
DEPRECATED_IN_3X_EVENT,
+ DEPRECATED_LEGACY_PAYMENTS,
+ DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION,
PREVIEW_FEATURE,
)
from ..core.doc_category import (
@@ -2623,6 +2625,7 @@ class PaymentBase(AbstractType):
payment = graphene.Field(
"saleor.graphql.payment.types.Payment",
description="Look up a payment.",
+ deprecation_reason=DEPRECATED_LEGACY_PAYMENTS,
)
@staticmethod
@@ -2636,7 +2639,7 @@ class PaymentAuthorize(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Authorize payment."
+ description = "Authorize payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2645,7 +2648,7 @@ class PaymentCaptureEvent(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Capture payment."
+ description = "Capture payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2654,7 +2657,7 @@ class PaymentRefundEvent(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Refund payment."
+ description = "Refund payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2663,7 +2666,7 @@ class PaymentVoidEvent(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Void payment."
+ description = "Void payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2672,7 +2675,7 @@ class PaymentConfirmEvent(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Confirm payment."
+ description = "Confirm payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2681,7 +2684,7 @@ class PaymentProcessEvent(SubscriptionObjectType, PaymentBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "Process payment."
+ description = "Process payment." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
doc_category = DOC_CATEGORY_PAYMENTS
@@ -2690,7 +2693,9 @@ class PaymentListGateways(SubscriptionObjectType, CheckoutBase):
root_type = None
enable_dry_run = False
interfaces = (Event,)
- description = "List payment gateways."
+ description = (
+ "List payment gateways." + DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION
+ )
doc_category = DOC_CATEGORY_PAYMENTS