"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: D410, E501, E101, D206
from apimatic_core.authentication.multiple.and_auth_group import (
    And,
)
from apimatic_core.authentication.multiple.single_auth import (
    Single,
)
from apimatic_core.request_builder import RequestBuilder
from apimatic_core.response_handler import ResponseHandler
from apimatic_core.types.parameter import Parameter

from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.apis.base_api import (
    BaseApi,
)
from visaacceptancemergedspec.configuration import (
    Server,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_1_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException1Exception,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_21_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException21Exception,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_31_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException31Exception,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_41_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException41Exception,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_51_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException51Exception,
)
from visaacceptancemergedspec.exceptions.delete_customer_payment_instrument_exception_71_exception import (  # noqa: E501
    DeleteCustomerPaymentInstrumentException71Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instrument_exception_1_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentException1Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instrument_exception_21_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentException21Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instrument_exception_31_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentException31Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instrument_exception_41_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentException41Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instrument_exception_61_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentException61Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instruments_list_exception_1_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentsListException1Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instruments_list_exception_21_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentsListException21Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instruments_list_exception_31_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentsListException31Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instruments_list_exception_41_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentsListException41Exception,
)
from visaacceptancemergedspec.exceptions.get_customer_payment_instruments_list_exception_61_exception import (  # noqa: E501
    GetCustomerPaymentInstrumentsListException61Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_1_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException1Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_21_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException21Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_31_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException31Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_41_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException41Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_51_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException51Exception,
)
from visaacceptancemergedspec.exceptions.patch_customers_payment_instrument_exception_71_exception import (  # noqa: E501
    PatchCustomersPaymentInstrumentException71Exception,
)
from visaacceptancemergedspec.exceptions.post_customer_payment_instrument_exception_1_exception import (  # noqa: E501
    PostCustomerPaymentInstrumentException1Exception,
)
from visaacceptancemergedspec.exceptions.post_customer_payment_instrument_exception_21_exception import (  # noqa: E501
    PostCustomerPaymentInstrumentException21Exception,
)
from visaacceptancemergedspec.exceptions.post_customer_payment_instrument_exception_31_exception import (  # noqa: E501
    PostCustomerPaymentInstrumentException31Exception,
)
from visaacceptancemergedspec.exceptions.post_customer_payment_instrument_exception_41_exception import (  # noqa: E501
    PostCustomerPaymentInstrumentException41Exception,
)
from visaacceptancemergedspec.exceptions.post_customer_payment_instrument_exception_51_exception import (  # noqa: E501
    PostCustomerPaymentInstrumentException51Exception,
)
from visaacceptancemergedspec.http.http_method_enum import (
    HttpMethodEnum,
)
from visaacceptancemergedspec.models.get_customer_payment_instrument_response import (
    GetCustomerPaymentInstrumentResponse,
)
from visaacceptancemergedspec.models.patch_customers_payment_instrument_response import (  # noqa: E501
    PatchCustomersPaymentInstrumentResponse,
)
from visaacceptancemergedspec.models.payment_instrument_list import (
    PaymentInstrumentList,
)
from visaacceptancemergedspec.models.post_customer_payment_instrument_response import (
    PostCustomerPaymentInstrumentResponse,
)


class CustomerPaymentInstrumentApi(BaseApi):
    """A Controller to access Endpoints in the visaacceptancemergedspec API."""

    def __init__(self, config):
        """Initialize CustomerPaymentInstrumentApi object."""
        super(CustomerPaymentInstrumentApi, self).__init__(config)

    def post_customer_payment_instrument(self,
                                         customer_id,
                                         body,
                                         profile_id=None):
        """Perform a POST request to
        /tms/v2/customers/{customerId}/payment-instruments.

        |  |  |  |
        | --- | --- | --- |
        |**Customer Payment Instrument**<br>A Customer Payment Instrument represents
        tokenized customer payment information such as expiration date, billing
        address & card type.<br>A
        [Customer](#token-management_customer_create-a-customer) can have [one or
        more Payment
        Instruments](#token-management_customer-payment-instrument_retrieve-a-customer
        -payment-instrument), with one allocated as the Customers default for use in
        payments.<br>A Payment Instrument token does not store the card number. A
        Payment Instrument is associated with an [Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier) that represents either a payment card number, or in the case of an ACH
        bank account, the routing and account number.<br><br>**Creating a Customer
        Payment Instrument**<br>It is recommended you [create a Customer Payment
        Instrument via a Payment
        Authorization](#payments_payments_process-a-payment_samplerequests-dropdown_au
        thorization-with-token-create_authorization-create-default-payment-instrument-
        shipping-address-for-existing-customer_liveconsole-tab-request-body), this
        can be for a zero amount.<br>In Europe: You should perform Payer
        Authentication alongside the
        Authorization.|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Payment Network
        Tokens**<br>Network tokens perform better than regular card numbers and they
        are not necessarily invalidated when a cardholder loses their card, or it
        expires.<br>A Payment Network Token will be automatically created and used in
        future payments if you are enabled for the service.<br>A Payment Network
        Token can also be [provisioned for an existing Instrument
        Identifier](#token-management_instrument-identifier_enroll-an-instrument-ident
        ifier-for-payment-network-token).<br>For more information about Payment
        Network Tokens see the Developer Guide.<br><br>**Payments with Customers
        Payment Instrument**<br>To perform a payment with a particular Payment
        Instrument or Shipping Address specify the [Payment Instrument in the payment
        request](#payments_payments_process-a-payment_samplerequests-dropdown_authoriz
        ation-using-tokens_authorization-with-customer-payment-instrument-and-shipping
        -address-token-id_liveconsole-tab-request-body).

        Args:
            customer_id (str): The Id of a Customer.
            body (PostCustomerPaymentInstrumentRequest): The request body parameter.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. A new Payment
                Instrument has been created.

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/tms/v2/customers/{customerId}/payment-instruments")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("customerId")
                .value(customer_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json;charset=utf-8"))
            .body_param(Parameter()
                .value(body)
                .is_required(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(PostCustomerPaymentInstrumentResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                PostCustomerPaymentInstrumentException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                PostCustomerPaymentInstrumentException21Exception)
            .local_error("409",
                "Conflict. The token is linked to a Payment Instrument.",
                PostCustomerPaymentInstrumentException31Exception)
            .local_error("424",
                "Failed Dependency: e.g. The profile represented by the profile-id ma"
                "y not exist or the profile-id was entered incorrectly.",
                PostCustomerPaymentInstrumentException41Exception)
            .local_error("500",
                "Unexpected error.",
                PostCustomerPaymentInstrumentException51Exception),
        ).execute()

    def get_customer_payment_instruments_list(self,
                                              customer_id,
                                              profile_id=None,
                                              offset=0,
                                              limit=20):
        """Perform a GET request to
        /tms/v2/customers/{customerId}/payment-instruments.

        |  |  |  |
        | --- | --- | --- |
        |**Customer Payment Instrument**<br>A Customer Payment Instrument represents
        tokenized customer payment information such as expiration date, billing
        address & card type.<br>A
        [Customer](#token-management_customer_create-a-customer) can have [one or
        more Payment
        Instruments](#token-management_customer-payment-instrument_retrieve-a-customer
        -payment-instrument), with one allocated as the Customers default for use in
        payments.<br>A Payment Instrument token does not store the card number. A
        Payment Instrument is associated with an [Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier) that represents either a payment card number, or in the case of an ACH
        bank account, the routing and account
        number.<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Retrieving all Customer
        Payment Instruments**<br>Your system can use this API to retrieve all
        existing Payment Instruments for a Customer.

        Args:
            customer_id (str): The Id of a Customer.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            offset (int, optional): Starting record in zero-based dataset that should
                be returned as the first object in the array. Default is 0.
            limit (int, optional): The maximum number that can be returned in the
                array starting from the offset record in zero-based dataset. Default
                is 20, maximum is 100.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Returns all existing
                Payment Instruments associated with the supplied Id.

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/tms/v2/customers/{customerId}/payment-instruments")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("customerId")
                .value(customer_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .query_param(Parameter()
                .key("offset")
                .value(offset))
            .query_param(Parameter()
                .key("limit")
                .value(limit))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(PaymentInstrumentList.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                GetCustomerPaymentInstrumentsListException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                GetCustomerPaymentInstrumentsListException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                GetCustomerPaymentInstrumentsListException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                GetCustomerPaymentInstrumentsListException41Exception)
            .local_error("424",
                "Failed Dependency: e.g. The profile represented by the profile-id ma"
                "y not exist or the profile-id was entered incorrectly.",
                GetCustomerPaymentInstrumentsListException31Exception)
            .local_error("500",
                "Unexpected error.",
                GetCustomerPaymentInstrumentsListException61Exception),
        ).execute()

    def get_customer_payment_instrument(self,
                                        customer_id,
                                        payment_instrument_id,
                                        profile_id=None):
        """Perform a GET request to
        /tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}.

        |  |  |  |
        | --- | --- | --- |
        |**Customer Payment Instrument**<br>A Customer Payment Instrument represents
        tokenized customer payment information such as expiration date, billing
        address & card type.<br>A
        [Customer](#token-management_customer_create-a-customer) can have [one or
        more Payment
        Instruments](#token-management_customer-payment-instrument_retrieve-a-customer
        -payment-instrument), with one allocated as the Customers default for use in
        payments.<br>A Payment Instrument token does not store the card number. A
        Payment Instrument is associated with an [Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier) that represents either a payment card number, or in the case of an ACH
        bank account, the routing and account
        number.<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Retrieving a Customer
        Payment Instrument**<br>Your system can use this API to retrieve an existing
        Payment Instrument for a Customer.<br>To perform a payment with a particular
        Payment Instrument simply specify the [Payment Instrument Id in the payments
        request](#payments_payments_process-a-payment_samplerequests-dropdown_authoriz
        ation-using-tokens_authorization-with-customer-payment-instrument-and-shipping
        -address-token-id_liveconsole-tab-request-body).

        Args:
            customer_id (str): The Id of a Customer.
            payment_instrument_id (str): The Id of a payment instrument.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Returns an existing
                Payment Instrument associated with the supplied Id.

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("customerId")
                .value(customer_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("paymentInstrumentId")
                .value(payment_instrument_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetCustomerPaymentInstrumentResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                GetCustomerPaymentInstrumentException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                GetCustomerPaymentInstrumentException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                GetCustomerPaymentInstrumentException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                GetCustomerPaymentInstrumentException41Exception)
            .local_error("424",
                "Failed Dependency: e.g. The profile represented by the profile-id ma"
                "y not exist or the profile-id was entered incorrectly.",
                GetCustomerPaymentInstrumentException31Exception)
            .local_error("500",
                "Unexpected error.",
                GetCustomerPaymentInstrumentException61Exception),
        ).execute()

    def patch_customers_payment_instrument(self,
                                           customer_id,
                                           payment_instrument_id,
                                           body,
                                           profile_id=None,
                                           if_match=None):
        """Perform a PATCH request to
        /tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}.

        |  |  |  |
        | --- | --- | --- |
        |**Customer Payment Instrument**<br>A Customer Payment Instrument represents
        tokenized customer payment information such as expiration date, billing
        address & card type.<br>A
        [Customer](#token-management_customer_create-a-customer) can have [one or
        more Payment
        Instruments](#token-management_customer-payment-instrument_retrieve-a-customer
        -payment-instrument), with one allocated as the Customers default for use in
        payments.<br>A Payment Instrument token does not store the card number. A
        Payment Instrument is associated with an [Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier) that represents either a payment card number, or in the case of an ACH
        bank account, the routing and account
        number.<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Updating a Customers
        Payment Instrument**<br>Your system can use this API to update an existing
        Payment Instrument for a Customer, including selecting a [default Payment
        Instrument](#token-management_customer-payment-instrument_update-a-customer-pa
        yment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-
        default_liveconsole-tab-request-body) for use in payments.

        Args:
            customer_id (str): The Id of a Customer.
            payment_instrument_id (str): The Id of a payment instrument.
            body (PatchCustomerPaymentInstrumentRequest): The request body parameter.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            if_match (str, optional): Contains an ETag value from a GET request to
                make the request conditional.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Returns an existing
                Payment Instrument associated with the supplied Id.

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}")
            .http_method(HttpMethodEnum.PATCH)
            .template_param(Parameter()
                .key("customerId")
                .value(customer_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("paymentInstrumentId")
                .value(payment_instrument_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json;charset=utf-8"))
            .body_param(Parameter()
                .value(body)
                .is_required(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .header_param(Parameter()
                .key("if-match")
                .value(if_match))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(PatchCustomersPaymentInstrumentResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                PatchCustomersPaymentInstrumentException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                PatchCustomersPaymentInstrumentException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                PatchCustomersPaymentInstrumentException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                PatchCustomersPaymentInstrumentException41Exception)
            .local_error("412",
                "Precondition Failed: The If-Match request header value does not matc"
                "h the current resources ETag",
                PatchCustomersPaymentInstrumentException51Exception)
            .local_error("424",
                "Failed Dependency: e.g. The profile represented by the profile-id ma"
                "y not exist or the profile-id was entered incorrectly.",
                PatchCustomersPaymentInstrumentException31Exception)
            .local_error("500",
                "Unexpected error.",
                PatchCustomersPaymentInstrumentException71Exception),
        ).execute()

    def delete_customer_payment_instrument(self,
                                           customer_id,
                                           payment_instrument_id,
                                           profile_id=None):
        """Perform a DELETE request to
        /tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}.

        |  |  |  |
        | --- | --- | --- |
        |**Customer Payment Instrument**<br>A Customer Payment Instrument represents
        tokenized customer payment information such as expiration date, billing
        address & card type.<br>A
        [Customer](#token-management_customer_create-a-customer) can have [one or
        more Payment
        Instruments](#token-management_customer-payment-instrument_retrieve-a-customer
        -payment-instrument), with one allocated as the Customers default for use in
        payments.<br>A Payment Instrument token does not store the card number. A
        Payment Instrument is associated with an [Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier) that represents either a payment card number, or in the case of an ACH
        bank account, the routing and account
        number.<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Deleting a Customers
        Payment Instrument**<br>Your system can use this API to delete an existing
        Payment Instrument for a Customer.<br>Any Instrument Identifiers representing
        the card number will also be deleted if they are not associated with any
        other Payment Instruments.<br>If a customer has more than one Payment
        Instrument then the default Payment Instrument cannot be deleted without
        first selecting a [new default Payment
        Instrument](#token-management_customer-payment-instrument_update-a-customer-pa
        yment-instrument_samplerequests-dropdown_make-customer-payment-instrument-the-
        default_liveconsole-tab-request-body).

        Args:
            customer_id (str): The Id of a Customer.
            payment_instrument_id (str): The Id of a payment instrument.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. The request is
                fulfilled but does not need to return a body

        Raises:
            ApiException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("customerId")
                .value(customer_id)
                .is_required(True)
                .should_encode(True))
            .template_param(Parameter()
                .key("paymentInstrumentId")
                .value(payment_instrument_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                DeleteCustomerPaymentInstrumentException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                DeleteCustomerPaymentInstrumentException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                DeleteCustomerPaymentInstrumentException31Exception)
            .local_error("409",
                "Conflict. The token is linked to a Payment Instrument.",
                DeleteCustomerPaymentInstrumentException41Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                DeleteCustomerPaymentInstrumentException51Exception)
            .local_error("424",
                "Failed Dependency: e.g. The profile represented by the profile-id ma"
                "y not exist or the profile-id was entered incorrectly.",
                DeleteCustomerPaymentInstrumentException31Exception)
            .local_error("500",
                "Unexpected error.",
                DeleteCustomerPaymentInstrumentException71Exception),
        ).execute()
