"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 29a56c8fab24

from .basesdk import BaseSDK
from mollie import models, utils
from mollie._hooks import HookContext
from mollie.types import Nullable, OptionalNullable, UNSET
from mollie.utils import get_security_from_env
from mollie.utils.unmarshal_json_response import unmarshal_json_response
from typing import Any, Mapping, Optional, Union


class Methods(BaseSDK):
    def list(
        self,
        *,
        sequence_type: Optional[models.SequenceType] = None,
        locale: OptionalNullable[models.Locale] = UNSET,
        amount: Optional[Union[models.Amount, models.AmountTypedDict]] = None,
        resource: Optional[models.MethodResourceParameter] = None,
        billing_country: Optional[str] = None,
        include_wallets: Optional[models.MethodIncludeWalletsParameter] = None,
        order_line_categories: Optional[models.LineCategories] = None,
        profile_id: Optional[str] = None,
        include: OptionalNullable[str] = UNSET,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.ListMethodsResponse:
        r"""List payment methods

        Retrieve all enabled payment methods. The results of this endpoint are
        **not** paginated — unlike most other list endpoints in our API.

        For test mode, all pending and enabled payment methods are returned. If no
        payment methods are requested yet, the most popular payment methods are returned in the test mode. For live
        mode, only fully enabled payment methods are returned.

        Payment methods can be requested and enabled via the Mollie Dashboard, or
        via the [Enable payment method endpoint](enable-method) of the Profiles API.

        The list can optionally be filtered using a number of parameters described
        below.

        By default, only payment methods for the Euro currency are returned. If you
        wish to retrieve payment methods which exclusively support other currencies (e.g. Twint), you need to use the
        `amount` parameters.

        ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about
        a non-online payment method, you can use the [Get payment method endpoint](get-method).

        :param sequence_type: Set this parameter to `first` to only return the enabled methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return enabled methods that can be used for recurring payments or subscriptions.
        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param amount: If supplied, only payment methods that support the amount and currency
            are returned.

            Example: `/v2/methods?amount[value]=100.00&amount[currency]=USD`
        :param resource: **⚠️ We no longer recommend using the Orders API. Please refer to the [Payments API](payments-api) instead.**

            Indicate if you will use the result for the [Create order](create-order)
            or the [Create payment](create-payment) endpoint.

            When passing the value `orders`, the result will include payment methods
            that are only available for payments created via the Orders API.
        :param billing_country: The country taken from your customer's billing address in ISO 3166-1 alpha-2 format. This parameter can be used
            to check whether your customer is eligible for certain payment methods, for example for Klarna.

            Example: `/v2/methods?resource=orders&billingCountry=DE`
        :param include_wallets: A comma-separated list of the wallets you support in your checkout. Wallets often require wallet specific code
            to check if they are available on the shoppers device, hence the need to indicate your support.
        :param order_line_categories: A comma-separated list of the line categories you support in your checkout.

            Example: `/v2/methods?orderLineCategories=eco,meal`
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListMethodsRequest(
            sequence_type=sequence_type,
            locale=locale,
            amount=utils.get_pydantic_model(amount, Optional[models.Amount]),
            resource=resource,
            billing_country=billing_country,
            include_wallets=include_wallets,
            order_line_categories=order_line_categories,
            profile_id=profile_id,
            include=include,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request(
            method="GET",
            path="/methods",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.ListMethodsGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="list-methods",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.ListMethodsResponse, http_res)
        if utils.match_response(http_res, "400", "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)

    async def list_async(
        self,
        *,
        sequence_type: Optional[models.SequenceType] = None,
        locale: OptionalNullable[models.Locale] = UNSET,
        amount: Optional[Union[models.Amount, models.AmountTypedDict]] = None,
        resource: Optional[models.MethodResourceParameter] = None,
        billing_country: Optional[str] = None,
        include_wallets: Optional[models.MethodIncludeWalletsParameter] = None,
        order_line_categories: Optional[models.LineCategories] = None,
        profile_id: Optional[str] = None,
        include: OptionalNullable[str] = UNSET,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.ListMethodsResponse:
        r"""List payment methods

        Retrieve all enabled payment methods. The results of this endpoint are
        **not** paginated — unlike most other list endpoints in our API.

        For test mode, all pending and enabled payment methods are returned. If no
        payment methods are requested yet, the most popular payment methods are returned in the test mode. For live
        mode, only fully enabled payment methods are returned.

        Payment methods can be requested and enabled via the Mollie Dashboard, or
        via the [Enable payment method endpoint](enable-method) of the Profiles API.

        The list can optionally be filtered using a number of parameters described
        below.

        By default, only payment methods for the Euro currency are returned. If you
        wish to retrieve payment methods which exclusively support other currencies (e.g. Twint), you need to use the
        `amount` parameters.

        ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about
        a non-online payment method, you can use the [Get payment method endpoint](get-method).

        :param sequence_type: Set this parameter to `first` to only return the enabled methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return enabled methods that can be used for recurring payments or subscriptions.
        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param amount: If supplied, only payment methods that support the amount and currency
            are returned.

            Example: `/v2/methods?amount[value]=100.00&amount[currency]=USD`
        :param resource: **⚠️ We no longer recommend using the Orders API. Please refer to the [Payments API](payments-api) instead.**

            Indicate if you will use the result for the [Create order](create-order)
            or the [Create payment](create-payment) endpoint.

            When passing the value `orders`, the result will include payment methods
            that are only available for payments created via the Orders API.
        :param billing_country: The country taken from your customer's billing address in ISO 3166-1 alpha-2 format. This parameter can be used
            to check whether your customer is eligible for certain payment methods, for example for Klarna.

            Example: `/v2/methods?resource=orders&billingCountry=DE`
        :param include_wallets: A comma-separated list of the wallets you support in your checkout. Wallets often require wallet specific code
            to check if they are available on the shoppers device, hence the need to indicate your support.
        :param order_line_categories: A comma-separated list of the line categories you support in your checkout.

            Example: `/v2/methods?orderLineCategories=eco,meal`
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListMethodsRequest(
            sequence_type=sequence_type,
            locale=locale,
            amount=utils.get_pydantic_model(amount, Optional[models.Amount]),
            resource=resource,
            billing_country=billing_country,
            include_wallets=include_wallets,
            order_line_categories=order_line_categories,
            profile_id=profile_id,
            include=include,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request_async(
            method="GET",
            path="/methods",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.ListMethodsGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="list-methods",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.ListMethodsResponse, http_res)
        if utils.match_response(http_res, "400", "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)

    def all(
        self,
        *,
        locale: OptionalNullable[models.Locale] = UNSET,
        amount: Optional[Union[models.Amount, models.AmountTypedDict]] = None,
        include: OptionalNullable[str] = UNSET,
        sequence_type: Optional[models.SequenceType] = None,
        profile_id: Optional[str] = None,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.ListAllMethodsResponse:
        r"""List all payment methods

        Retrieve all payment methods that Mollie offers, regardless of the eligibility of the organization for the specific
        method. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API.

        The list can optionally be filtered using a number of parameters described below.

        ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about
        a non-online payment method, you can use the [Get payment method endpoint](get-method).

        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param amount: If supplied, only payment methods that support the amount and currency
            are returned.

            Example: `/v2/methods/all?amount[value]=100.00&amount[currency]=USD`
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param sequence_type: Set this parameter to `first` to only return the methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListAllMethodsRequest(
            locale=locale,
            amount=utils.get_pydantic_model(amount, Optional[models.Amount]),
            include=include,
            sequence_type=sequence_type,
            profile_id=profile_id,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request(
            method="GET",
            path="/methods/all",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.ListAllMethodsGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="list-all-methods",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.ListAllMethodsResponse, http_res)
        if utils.match_response(http_res, "400", "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)

    async def all_async(
        self,
        *,
        locale: OptionalNullable[models.Locale] = UNSET,
        amount: Optional[Union[models.Amount, models.AmountTypedDict]] = None,
        include: OptionalNullable[str] = UNSET,
        sequence_type: Optional[models.SequenceType] = None,
        profile_id: Optional[str] = None,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.ListAllMethodsResponse:
        r"""List all payment methods

        Retrieve all payment methods that Mollie offers, regardless of the eligibility of the organization for the specific
        method. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API.

        The list can optionally be filtered using a number of parameters described below.

        ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about
        a non-online payment method, you can use the [Get payment method endpoint](get-method).

        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param amount: If supplied, only payment methods that support the amount and currency
            are returned.

            Example: `/v2/methods/all?amount[value]=100.00&amount[currency]=USD`
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param sequence_type: Set this parameter to `first` to only return the methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListAllMethodsRequest(
            locale=locale,
            amount=utils.get_pydantic_model(amount, Optional[models.Amount]),
            include=include,
            sequence_type=sequence_type,
            profile_id=profile_id,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request_async(
            method="GET",
            path="/methods/all",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.ListAllMethodsGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="list-all-methods",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.ListAllMethodsResponse, http_res)
        if utils.match_response(http_res, "400", "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)

    def get(
        self,
        *,
        method_id: Nullable[models.MethodEnum],
        locale: OptionalNullable[models.Locale] = UNSET,
        currency: Optional[str] = None,
        profile_id: Optional[str] = None,
        include: OptionalNullable[str] = UNSET,
        sequence_type: Optional[models.SequenceType] = None,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.EntityMethodGet:
        r"""Get payment method

        Retrieve a single payment method by its ID.

        If a method is not available on this profile, a `404 Not Found` response is
        returned. If the method is available but not enabled yet, a status `403 Forbidden` is returned. You can enable
        payments methods via the [Enable payment method endpoint](enable-method) of the Profiles API, or via
        the Mollie Dashboard.

        If you do not know the method's ID, you can use the [methods list
        endpoint](list-methods) to retrieve all payment methods that are available.

        Additionally, it is possible to check if wallet methods such as Apple Pay
        are enabled by passing the wallet ID (`applepay`) as the method ID.

        :param method_id: Provide the ID of the related payment method.
        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param currency: If provided, the `minimumAmount` and `maximumAmount` will be converted
            to the given currency. An error is returned if the currency is not supported by the payment method.
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param sequence_type: Set this parameter to `first` to only return the methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.GetMethodRequest(
            method_id=method_id,
            locale=locale,
            currency=currency,
            profile_id=profile_id,
            include=include,
            sequence_type=sequence_type,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request(
            method="GET",
            path="/methods/{methodId}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.GetMethodGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="get-method",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "404", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.EntityMethodGet, http_res)
        if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)

    async def get_async(
        self,
        *,
        method_id: Nullable[models.MethodEnum],
        locale: OptionalNullable[models.Locale] = UNSET,
        currency: Optional[str] = None,
        profile_id: Optional[str] = None,
        include: OptionalNullable[str] = UNSET,
        sequence_type: Optional[models.SequenceType] = None,
        testmode: Optional[bool] = None,
        idempotency_key: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.EntityMethodGet:
        r"""Get payment method

        Retrieve a single payment method by its ID.

        If a method is not available on this profile, a `404 Not Found` response is
        returned. If the method is available but not enabled yet, a status `403 Forbidden` is returned. You can enable
        payments methods via the [Enable payment method endpoint](enable-method) of the Profiles API, or via
        the Mollie Dashboard.

        If you do not know the method's ID, you can use the [methods list
        endpoint](list-methods) to retrieve all payment methods that are available.

        Additionally, it is possible to check if wallet methods such as Apple Pay
        are enabled by passing the wallet ID (`applepay`) as the method ID.

        :param method_id: Provide the ID of the related payment method.
        :param locale: Passing a locale will sort the payment methods in the preferred order
            for the country, and translate the payment method names in the corresponding language.
        :param currency: If provided, the `minimumAmount` and `maximumAmount` will be converted
            to the given currency. An error is returned if the currency is not supported by the payment method.
        :param profile_id: The identifier referring to the [profile](get-profile) you wish to
            retrieve the resources for.

            Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For
            organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
        :param include: This endpoint allows you to include additional information via the
            `include` query string parameter.
        :param sequence_type: Set this parameter to `first` to only return the methods that
            can be used for the first payment of a recurring sequence.

            Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
        :param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query
            parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by
            setting the `testmode` query parameter to `true`.

            Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
        :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.GetMethodRequest(
            method_id=method_id,
            locale=locale,
            currency=currency,
            profile_id=profile_id,
            include=include,
            sequence_type=sequence_type,
            testmode=testmode,
            idempotency_key=idempotency_key,
        )

        req = self._build_request_async(
            method="GET",
            path="/methods/{methodId}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/hal+json",
            http_headers=http_headers,
            _globals=models.GetMethodGlobals(
                profile_id=self.sdk_configuration.globals.profile_id,
                testmode=self.sdk_configuration.globals.testmode,
            ),
            security=self.sdk_configuration.security,
            allow_empty_value=None,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config
            else:
                retries = utils.RetryConfig(
                    "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
                )

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["5xx"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                config=self.sdk_configuration,
                base_url=base_url or "",
                operation_id="get-method",
                oauth2_scopes=None,
                security_source=get_security_from_env(
                    self.sdk_configuration.security, models.Security
                ),
            ),
            request=req,
            error_status_codes=["400", "404", "4XX", "5XX"],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/hal+json"):
            return unmarshal_json_response(models.EntityMethodGet, http_res)
        if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
            response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
            raise models.ErrorResponse(response_data, http_res)
        if utils.match_response(http_res, "4XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise models.APIError("API error occurred", http_res, http_res_text)

        raise models.APIError("Unexpected response received", http_res)
