From f00704cf61ce4ab5248313865adab949a39299c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Tue, 8 Sep 2026 17:00:41 +0200 Subject: [PATCH] fix(payment-setups): use payment_method_name for confirm endpoint path param The confirm_payment_setup path param was named payment_method_option_id, which is not a valid API concept. The real path is /payments/setups/{id}/confirm/{payment_method_name}, so the param and its usage in URL building are renamed accordingly. Also aligns the (currently skipped) integration test's expected confirm response fields with the full PaymentSetup schema, which is what the confirm endpoint actually returns. --- checkout_sdk/payments/setups/setups_client.py | 4 ++-- .../payments/setups/payment_setups_client_test.py | 4 ++-- .../setups/payment_setups_integration_test.py | 15 ++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/checkout_sdk/payments/setups/setups_client.py b/checkout_sdk/payments/setups/setups_client.py index d4591a08..c9640603 100644 --- a/checkout_sdk/payments/setups/setups_client.py +++ b/checkout_sdk/payments/setups/setups_client.py @@ -46,12 +46,12 @@ def get_payment_setup(self, setup_id: str): self._sdk_authorization() ) - def confirm_payment_setup(self, setup_id: str, payment_method_option_id: str): + def confirm_payment_setup(self, setup_id: str, payment_method_name: str): """ Confirms a Payment Setup """ return self._api_client.post( self.build_path(self.__PAYMENTS_PATH, self.__SETUPS_PATH, setup_id, - self.__CONFIRM_PATH, payment_method_option_id), + self.__CONFIRM_PATH, payment_method_name), self._sdk_authorization() ) diff --git a/tests/payments/setups/payment_setups_client_test.py b/tests/payments/setups/payment_setups_client_test.py index 17fd4e70..909fd60b 100644 --- a/tests/payments/setups/payment_setups_client_test.py +++ b/tests/payments/setups/payment_setups_client_test.py @@ -35,5 +35,5 @@ def test_should_get_payment_setup(self, mocker, client: PaymentSetupsClient): def test_should_confirm_payment_setup(self, mocker, client: PaymentSetupsClient): mock = mocker.patch('checkout_sdk.api_client.ApiClient.post', return_value='response') - assert client.confirm_payment_setup('setup_id', 'payment_method_option_id') == 'response' - assert_api_call(mock, 'payments/setups/setup_id/confirm/payment_method_option_id') + assert client.confirm_payment_setup('setup_id', 'card') == 'response' + assert_api_call(mock, 'payments/setups/setup_id/confirm/card') diff --git a/tests/payments/setups/payment_setups_integration_test.py b/tests/payments/setups/payment_setups_integration_test.py index 3bd26b3d..1dd272d0 100644 --- a/tests/payments/setups/payment_setups_integration_test.py +++ b/tests/payments/setups/payment_setups_integration_test.py @@ -137,28 +137,33 @@ def test_should_create_payment_setup_with_additional_payment_methods(default_api assert response.currency == request.currency -@pytest.mark.skip(reason="Integration test - requires valid payment method option") +@pytest.mark.skip(reason="Integration test - requires a payment setup ready to be confirmed") def test_should_confirm_payment_setup(default_api): """Test confirming a payment setup""" # Arrange create_request = create_payment_setups_request() create_response = default_api.setups.create_payment_setup(create_request) - payment_method_option_id = "opt_test_12345" + payment_method_name = "klarna" # Act response = default_api.setups.confirm_payment_setup( create_response.id, - payment_method_option_id + payment_method_name ) # Assert + # The confirm endpoint's response is the full PaymentSetup schema + # (same shape as create/update/get), not a slimmer payments-style response. assert_response(response, + 'http_metadata', 'id', - 'action_id', + 'processing_channel_id', 'amount', 'currency', - 'processed_on') + 'payment_type', + 'reference', + 'description') assert response.amount == create_request.amount assert response.currency == create_request.currency