"""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_instrument_identifier_exception_1_exception import (  # noqa: E501
    DeleteInstrumentIdentifierException1Exception,
)
from visaacceptancemergedspec.exceptions.delete_instrument_identifier_exception_21_exception import (  # noqa: E501
    DeleteInstrumentIdentifierException21Exception,
)
from visaacceptancemergedspec.exceptions.delete_instrument_identifier_exception_31_exception import (  # noqa: E501
    DeleteInstrumentIdentifierException31Exception,
)
from visaacceptancemergedspec.exceptions.delete_instrument_identifier_exception_41_exception import (  # noqa: E501
    DeleteInstrumentIdentifierException41Exception,
)
from visaacceptancemergedspec.exceptions.delete_instrument_identifier_exception_61_exception import (  # noqa: E501
    DeleteInstrumentIdentifierException61Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_exception_1_exception import (  # noqa: E501
    GetInstrumentIdentifierException1Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_exception_21_exception import (  # noqa: E501
    GetInstrumentIdentifierException21Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_exception_31_exception import (  # noqa: E501
    GetInstrumentIdentifierException31Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_exception_41_exception import (  # noqa: E501
    GetInstrumentIdentifierException41Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_exception_61_exception import (  # noqa: E501
    GetInstrumentIdentifierException61Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_payment_instruments_list_exception_1_exception import (  # noqa: E501
    GetInstrumentIdentifierPaymentInstrumentsListException1Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_payment_instruments_list_exception_21_exception import (  # noqa: E501
    GetInstrumentIdentifierPaymentInstrumentsListException21Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_payment_instruments_list_exception_31_exception import (  # noqa: E501
    GetInstrumentIdentifierPaymentInstrumentsListException31Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_payment_instruments_list_exception_41_exception import (  # noqa: E501
    GetInstrumentIdentifierPaymentInstrumentsListException41Exception,
)
from visaacceptancemergedspec.exceptions.get_instrument_identifier_payment_instruments_list_exception_61_exception import (  # noqa: E501
    GetInstrumentIdentifierPaymentInstrumentsListException61Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_1_exception import (  # noqa: E501
    PatchInstrumentIdentifierException1Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_21_exception import (  # noqa: E501
    PatchInstrumentIdentifierException21Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_31_exception import (  # noqa: E501
    PatchInstrumentIdentifierException31Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_41_exception import (  # noqa: E501
    PatchInstrumentIdentifierException41Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_51_exception import (  # noqa: E501
    PatchInstrumentIdentifierException51Exception,
)
from visaacceptancemergedspec.exceptions.patch_instrument_identifier_exception_71_exception import (  # noqa: E501
    PatchInstrumentIdentifierException71Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_enrollment_exception_1_exception import (  # noqa: E501
    PostInstrumentIdentifierEnrollmentException1Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_enrollment_exception_21_exception import (  # noqa: E501
    PostInstrumentIdentifierEnrollmentException21Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_enrollment_exception_31_exception import (  # noqa: E501
    PostInstrumentIdentifierEnrollmentException31Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_enrollment_exception_41_exception import (  # noqa: E501
    PostInstrumentIdentifierEnrollmentException41Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_enrollment_exception_61_exception import (  # noqa: E501
    PostInstrumentIdentifierEnrollmentException61Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_exception_1_exception import (  # noqa: E501
    PostInstrumentIdentifierException1Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_exception_21_exception import (  # noqa: E501
    PostInstrumentIdentifierException21Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_exception_31_exception import (  # noqa: E501
    PostInstrumentIdentifierException31Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_exception_41_exception import (  # noqa: E501
    PostInstrumentIdentifierException41Exception,
)
from visaacceptancemergedspec.exceptions.post_instrument_identifier_exception_51_exception import (  # noqa: E501
    PostInstrumentIdentifierException51Exception,
)
from visaacceptancemergedspec.http.http_method_enum import (
    HttpMethodEnum,
)
from visaacceptancemergedspec.models.get_instrument_identifier_response import (
    GetInstrumentIdentifierResponse,
)
from visaacceptancemergedspec.models.patch_instrument_identifier_response import (
    PatchInstrumentIdentifierResponse,
)
from visaacceptancemergedspec.models.payment_instrument_list import (
    PaymentInstrumentList,
)
from visaacceptancemergedspec.models.post_instrument_identifier_response import (
    PostInstrumentIdentifierResponse,
)


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

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

    def post_instrument_identifier(self,
                                   body,
                                   profile_id=None,
                                   retrieve_bin_details=None):
        """Perform a POST request to /tms/v1/instrumentidentifiers.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing and account
        number.<br>The same token Id is returned for a specific card number or bank
        account & routing number allowing the Instrument Identifier Id to be used for
        cross-channel payment tracking.<br>An Instrument Identifier can exist
        independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        <br><br>**Creating an Instrument Identifier**<br>It is recommended you
        [create an Instrument Identifier via a Payment
        Authorization](#payments_payments_process-a-payment_samplerequests-dropdown_au
        thorization-with-token-create_authorization-with-instrument-identifier-token-c
        reation_liveconsole-tab-request-body), this can be for a zero amount.<br>An
        Instrument Identifier will also be created if you [create a Customer via a
        Payment
        Authorization](#payments_payments_process-a-payment_samplerequests-dropdown_au
        thorization-with-token-create_authorization-with-customer-token-creation_livec
        onsole-tab-request-body)<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 Instrument
        Identifiers**<br>To perform a payment with an Instrument Identifier simply
        specify the [Instrument Identifier Id in the payments request along with the
        expiration date, card type, & billing
        address](#payments_payments_process-a-payment_samplerequests-dropdown_authoriz
        ation-using-tokens_authorization-with-instrument-identifier-token-id_liveconso
        le-tab-request-body).<br>When an Instrument Identifier is used in a payment
        the **_previousTransactionId_** and **_originalAuthorizedAmount_** values are
        automatically recorded.<br>These values will be added for you to future
        Merchant Initiated Transaction payments.

        Args:
            body (PostInstrumentIdentifierRequest): Specify either a Card, Bank
                Account or Enrollable Card
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            retrieve_bin_details (bool, optional): Retrieve the Bin Details of PAN or
                network token

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Returns an existing
                Instrument Identifier 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/v1/instrumentidentifiers")
            .http_method(HttpMethodEnum.POST)
            .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))
            .query_param(Parameter()
                .key("retrieveBinDetails")
                .value(retrieve_bin_details))
            .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(PostInstrumentIdentifierResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                PostInstrumentIdentifierException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                PostInstrumentIdentifierException21Exception)
            .local_error("409",
                "Conflict. The token is linked to a Payment Instrument.",
                PostInstrumentIdentifierException31Exception)
            .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.",
                PostInstrumentIdentifierException41Exception)
            .local_error("500",
                "Unexpected error.",
                PostInstrumentIdentifierException51Exception),
        ).execute()

    def get_instrument_identifier(self,
                                  instrument_identifier_id,
                                  profile_id=None,
                                  retrieve_bin_details=None):
        """Perform a GET request to
        /tms/v1/instrumentidentifiers/{instrumentIdentifierId}.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing and account
        number.<br>The same token Id is returned for a specific card number or bank
        account & routing number allowing the Instrument Identifier Id to be used for
        cross-channel payment tracking.<br>An Instrument Identifier can exist
        independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        <br><br>**Retrieving an Instrument Identifier**<br>Your system can use this
        API to retrieve an Instrument Identifier.<br>**Note: the actual card data
        will be masked.**<br>The Instrument Identifier will also be returned when
        retrieving a [Customer](#token-management_customer_retrieve-a-customer),
        [Customer Payment
        Instrument](#token-management_customer-payment-instrument_retrieve-a-customer-
        payment-instrument) or [Standalone Payment
        Instrument](#token-management_payment-instrument_retrieve-a-payment-instrument
        ).|&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 Instrument
        Identifiers**<br>To perform a payment with an Instrument Identifier simply
        specify the [Instrument Identifier Id in the payments request along with the
        expiration date, card type, & billing
        address](#payments_payments_process-a-payment_samplerequests-dropdown_authoriz
        ation-using-tokens_authorization-with-instrument-identifier-token-id_liveconso
        le-tab-request-body).<br>When an Instrument Identifier is used in a payment
        the **_previousTransactionId_** and **_originalAuthorizedAmount_** values are
        automatically recorded.<br>These values will be added for you to future
        Merchant Initiated Transaction payments.

        Args:
            instrument_identifier_id (str): The Id of an Instrument Identifier.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            retrieve_bin_details (bool, optional): Retrieve the Bin Details of PAN or
                network token

        Returns:
            ApiResponse: An object with the response value as well as other useful
                information such as status codes and headers. Returns an existing
                Instrument Identifier 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/v1/instrumentidentifiers/{instrumentIdentifierId}")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("instrumentIdentifierId")
                .value(instrument_identifier_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .query_param(Parameter()
                .key("retrieveBinDetails")
                .value(retrieve_bin_details))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(And(Single("BearerAuth"), Single("Accept"))),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetInstrumentIdentifierResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                GetInstrumentIdentifierException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                GetInstrumentIdentifierException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                GetInstrumentIdentifierException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                GetInstrumentIdentifierException41Exception)
            .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.",
                GetInstrumentIdentifierException31Exception)
            .local_error("500",
                "Unexpected error.",
                GetInstrumentIdentifierException61Exception),
        ).execute()

    def patch_instrument_identifier(self,
                                    instrument_identifier_id,
                                    body,
                                    profile_id=None,
                                    retrieve_bin_details=None,
                                    if_match=None):
        """Perform a PATCH request to
        /tms/v1/instrumentidentifiers/{instrumentIdentifierId}.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing and account
        number.<br>The same token Id is returned for a specific card number or bank
        account & routing number allowing the Instrument Identifier Id to be used for
        cross-channel payment tracking.<br>An Instrument Identifier can exist
        independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Updating an Instrument
        Identifier**<br>When an Instrument Identifier is used in a payment the
        **_previousTransactionId_** and **_originalAuthorizedAmount_** values are
        automatically recorded.<br>These values will be added for you to future
        Merchant Initiated Transaction payments.<br>Your system can use this API to
        update these values.

        Args:
            instrument_identifier_id (str): The Id of an Instrument Identifier.
            body (PatchInstrumentIdentifierRequest): Specify the previous transaction
                Id to update.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            retrieve_bin_details (bool, optional): Retrieve the Bin Details of PAN or
                network token
            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
                Instrument Identifier 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/v1/instrumentidentifiers/{instrumentIdentifierId}")
            .http_method(HttpMethodEnum.PATCH)
            .template_param(Parameter()
                .key("instrumentIdentifierId")
                .value(instrument_identifier_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))
            .query_param(Parameter()
                .key("retrieveBinDetails")
                .value(retrieve_bin_details))
            .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(PatchInstrumentIdentifierResponse.from_dictionary)
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                PatchInstrumentIdentifierException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                PatchInstrumentIdentifierException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                PatchInstrumentIdentifierException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                PatchInstrumentIdentifierException41Exception)
            .local_error("412",
                "Precondition Failed: The If-Match request header value does not matc"
                "h the current resources ETag",
                PatchInstrumentIdentifierException51Exception)
            .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.",
                PatchInstrumentIdentifierException31Exception)
            .local_error("500",
                "Unexpected error.",
                PatchInstrumentIdentifierException71Exception),
        ).execute()

    def delete_instrument_identifier(self,
                                     instrument_identifier_id,
                                     profile_id=None):
        """Perform a DELETE request to
        /tms/v1/instrumentidentifiers/{instrumentIdentifierId}.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing <br>and
        account numbers.<br>The same token Id is returned for a specific card number
        or bank account & routing number allowing the <br>Instrument Identifier Id to
        be used for cross-channel payment tracking.<br>An Instrument Identifier can
        exist independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) <br>or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Deleting an Instrument
        Identifier**<br>Your system can use this API to delete an existing Instrument
        Identifier.<br>An Instrument Identifier cannot be deleted if it is linked to
        any Payment Instruments.<br>You can [retrieve all Payment Instruments
        associated with an Instrument
        Identifier](#token-management_instrument-identifier_list-payment-instruments-f
        or-an-instrument-identifier).

        Args:
            instrument_identifier_id (str): The Id of an Instrument Identifier.
            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/v1/instrumentidentifiers/{instrumentIdentifierId}")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("instrumentIdentifierId")
                .value(instrument_identifier_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("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                DeleteInstrumentIdentifierException1Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                DeleteInstrumentIdentifierException21Exception)
            .local_error("409",
                "Conflict. The token is linked to a Payment Instrument.",
                DeleteInstrumentIdentifierException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                DeleteInstrumentIdentifierException41Exception)
            .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.",
                DeleteInstrumentIdentifierException21Exception)
            .local_error("500",
                "Unexpected error.",
                DeleteInstrumentIdentifierException61Exception),
        ).execute()

    def get_instrument_identifier_payment_instruments_list(self,
                                                           instrument_identifier_id,
                                                           profile_id=None,
                                                           retrieve_bin_details=None,
                                                           offset=0,
                                                           limit=20):
        """Perform a GET request to
        /tms/v1/instrumentidentifiers/{instrumentIdentifierId}/paymentinstruments.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing <br>and
        account numbers.<br>The same token Id is returned for a specific card number
        or bank account & routing number allowing the <br>Instrument Identifier Id to
        be used for cross-channel payment tracking.<br>An Instrument Identifier can
        exist independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) <br>or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Retrieving all Payment Instruments
        associated with an Instrument Identifier**<br>Your system can use this API to
        retrieve all Payment Instruments linked to an Instrument Identifier.

        Args:
            instrument_identifier_id (str): The Id of an Instrument Identifier.
            profile_id (str, optional): The Id of a profile containing user specific
                TMS configuration.
            retrieve_bin_details (bool, optional): Retrieve the Bin Details of PAN or
                network token
            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/v1/instrumentidentifiers/{instrumentIdentifierId}/paymentinstruments")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("instrumentIdentifierId")
                .value(instrument_identifier_id)
                .is_required(True)
                .should_encode(True))
            .header_param(Parameter()
                .key("profile-id")
                .value(profile_id))
            .query_param(Parameter()
                .key("retrieveBinDetails")
                .value(retrieve_bin_details))
            .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.",
                GetInstrumentIdentifierPaymentInstrumentsListException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                GetInstrumentIdentifierPaymentInstrumentsListException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                GetInstrumentIdentifierPaymentInstrumentsListException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                GetInstrumentIdentifierPaymentInstrumentsListException41Exception)
            .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.",
                GetInstrumentIdentifierPaymentInstrumentsListException31Exception)
            .local_error("500",
                "Unexpected error.",
                GetInstrumentIdentifierPaymentInstrumentsListException61Exception),
        ).execute()

    def post_instrument_identifier_enrollment(self,
                                              instrument_identifier_id,
                                              body,
                                              profile_id=None):
        """Perform a POST request to
        /tms/v1/instrumentidentifiers/{instrumentIdentifierId}/enrollment.

        |  |  |  |
        | --- | --- | --- |
        |**Instrument Identifiers**<br>An Instrument Identifier represents either a
        card number, or in the case of an ACH bank account, the routing and account
        number.<br>The same token Id is returned for a specific card number or bank
        account & routing number allowing the Instrument Identifier Id to be used for
        cross-channel payment tracking.<br>An Instrument Identifier can exist
        independently but also be associated with a [Customer Payment
        Instrument](#token-management_customer-payment-instrument_create-a-customer-pa
        yment-instrument) or [Standalone Payment
        Instrument](#token-management_payment-instrument_create-a-payment-instrument).
        |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**Enroll an Instrument Identifier for a
        Payment Network Token**<br>Your system can use this API to provision a
        Network token for an existing Instrument Identifier.<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 Network
        token can be [provisioned when creating an Instrument
        Identifier](#token-management_instrument-identifier_create-an-instrument-ident
        ifier_samplerequests-dropdown_create-instrument-identifier-card-enroll-for-net
        work-token_liveconsole-tab-request-body).This will occur automatically when
        creating a
        [Customer](#payments_payments_process-a-payment_samplerequests-dropdown_author
        ization-with-token-create_authorization-with-customer-token-creation_liveconso
        le-tab-request-body), [Payment
        Instrument](#payments_payments_process-a-payment_samplerequests-dropdown_autho
        rization-with-token-create_authorization-create-default-payment-instrument-shi
        pping-address-for-existing-customer_liveconsole-tab-request-body) or
        [Instrument
        Identifier](#payments_payments_process-a-payment_samplerequests-dropdown_autho
        rization-with-token-create_authorization-with-instrument-identifier-token-crea
        tion_liveconsole-tab-request-body) via the Payments API.<br>For more
        information about Payment Network Tokens see the Developer Guide.

        Args:
            instrument_identifier_id (str): The Id of an Instrument Identifier.
            body (PostInstrumentIdentifierEnrollmentRequest): Specify Enrollable Card
                details
            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 has been
                accepted for processing, but the processing has not been completed.

        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/v1/instrumentidentifiers/{instrumentIdentifierId}/enrollment")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("instrumentIdentifierId")
                .value(instrument_identifier_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()
            .is_api_response(True)
            .local_error("400",
                "Bad Request: e.g. A required header value could be missing.",
                PostInstrumentIdentifierEnrollmentException1Exception)
            .local_error("403",
                "Forbidden: e.g. The profile might not have permission to perform the"
                " operation.",
                PostInstrumentIdentifierEnrollmentException21Exception)
            .local_error("404",
                "Token Not Found. The Id may not exist or was entered incorrectly.",
                PostInstrumentIdentifierEnrollmentException31Exception)
            .local_error("410",
                "Token Not Available. The token has been deleted.",
                PostInstrumentIdentifierEnrollmentException41Exception)
            .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.",
                PostInstrumentIdentifierEnrollmentException31Exception)
            .local_error("500",
                "Unexpected error.",
                PostInstrumentIdentifierEnrollmentException61Exception),
        ).execute()
