Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add public_key to plugin config, fix configuration for storefron1.0
Maciej Korycinski270c430989fa
diff --git a/saleor/payment/gateways/razorpay/__init__.py b/saleor/payment/gateways/razorpay/__init__.pyindex 7f49fe9c02..54a60ae503 100644--- a/saleor/payment/gateways/razorpay/__init__.py+++ b/saleor/payment/gateways/razorpay/__init__.py@@ -80,9 +80,9 @@ def create_form(data, payment_information, connection_params):)-def get_client(public_key: str, secret_key: str, **_):+def get_client(public_key: str, private_key: str, **_):"""Create a Razorpay client from set-up application keys."""- razorpay_client = razorpay.Client(auth=(public_key, secret_key))+ razorpay_client = razorpay.Client(auth=(public_key, private_key))return razorpay_clientdiff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.pyindex bdb328fb23..fdd1fb6968 100644--- a/saleor/payment/gateways/razorpay/plugin.py+++ b/saleor/payment/gateways/razorpay/plugin.py@@ -83,8 +83,11 @@ class RazorpayGatewayPlugin(BasePlugin):connection_params={"public_key": configuration["Public API key"],"private_key": configuration["Secret API key"],+ "prefill": True,+ "store_name": None,+ "store_image": None,},- template_path="",+ template_path=configuration["Template path"],store_customer=configuration["Store customers card"],)@@ -146,3 +149,8 @@ class RazorpayGatewayPlugin(BasePlugin):payment_information,connection_params=self._get_gateway_config().connection_params,)++ @require_active_plugin+ def get_payment_config(self, previous_value):+ config = self._get_gateway_config()+ return [{"field": "api_key", "value": config.connection_params["public_key"]}]diff --git a/tests/gateway/test_razorpay.py b/tests/gateway/test_razorpay.pyindex db7f440bca..5b6f9b7900 100644--- a/tests/gateway/test_razorpay.py+++ b/tests/gateway/test_razorpay.py@@ -36,7 +36,7 @@ def gateway_config():template_path="template.html",connection_params={"public_key": "public",- "secret_key": "secret",+ "private_key": "secret","prefill": True,"store_name": "Saleor","store_image": "image.png",