Skip to content

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

Merge branch 'master' into payments/merge-charge-with-capture

Maciej Korycinski996e9f042474
diff --cc saleor/payment/gateways/dummy/__init__.py
index 9fb048f5f4,a5bf12bdb1..eec2279f2c
--- a/saleor/payment/gateways/dummy/__init__.py
+++ b/saleor/payment/gateways/dummy/__init__.py
@@@ -49,9 -58,9 +49,8 @@@ def void(payment_information: PaymentDa
)
-def capture(
- payment_information: PaymentData, connection_params: Dict
-) -> GatewayResponse:
+def capture(payment_information: PaymentData, config: ConfigData) -> GatewayResponse:
+ """Perform capture transaction."""
-
error = None
success = dummy_success()
if not success:
diff --cc saleor/payment/gateways/razorpay/__init__.py
index d2671bdde9,a250476c21..ade5d55804
--- a/saleor/payment/gateways/razorpay/__init__.py
+++ b/saleor/payment/gateways/razorpay/__init__.py
@@@ -88,9 -95,11 +88,8 @@@ def get_client_token(**_)
return str(uuid.uuid4())
-def charge(
- payment_information: PaymentData, connection_params: Dict
-) -> GatewayResponse:
- """Charge a authorized payment using the razorpay client.
-
+def capture(payment_information: PaymentData, config: ConfigData) -> GatewayResponse:
+ """Capture a authorized payment using the razorpay client.
-
But it first check if the given payment instance is supported
by the gateway.
@@@ -159,9 -168,8 +158,6 @@@ def refund(payment_information: Payment
def process_payment(
- payment_information: PaymentData, connection_params
+ payment_information: PaymentData, config: ConfigData
) -> GatewayResponse:
- return capture(
- payment_information=payment_information,
- connection_params=config.connection_params,
- return charge(
- payment_information=payment_information, connection_params=connection_params
-- )
++ return capture(payment_information=payment_information, config=config)
diff --cc tests/gateway/test_razorpay.py
index 8e3b760644,9c6837d3ac..67565cea04
--- a/tests/gateway/test_razorpay.py
+++ b/tests/gateway/test_razorpay.py
@@@ -71,13 -68,11 +71,13 @@@ def charged_payment(razorpay_payment)
return razorpay_payment
-def test_checkout_widget_render_without_prefill(razorpay_payment, gateway_params):
- gateway_params["prefill"] = False
+def test_checkout_widget_render_without_prefill(razorpay_payment, gateway_config):
+ gateway_config.connection_params["prefill"] = False
payment_info = create_payment_information(razorpay_payment)
widget = RazorPayCheckoutWidget(
- payment_information=payment_info, attrs={"data-custom": "123"}, **gateway_params
+ payment_information=payment_info,
+ attrs={"data-custom": "123"},
- **gateway_config.connection_params
++ **gateway_config.connection_params,
)
assert widget.render() == (
'<script data-amount="8000" data-buttontext="Pay now with Razorpay" '
diff --cc tests/gateway/test_stripe.py
index ceafffae03,8085f0c01e..0879b66fbf
--- a/tests/gateway/test_stripe.py
+++ b/tests/gateway/test_stripe.py
@@@ -213,16 -215,15 +213,15 @@@ def test_widget_with_additional_attr(st
assert 'data-custom="custom-data"' in widget.render()
-def test_widget_with_prefill_option(stripe_payment, gateway_params):
+def test_widget_with_prefill_option(stripe_payment, gateway_config):
payment_info = create_payment_information(stripe_payment)
-
- gateway_params["prefill"] = True
- widget = StripeCheckoutWidget(payment_info, gateway_params)
+ connection_params = gateway_config.connection_params
-
+ connection_params["prefill"] = True
+ widget = StripeCheckoutWidget(payment_info, connection_params)
assert 'data-email="[email protected]"' in widget.render()
- gateway_params["prefill"] = False
- widget = StripeCheckoutWidget(payment_info, gateway_params)
+ connection_params["prefill"] = False
+ widget = StripeCheckoutWidget(payment_info, connection_params)
assert 'data-email="[email protected]"' not in widget.render()