Skip to content

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

Add 3d secure flag to braintree plugin config

Jakub Draganek26b3368addea
diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.py
index f7c90898ac..577708af46 100644
--- a/saleor/payment/gateways/braintree/__init__.py
+++ b/saleor/payment/gateways/braintree/__init__.py
@@ -16,9 +16,6 @@ from ...interface import (
from .errors import DEFAULT_ERROR_MESSAGE, BraintreeException
from .forms import BraintreePaymentForm
-# FIXME: Move to SiteSettings
-THREE_D_SECURE_REQUIRED = False
-
# Error codes whitelist should be a dict of code: error_msg_override
# if no error_msg_override is provided,
# then error message returned by the gateway will be used
@@ -170,7 +167,7 @@ def transaction_for_new_customer(
"options": {
"submit_for_settlement": config.auto_capture,
"store_in_vault_on_success": payment_information.reuse_source,
- "three_d_secure": {"required": THREE_D_SECURE_REQUIRED},
+ "three_d_secure": {"required": config.require_3d_secure},
},
**get_customer_data(payment_information),
}
diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.py
index c4445d74cc..f7638e201d 100644
--- a/saleor/payment/gateways/braintree/plugin.py
+++ b/saleor/payment/gateways/braintree/plugin.py
@@ -84,6 +84,14 @@ class BraintreeGatewayPlugin(BasePlugin):
),
"label": pgettext_lazy("Plugin label", "Automatic payment capture"),
},
+ "Require 3D secure": {
+ "type": ConfigurationTypeField.BOOLEAN,
+ "help_text": pgettext_lazy(
+ "Plugin help text",
+ "Determines if Saleor should enforce 3D secure during payment.",
+ ),
+ "label": pgettext_lazy("Plugin label", "Require 3D secure"),
+ },
}
def __init__(self, *args, **kwargs):
@@ -108,6 +116,7 @@ class BraintreeGatewayPlugin(BasePlugin):
},
template_path="",
store_customer=configuration["Store customers card"],
+ require_3d_secure=configuration["Require 3D secure"],
)
@classmethod
@@ -123,6 +132,7 @@ class BraintreeGatewayPlugin(BasePlugin):
{"name": "Merchant ID", "value": ""},
{"name": "Store customers card", "value": False},
{"name": "Automatic payment capture", "value": True},
+ {"name": "Require 3D secure", "value": False},
],
}
return defaults