Skip to content

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

Add `PaymentSettings` to `Channel` (#13677)

Maciej Korycinski407dc543da32
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d83d96fe27..0b717b36cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,14 @@ All notable, unreleased changes to this project will be documented in this file.
# 3.16.0 [Unreleased]
### Breaking changes
+- **Feature preview breaking change**:
+ - Deprecate `OrderSettingsInput.defaultTransactionFlowStrategy`. It will be removed
+in 3.17. Use `PaymentSettingsInput.defaultTransactionFlowStrategy` instead.
+ - Deprecate `OrderSettings.defaultTransactionFlowStrategy`. It will be removed
+in 3.17. Use `PaymentSettings.defaultTransactionFlowStrategy` instead.
### GraphQL API
+- Add `PaymentSettings` to `Channel` - #13677 by @korycins
### Saleor Apps
diff --git a/saleor/graphql/channel/mutations/channel_create.py b/saleor/graphql/channel/mutations/channel_create.py
index 62454f7703..babfc2fddd 100644
--- a/saleor/graphql/channel/mutations/channel_create.py
+++ b/saleor/graphql/channel/mutations/channel_create.py
@@ -16,13 +16,16 @@ from ...core.descriptions import (
ADDED_IN_313,
ADDED_IN_314,
ADDED_IN_315,
+ ADDED_IN_316,
DEPRECATED_IN_3X_INPUT,
+ DEPRECATED_PREVIEW_IN_316_INPUT,
PREVIEW_FEATURE,
)
from ...core.doc_category import (
DOC_CATEGORY_CHANNELS,
DOC_CATEGORY_CHECKOUT,
DOC_CATEGORY_ORDERS,
+ DOC_CATEGORY_PAYMENTS,
DOC_CATEGORY_PRODUCTS,
)
from ...core.mutations import ModelMutation
@@ -38,7 +41,11 @@ from ..enums import (
TransactionFlowStrategyEnum,
)
from ..types import Channel
-from .utils import clean_input_checkout_settings, clean_input_order_settings
+from .utils import (
+ clean_input_checkout_settings,
+ clean_input_order_settings,
+ clean_input_payment_settings,
+)
class StockSettingsInput(BaseInputObjectType):
@@ -118,13 +125,17 @@ class OrderSettingsInput(BaseInputObjectType):
description=(
"Determine the transaction flow strategy to be used. "
"Include the selected option in the payload sent to the payment app, as a "
- "requested action for the transaction." + ADDED_IN_313 + PREVIEW_FEATURE
+ "requested action for the transaction."
+ + ADDED_IN_313
+ + PREVIEW_FEATURE
+ + DEPRECATED_PREVIEW_IN_316_INPUT
+ + " Use `PaymentSettingsInput.defaultTransactionFlowStrategy` instead."
),
)
allow_unpaid_orders = graphene.Boolean(
required=False,
description=(
- "Determine if it is possible to place unpdaid order by calling "
+ "Determine if it is possible to place unpaid order by calling "
"`checkoutComplete` mutation." + ADDED_IN_315 + PREVIEW_FEATURE
),
)
@@ -133,6 +144,20 @@ class OrderSettingsInput(BaseInputObjectType):
doc_category = DOC_CATEGORY_ORDERS
+class PaymentSettingsInput(BaseInputObjectType):
+ default_transaction_flow_strategy = TransactionFlowStrategyEnum(
+ required=False,
+ description=(
+ "Determine the transaction flow strategy to be used. "
+ "Include the selected option in the payload sent to the payment app, as a "
+ "requested action for the transaction." + ADDED_IN_316 + PREVIEW_FEATURE
+ ),
+ )
+
+ class Meta:
+ doc_category = DOC_CATEGORY_PAYMENTS
+
+
class ChannelInput(BaseInputObjectType):
is_active = graphene.Boolean(
description="Determine if channel will be set active or not."
@@ -173,6 +198,11 @@ class ChannelInput(BaseInputObjectType):
description="The channel checkout settings" + ADDED_IN_315 + PREVIEW_FEATURE,
required=False,
)
+ payment_settings = graphene.Field(
+ PaymentSettingsInput,
+ description="The channel payment settings" + ADDED_IN_316 + PREVIEW_FEATURE,
+ required=False,
+ )
class Meta:
doc_category = DOC_CATEGORY_CHANNELS
@@ -237,6 +267,9 @@ class ChannelCreate(ModelMutation):
if checkout_settings := cleaned_input.get("checkout_settings"):
clean_input_checkout_settings(checkout_settings, cleaned_input)
+ if payment_settings := cleaned_input.get("payment_settings"):
+ clean_input_payment_settings(payment_settings, cleaned_input)
+
return cleaned_input
@classmethod
diff --git a/saleor/graphql/channel/mutations/channel_update.py b/saleor/graphql/channel/mutations/channel_update.py
index 5178e1e96b..674341e0c5 100644
--- a/saleor/graphql/channel/mutations/channel_update.py
+++ b/saleor/graphql/channel/mutations/channel_update.py
@@ -9,6 +9,7 @@ from ....permission.enums import (
ChannelPermissions,
CheckoutPermissions,
OrderPermissions,
+ PaymentPermissions,
)
from ....shipping.tasks import (
drop_invalid_shipping_methods_relations_for_given_channels,
@@ -26,7 +27,11 @@ from ...utils.validators import check_for_duplicates
from ..types import Channel
from ..utils import delete_invalid_warehouse_to_shipping_zone_relations
from .channel_create import ChannelInput
-from .utils import clean_input_checkout_settings, clean_input_order_settings
+from .utils import (
+ clean_input_checkout_settings,
+ clean_input_order_settings,
+ clean_input_payment_settings,
+)
class ChannelUpdateInput(ChannelInput):
@@ -67,10 +72,13 @@ class ChannelUpdate(ModelMutation):
"Requires one of the following permissions: MANAGE_CHANNELS.\n"
"Requires one of the following permissions "
"when updating only `orderSettings` field: "
- "MANAGE_CHANNELS, MANAGE_ORDERS."
+ "`MANAGE_CHANNELS`, `MANAGE_ORDERS`.\n"
"Requires one of the following permissions "
"when updating only `checkoutSettings` field: "
- "MANAGE_CHANNELS, MANAGE_CHECKOUTS."
+ "`MANAGE_CHANNELS`, `MANAGE_CHECKOUTS`.\n"
+ "Requires one of the following permissions "
+ "when updating only `paymentSettings` field: "
+ "`MANAGE_CHANNELS`, `HANDLE_PAYMENTS`."
)
auto_permission_message = False
model = models.Channel
@@ -122,35 +130,42 @@ class ChannelUpdate(ModelMutation):
if checkout_settings := cleaned_input.get("checkout_settings"):
clean_input_checkout_settings(checkout_settings, cleaned_input)
+ if payment_settings := cleaned_input.get("payment_settings"):
+ clean_input_payment_settings(payment_settings, cleaned_input)
+
return cleaned_input
@classmethod
def check_permissions(cls, context, permissions=None, **data):
permissions = [ChannelPermissions.MANAGE_CHANNELS]
- all_perm_required = False
- # Permission MANAGE_ORDERS or MANAGE_CHANNELS is required to update
- # orderSettings. MANAGE_ORDERS can be used only when
- # channelUpdate mutation will get OrderSettingsInput and
- # not any other fields. Otherwise needed permission is MANAGE_CHANNELS.
+ has_permission = super().check_permissions(
+ context, permissions, require_all_permissions=False, **data
+ )
+ if has_permission:
+ return has_permission
+
+ # Validate if user/app has enough permissions to update the specific settings.
input = data["data"]["input"]
- if ["order_settings"] == list(input.keys()):
- permissions.append(OrderPermissions.MANAGE_ORDERS)
+ settings_per_permission_map = {
+ "order_settings": OrderPermissions.MANAGE_ORDERS,
+ "checkout_settings": CheckoutPermissions.MANAGE_CHECKOUTS,
+ "payment_settings": PaymentPermissions.HANDLE_PAYMENTS,
+ }
- # Permission MANAGE_CHECKOUTS or MANAGE_CHANNELS is required to update
- # checkoutSettings.
- if ["checkout_settings"] == list(input.keys()):
- permissions.append(CheckoutPermissions.MANAGE_CHECKOUTS)
+ if set(input.keys()).difference(settings_per_permission_map.keys()):
+ # user/app doesn't have MANAGE_CHANNELS and input contains not only
+ # settings fields.
+ return False
- if set(["order_settings", "checkout_settings"]) == set(input.keys()):
- permissions = [
- OrderPermissions.MANAGE_ORDERS,
- CheckoutPermissions.MANAGE_CHECKOUTS,
- ]
- all_perm_required = True
+ permissions = []
+ for key in input.keys():
+ permissions.append(settings_per_permission_map[key])
+ if not permissions:
+ return False
return super().check_permissions(
- context, permissions, require_all_permissions=all_perm_required, **data
+ context, permissions, require_all_permissions=True, **data
)
@classmethod
diff --git a/saleor/graphql/channel/mutations/utils.py b/saleor/graphql/channel/mutations/utils.py
index 1e927c381d..1cf607c34f 100644
--- a/saleor/graphql/channel/mutations/utils.py
+++ b/saleor/graphql/channel/mutations/utils.py
@@ -88,3 +88,12 @@ def clean_input_checkout_settings(checkout_settings: dict, cleaned_input: dict):
cleaned_input["use_legacy_error_flow_for_checkout"] = checkout_settings[
"use_legacy_error_flow"
]
+
+
+def clean_input_payment_settings(payment_settings: dict, cleaned_input: dict):
+ if default_transaction_strategy := payment_settings.get(
+ "default_transaction_flow_strategy"
+ ):
+ cleaned_input[
+ "default_transaction_flow_strategy"
+ ] = default_transaction_strategy
diff --git a/saleor/graphql/channel/tests/mutations/test_channel_create.py b/saleor/graphql/channel/tests/mutations/test_channel_create.py
index 298cd45342..7328c0ab68 100644
--- a/saleor/graphql/channel/tests/mutations/test_channel_create.py
+++ b/saleor/graphql/channel/tests/mutations/test_channel_create.py
@@ -51,6 +51,9 @@ CHANNEL_CREATE_MUTATION = """
checkoutSettings {
useLegacyErrorFlow
}
+ paymentSettings {
+ defaultTransactionFlowStrategy
+ }
}
errors{
field
@@ -602,7 +605,7 @@ def test_channel_create_set_order_mark_as_paid(
)
-def test_channel_create_set_default_transaction_flow_strategy(
+def test_channel_create_set_default_transaction_flow_strategy_via_order_settings(
permission_manage_channels,
staff_api_client,
):
@@ -648,6 +651,52 @@ def test_channel_create_set_default_transaction_flow_strategy(
)
+def test_channel_create_set_default_transaction_flow_strategy(
+ permission_manage_channels,
+ staff_api_client,
+):
+ # given
+ name = "testName"
+ slug = "test_slug"
+ currency_code = "USD"
+ default_country = "US"
+ variables = {
+ "input": {
+ "name": name,
+ "slug": slug,
+ "currencyCode": currency_code,
+ "defaultCountry": default_country,
+ "paymentSettings": {
+ "defaultTransactionFlowStrategy": (
+ TransactionFlowStrategyEnum.AUTHORIZATION.name
+ )
+ },
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(
+ CHANNEL_CREATE_MUTATION,
+ variables=variables,
+ permissions=(permission_manage_channels,),
+ )
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["channelCreate"]
+ assert not data["errors"]
+ channel_data = data["channel"]
+ channel = Channel.objects.get()
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == TransactionFlowStrategyEnum.AUTHORIZATION.name
+ )
+ assert (
+ channel.default_transaction_flow_strategy
+ == TransactionFlowStrategyEnum.AUTHORIZATION.value
+ )
+
+
def test_channel_create_set_delete_expired_orders_after(
permission_manage_channels,
staff_api_client,
diff --git a/saleor/graphql/channel/tests/mutations/test_channel_update.py b/saleor/graphql/channel/tests/mutations/test_channel_update.py
index 9bd0dd9aff..3f1fe8efa2 100644
--- a/saleor/graphql/channel/tests/mutations/test_channel_update.py
+++ b/saleor/graphql/channel/tests/mutations/test_channel_update.py
@@ -1021,7 +1021,7 @@ def test_channel_update_order_mark_as_paid_strategy(
)
-def test_channel_update_default_transaction_flow_strategy(
+def test_channel_update_default_transaction_flow_strategy_via_order_settings(
permission_manage_orders,
staff_api_client,
channel_USD,
@@ -1347,3 +1347,109 @@ def test_channel_update_with_order_and_checkout_settings(
assert channel_USD.use_legacy_error_flow_for_checkout is False
assert channel_data["orderSettings"]["automaticallyConfirmAllNewOrders"] is False
assert channel_USD.automatically_confirm_all_new_orders is False
+
+
+CHANNEL_UPDATE_MUTATION_WITH_PAYMENT_SETTINGS = """
+ mutation UpdateChannel($id: ID!,$input: ChannelUpdateInput!){
+ channelUpdate(id: $id, input: $input){
+ channel{
+ id
+ name
+ slug
+ currencyCode
+ paymentSettings {
+ defaultTransactionFlowStrategy
+ }
+ }
+ errors{
+ field
+ code
+ message
+ shippingZones
+ warehouses
+ }
+ }
+ }
+"""
+
+
+def test_channel_update_default_transaction_flow_strategy(
+ permission_manage_channels,
+ staff_api_client,
+ channel_USD,
+):
+ # given
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {
+ "id": channel_id,
+ "input": {
+ "paymentSettings": {
+ "defaultTransactionFlowStrategy": (
+ TransactionFlowStrategyEnum.AUTHORIZATION.name
+ ),
+ },
+ },
+ }
+
+ # when
+ response = staff_api_client.post_graphql(
+ CHANNEL_UPDATE_MUTATION_WITH_PAYMENT_SETTINGS,
+ variables=variables,
+ permissions=(permission_manage_channels,),
+ )
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["channelUpdate"]
+ assert not data["errors"]
+ channel_data = data["channel"]
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == TransactionFlowStrategyEnum.AUTHORIZATION.name
+ )
+ channel_USD.refresh_from_db()
+ assert (
+ channel_USD.default_transaction_flow_strategy
+ == TransactionFlowStrategyEnum.AUTHORIZATION.value
+ )
+
+
+def test_channel_update_default_transaction_flow_strategy_with_payment_permission(
+ permission_manage_payments,
+ staff_api_client,
+ channel_USD,
+):
+ # given
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {
+ "id": channel_id,
+ "input": {
+ "paymentSettings": {
+ "defaultTransactionFlowStrategy": (
+ TransactionFlowStrategyEnum.AUTHORIZATION.name
+ ),
+ },
+ },
+ }
+
+ # when
+ response = staff_api_client.post_graphql(
+ CHANNEL_UPDATE_MUTATION_WITH_PAYMENT_SETTINGS,
+ variables=variables,
+ permissions=(permission_manage_payments,),
+ )
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["channelUpdate"]
+ assert not data["errors"]
+ channel_data = data["channel"]
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == TransactionFlowStrategyEnum.AUTHORIZATION.name
+ )
+ channel_USD.refresh_from_db()
+ assert (
+ channel_USD.default_transaction_flow_strategy
+ == TransactionFlowStrategyEnum.AUTHORIZATION.value
+ )
diff --git a/saleor/graphql/channel/tests/queries/test_channel.py b/saleor/graphql/channel/tests/queries/test_channel.py
index 693381a626..3cc872f754 100644
--- a/saleor/graphql/channel/tests/queries/test_channel.py
+++ b/saleor/graphql/channel/tests/queries/test_channel.py
@@ -1,6 +1,7 @@
import graphene
from prices import Money
+from .....channel import TransactionFlowStrategy
from .....shipping.models import ShippingMethodChannelListing, ShippingZone
from ....tests.utils import (
assert_no_permission,
@@ -555,3 +556,132 @@ def test_query_channel_checkout_settings_with_manage_checkouts(
channel_data["checkoutSettings"]["useLegacyErrorFlow"]
== channel_USD.use_legacy_error_flow_for_checkout
)
+
+
+QUERY_CHANNEL_PAYMENT_SETTINGS = """
+ query getChannel($id: ID){
+ channel(id: $id){
+ id
+ paymentSettings {
+ defaultTransactionFlowStrategy
+ }
+ }
+ }
+"""
+
+
+def test_query_channel_payment_settings_as_staff_user(
+ permission_manage_channels, staff_api_client, channel_USD
+):
+ # given
+ channel_USD.default_transaction_flow_strategy = (
+ TransactionFlowStrategy.AUTHORIZATION
+ )
+ channel_USD.save()
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {"id": channel_id}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_CHANNEL_PAYMENT_SETTINGS,
+ variables=variables,
+ permissions=[permission_manage_channels],
+ )
+ content = get_graphql_content(response)
+
+ # then
+ channel_data = content["data"]["channel"]
+ assert channel_data["id"] == channel_id
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == channel_USD.default_transaction_flow_strategy.upper()
+ )
+
+
+def test_query_channel_payment_settings_as_app(
+ permission_manage_channels,
+ app_api_client,
+ channel_USD,
+):
+ # given
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {"id": channel_id}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_CHANNEL_PAYMENT_SETTINGS,
+ variables=variables,
+ permissions=[permission_manage_channels],
+ )
+ content = get_graphql_content(response)
+
+ # then
+ channel_data = content["data"]["channel"]
+ assert channel_data["id"] == channel_id
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == channel_USD.default_transaction_flow_strategy.upper()
+ )
+
+
+def test_query_channel_payment_settings_as_staff_user_no_permission(
+ staff_api_client, channel_USD
+):
+ # given
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {"id": channel_id}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_CHANNEL_PAYMENT_SETTINGS,
+ variables=variables,
+ )
+
+ # then
+ assert_no_permission(response)
+
+
+def test_query_channel_payment_settings_as_app_no_permission(
+ app_api_client,
+ channel_USD,
+):
+ # given
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {"id": channel_id}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_CHANNEL_PAYMENT_SETTINGS,
+ variables=variables,
+ )
+
+ # then
+ assert_no_permission(response)
+
+
+def test_query_channel_payment_settings_with_handle_payments(
+ permission_manage_payments, staff_api_client, channel_USD
+):
+ # given
+ channel_USD.default_transaction_flow_strategy = (
+ TransactionFlowStrategy.AUTHORIZATION
+ )
+ channel_USD.save()
+ channel_id = graphene.Node.to_global_id("Channel", channel_USD.id)
+ variables = {"id": channel_id}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_CHANNEL_PAYMENT_SETTINGS,
+ variables=variables,
+ permissions=[permission_manage_payments],
+ )
+ content = get_graphql_content(response)
+
+ # then
+ channel_data = content["data"]["channel"]
+ assert channel_data["id"] == channel_id
+ assert (
+ channel_data["paymentSettings"]["defaultTransactionFlowStrategy"]
+ == channel_USD.default_transaction_flow_strategy.upper()
+ )
diff --git a/saleor/graphql/channel/types.py b/saleor/graphql/channel/types.py
index 2b6d6e0b14..88c82216e5 100644
--- a/saleor/graphql/channel/types.py
+++ b/saleor/graphql/channel/types.py
@@ -16,6 +16,7 @@ from ...permission.enums import (
ChannelPermissions,
CheckoutPermissions,
OrderPermissions,
+ PaymentPermissions,
)
from ..account.enums import CountryCodeEnum
from ..core import ResolveInfo
@@ -28,12 +29,15 @@ from ..core.descriptions import (
ADDED_IN_313,
ADDED_IN_314,
ADDED_IN_315,
+ ADDED_IN_316,
DEPRECATED_IN_3X_FIELD,
+ DEPRECATED_PREVIEW_IN_316_FIELD,
PREVIEW_FEATURE,
)
from ..core.doc_category import (
DOC_CATEGORY_CHECKOUT,
DOC_CATEGORY_ORDERS,
+ DOC_CATEGORY_PAYMENTS,
DOC_CATEGORY_PRODUCTS,
)
from ..core.fields import PermissionsField
@@ -246,7 +250,11 @@ class OrderSettings(ObjectType):
description=(
"Determine the transaction flow strategy to be used. "
"Include the selected option in the payload sent to the payment app, as a "
- "requested action for the transaction." + ADDED_IN_313 + PREVIEW_FEATURE
+ "requested action for the transaction."
+ + ADDED_IN_313
+ + PREVIEW_FEATURE
+ + DEPRECATED_PREVIEW_IN_316_FIELD
+ + " Use `PaymentSettings.defaultTransactionFlowStrategy` instead."
),
)
delete_expired_orders_after = Day(
@@ -270,6 +278,21 @@ class OrderSettings(ObjectType):
doc_category = DOC_CATEGORY_ORDERS
+class PaymentSettings(ObjectType):
+ default_transaction_flow_strategy = TransactionFlowStrategyEnum(
+ required=True,
+ description=(
+ "Determine the transaction flow strategy to be used. "
+ "Include the selected option in the payload sent to the payment app, as a "
+ "requested action for the transaction." + ADDED_IN_316 + PREVIEW_FEATURE
+ ),
+ )
+
+ class Meta:
+ description = "Represents the channel-specific payment settings."
+ doc_category = DOC_CATEGORY_PAYMENTS
+
+
class Channel(ModelObjectType):
id = graphene.GlobalID(required=True, description="The ID of the channel.")
slug = graphene.String(
@@ -375,6 +398,17 @@ class Channel(ModelObjectType):
CheckoutPermissions.MANAGE_CHECKOUTS,
],
)
+ payment_settings = PermissionsField(
+ PaymentSettings,
+ description="Channel-specific payment settings."
+ + ADDED_IN_316
+ + PREVIEW_FEATURE,
+ required=True,
+ permissions=[
+ ChannelPermissions.MANAGE_CHANNELS,
+ PaymentPermissions.HANDLE_PAYMENTS,
+ ],
+ )
class Meta:
description = "Represents channel."
@@ -531,3 +565,9 @@ class Channel(ModelObjectType):
return CheckoutSettings(
use_legacy_error_flow=root.use_legacy_error_flow_for_checkout
)
+
+ @staticmethod
+ def resolve_payment_settings(root: models.Channel, _info):
+ return PaymentSettings(
+ default_transaction_flow_strategy=root.default_transaction_flow_strategy,
+ )
diff --git a/saleor/graphql/core/descriptions.py b/saleor/graphql/core/descriptions.py
index 7f7b2c2235..5e13ba8eb7 100644
--- a/saleor/graphql/core/descriptions.py
+++ b/saleor/graphql/core/descriptions.py
@@ -2,10 +2,17 @@
# `deprecation_reason` argument is supported.
DEPRECATED_IN_3X_FIELD = "This field will be removed in Saleor 4.0."
+DEPRECATED_PREVIEW_IN_316_FIELD = (
+ "This preview feature field will be removed in Saleor 3.17."
+)
# Deprecation message for input fields and query arguments. Use it, when
# deprecation message needs to be included in the field description.
DEPRECATED_IN_3X_INPUT = "\n\nDEPRECATED: this field will be removed in Saleor 4.0."
+DEPRECATED_PREVIEW_IN_316_INPUT = (
+ "\n\nDEPRECATED: this preview feature field will be removed in Saleor 3.17."
+)
+
# Deprecation message for enum values.
DEPRECATED_IN_3X_ENUM_VALUE = (
"\n\nDEPRECATED: this value will be removed in Saleor 4.0."
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 2800a70a5e..0087202825 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -4965,6 +4965,17 @@ type Channel implements Node & ObjectWithMetadata @doc(category: "Channels") {
Requires one of the following permissions: MANAGE_CHANNELS, MANAGE_CHECKOUTS.
"""
checkoutSettings: CheckoutSettings!
+
+ """
+ Channel-specific payment settings.
+
+ Added in Saleor 3.16.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+
+ Requires one of the following permissions: MANAGE_CHANNELS, HANDLE_PAYMENTS.
+ """
+ paymentSettings: PaymentSettings!
}
"""
@@ -5398,7 +5409,7 @@ type OrderSettings {
Added in Saleor 3.13.
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.This preview feature field will be removed in Saleor 3.17. Use `PaymentSettings.defaultTransactionFlowStrategy` instead.
"""
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum!
@@ -5470,6 +5481,18 @@ type CheckoutSettings {
useLegacyErrorFlow: Boolean!
}
+"""Represents the channel-specific payment settings."""
+type PaymentSettings {
+ """
+ Determine the transaction flow strategy to be used. Include the selected option in the payload sent to the payment app, as a requested action for the transaction.
+
+ Added in Saleor 3.16.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ defaultTransactionFlowStrategy: TransactionFlowStrategyEnum!
+}
+
"""Represents shipping method postal code rule."""
type ShippingMethodPostalCodeRule implements Node @doc(category: "Shipping") {
"""The ID of the object."""
@@ -17586,7 +17609,9 @@ type Mutation {
Update a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
- Requires one of the following permissions when updating only `orderSettings` field: MANAGE_CHANNELS, MANAGE_ORDERS.Requires one of the following permissions when updating only `checkoutSettings` field: MANAGE_CHANNELS, MANAGE_CHECKOUTS.
+ Requires one of the following permissions when updating only `orderSettings` field: `MANAGE_CHANNELS`, `MANAGE_ORDERS`.
+ Requires one of the following permissions when updating only `checkoutSettings` field: `MANAGE_CHANNELS`, `MANAGE_CHECKOUTS`.
+ Requires one of the following permissions when updating only `paymentSettings` field: `MANAGE_CHANNELS`, `HANDLE_PAYMENTS`.
Triggers the following webhook events:
- CHANNEL_UPDATED (async): A channel was updated.
@@ -26925,6 +26950,15 @@ input ChannelCreateInput @doc(category: "Channels") {
"""
checkoutSettings: CheckoutSettingsInput
+ """
+ The channel payment settings
+
+ Added in Saleor 3.16.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ paymentSettings: PaymentSettingsInput
+
"""Name of the channel."""
name: String!
@@ -26995,11 +27029,13 @@ input OrderSettingsInput @doc(category: "Orders") {
Added in Saleor 3.13.
Note: this API is currently in Feature Preview and can be subject to changes at later point.
+
+ DEPRECATED: this preview feature field will be removed in Saleor 3.17. Use `PaymentSettingsInput.defaultTransactionFlowStrategy` instead.
"""
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum
"""
- Determine if it is possible to place unpdaid order by calling `checkoutComplete` mutation.
+ Determine if it is possible to place unpaid order by calling `checkoutComplete` mutation.
Added in Saleor 3.15.
@@ -27019,11 +27055,24 @@ input CheckoutSettingsInput @doc(category: "Checkout") {
useLegacyErrorFlow: Boolean
}
+input PaymentSettingsInput @doc(category: "Payments") {
+ """
+ Determine the transaction flow strategy to be used. Include the selected option in the payload sent to the payment app, as a requested action for the transaction.
+
+ Added in Saleor 3.16.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ defaultTransactionFlowStrategy: TransactionFlowStrategyEnum
+}
+
"""
Update a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
-Requires one of the following permissions when updating only `orderSettings` field: MANAGE_CHANNELS, MANAGE_ORDERS.Requires one of the following permissions when updating only `checkoutSettings` field: MANAGE_CHANNELS, MANAGE_CHECKOUTS.
+Requires one of the following permissions when updating only `orderSettings` field: `MANAGE_CHANNELS`, `MANAGE_ORDERS`.
+Requires one of the following permissions when updating only `checkoutSettings` field: `MANAGE_CHANNELS`, `MANAGE_CHECKOUTS`.
+Requires one of the following permissions when updating only `paymentSettings` field: `MANAGE_CHANNELS`, `HANDLE_PAYMENTS`.
Triggers the following webhook events:
- CHANNEL_UPDATED (async): A channel was updated.
@@ -27086,6 +27135,15 @@ input ChannelUpdateInput @doc(category: "Channels") {
"""
checkoutSettings: CheckoutSettingsInput
+ """
+ The channel payment settings
+
+ Added in Saleor 3.16.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ paymentSettings: PaymentSettingsInput
+
"""Name of the channel."""
name: String