"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.ach_verification import (
    AchVerification,
)
from visaacceptancemergedspec.models.avs import (
    Avs,
)
from visaacceptancemergedspec.models.card_verification_1 import (
    CardVerification1,
)
from visaacceptancemergedspec.models.electronic_verification_results_1 import (
    ElectronicVerificationResults1,
)
from visaacceptancemergedspec.models.multi_processor_routing import (
    MultiProcessorRouting,
)
from visaacceptancemergedspec.models.processor import (
    Processor,
)
from visaacceptancemergedspec.models.routing import (
    Routing,
)


class ProcessorInformation24(object):
    """Implementation of the 'ProcessorInformation24' model.

    Attributes:
        processor (Processor): The model property of type Processor.
        multi_processor_routing (List[MultiProcessorRouting]): An array of object
            that contains the list of acquirer response codes & reasons if a
            transaction is routed to multiple acquirers.
        transaction_id (str): Network transaction identifier (TID). You can use this
            value to identify a specific transaction when you are discussing the
            transaction with your processor. Not all processors provide this value.
            Returned by the authorization service.  #### PIN debit Transaction
            identifier generated by the processor.  Returned by PIN debit credit.
            #### GPX Processor transaction ID.  #### Cielo For Cielo, this value is
            the non-sequential unit (NSU) and is supported for all transactions. The
            value is generated by Cielo or the issuing bank.  #### Comercio Latino
            For Comercio Latino, this value is the proof of sale or non-sequential
            unit (NSU) number generated by the acquirers Cielo and Rede, or the
            issuing bank.  #### Visa Acceptance through VisaNet and GPN For details
            about this value for Visa Acceptance through VisaNet and GPN, see
            "processorInformation.networkTransactionId" in [REST API Fields](  ####
            Moneris This value identifies the transaction on a host system. It
            contains the following information: - Terminal used to process the
            transaction - Shift during which the transaction took place - Batch
            number - Transaction number within the batch You must store this value.
            If you give the customer a receipt, display this value on the receipt.
            **Example** For the value 66012345001069003: - Terminal ID = 66012345 -
            Shift number = 001 - Batch number = 069 - Transaction number = 003
        network_transaction_id (str): Same value as
            `processorInformation.transactionId`
        retrieval_reference_number (str): #### Ingenico ePayments Unique number that
            Visa Acceptance generates to identify the transaction. You can use this
            value to identify transactions in the Ingenico ePayments Collections
            Report, which provides settlement information. Contact customer support
            for information about the report.  ### Visa Acceptance through VisaNet
            Retrieval request number.
        response_id (str): Response ID sent from the processor.
        approval_code (str): Authorization code. Returned only when the processor
            returns this value.  The length of this value depends on your processor.
            Returned by authorization service.  #### PIN debit Authorization code
            that is returned by the processor.  Returned by PIN debit credit.  ####
            Elavon Encrypted Account Number Program The returned value is OFFLINE.
            #### TSYS Acquiring Solutions The returned value for a successful zero
            amount authorization is 000000.
        response_code (str): For most processors, this is the error message sent
            directly from the bank. Returned only when the processor returns this
            value.  **Important** Do not use this field to evaluate the result of the
            authorization.  #### PIN debit Response value that is returned by the
            processor or bank. **Important** Do not use this field to evaluate the
            results of the transaction request.  Returned by PIN debit credit, PIN
            debit purchase, and PIN debit reversal.  #### AIBMS If this value is
            `08`, you can accept the transaction if the customer provides you with
            identification.  #### Atos This value is the response code sent from Atos
            and it might also include the response code from the bank. Format:
            `aa,bb` with the two values separated by a comma and where: - `aa` is the
            two-digit error message from Atos. - `bb` is the optional two-digit error
            message from the bank.  #### Comercio Latino This value is the status
            code and the error or response code received from the processor separated
            by a colon. Format: [status code]:E[error code] or [status
            code]:R[response code] Example `2:R06`  #### JCN Gateway
            Processor-defined detail error code. The associated response category
            code is in the `processorInformation.responseCategoryCode` field. String
            (3)  #### paypalgateway Processor generated ID for the itemized detail.
        avs (Avs): The model property of type Avs.
        card_verification (CardVerification1): The model property of type
            CardVerification1.
        ach_verification (AchVerification): The model property of type
            AchVerification.
        electronic_verification_results (ElectronicVerificationResults1): The model
            property of type ElectronicVerificationResults1.
        event_status (str): The event status.
        system_trace_audit_number (str): This field is returned only for **American
            Express Direct** and **Visa Acceptance through VisaNet**. Returned by
            authorization and incremental authorization services.  #### American
            Express Direct  System trace audit number (STAN). This value identifies
            the transaction and is useful when investigating a chargeback dispute.
            #### Visa Acceptance through VisaNet  System trace number that must be
            printed on the customer’s receipt.
        response_code_source (str): Used by Visa only and contains the response
            source/reason code that identifies the source of the response decision.
        payment_account_reference_number (str): Payment Account Reference (PAR) is a
            non-financial reference assigned to each unique payment account and used
            to link a payment account to associated network tokens, i.e. the same PAR
            is returned for PAN-based and tokenized transactions, such as from
            digital wallets. PAR can be returned in authorisation responses for
            requests initiated with both real PANs and tokenized PANs. PAR can be
            used by merchants for fraud detection and regulatory compliance across
            different channels and digital wallets. PAR allows all participants in
            the payments chain to have a single, non-sensitive value assigned to a
            consumer. This value can be used in place of sensitive card holder
            identification fields, and transmitted across the payments ecosystem to
            facilitate card holder identification.  **Note** On Visa Acceptance
            through VisaNet, the value for this field corresponds to the following
            data in the TC 33 capture file: - Record: CP01 TCR8 - Position: 79-110 -
            Field: Payment Account Reference  The TC 33 Capture file contains
            information about the purchases and refunds that a merchant submits to
            Visa Acceptance. Visa Acceptance through VisaNet creates the TC 33
            Capture file at the end of the day and sends it to the merchant’s
            acquirer, who uses this information to facilitate end-of-day clearing
            processing with payment networks.
        routing (Routing): The model property of type Routing.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "processor": "processor",
        "multi_processor_routing": "multiProcessorRouting",
        "transaction_id": "transactionId",
        "network_transaction_id": "networkTransactionId",
        "retrieval_reference_number": "retrievalReferenceNumber",
        "response_id": "responseId",
        "approval_code": "approvalCode",
        "response_code": "responseCode",
        "avs": "avs",
        "card_verification": "cardVerification",
        "ach_verification": "achVerification",
        "electronic_verification_results": "electronicVerificationResults",
        "event_status": "eventStatus",
        "system_trace_audit_number": "systemTraceAuditNumber",
        "response_code_source": "responseCodeSource",
        "payment_account_reference_number": "paymentAccountReferenceNumber",
        "routing": "routing",
    }

    _optionals = [
        "processor",
        "multi_processor_routing",
        "transaction_id",
        "network_transaction_id",
        "retrieval_reference_number",
        "response_id",
        "approval_code",
        "response_code",
        "avs",
        "card_verification",
        "ach_verification",
        "electronic_verification_results",
        "event_status",
        "system_trace_audit_number",
        "response_code_source",
        "payment_account_reference_number",
        "routing",
    ]

    def __init__(
        self,
        processor=APIHelper.SKIP,
        multi_processor_routing=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        network_transaction_id=APIHelper.SKIP,
        retrieval_reference_number=APIHelper.SKIP,
        response_id=APIHelper.SKIP,
        approval_code=APIHelper.SKIP,
        response_code=APIHelper.SKIP,
        avs=APIHelper.SKIP,
        card_verification=APIHelper.SKIP,
        ach_verification=APIHelper.SKIP,
        electronic_verification_results=APIHelper.SKIP,
        event_status=APIHelper.SKIP,
        system_trace_audit_number=APIHelper.SKIP,
        response_code_source=APIHelper.SKIP,
        payment_account_reference_number=APIHelper.SKIP,
        routing=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ProcessorInformation24 instance."""
        # Initialize members of the class
        if processor is not APIHelper.SKIP:
            self.processor = processor
        if multi_processor_routing is not APIHelper.SKIP:
            self.multi_processor_routing = multi_processor_routing
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if network_transaction_id is not APIHelper.SKIP:
            self.network_transaction_id = network_transaction_id
        if retrieval_reference_number is not APIHelper.SKIP:
            self.retrieval_reference_number = retrieval_reference_number
        if response_id is not APIHelper.SKIP:
            self.response_id = response_id
        if approval_code is not APIHelper.SKIP:
            self.approval_code = approval_code
        if response_code is not APIHelper.SKIP:
            self.response_code = response_code
        if avs is not APIHelper.SKIP:
            self.avs = avs
        if card_verification is not APIHelper.SKIP:
            self.card_verification = card_verification
        if ach_verification is not APIHelper.SKIP:
            self.ach_verification = ach_verification
        if electronic_verification_results is not APIHelper.SKIP:
            self.electronic_verification_results = electronic_verification_results
        if event_status is not APIHelper.SKIP:
            self.event_status = event_status
        if system_trace_audit_number is not APIHelper.SKIP:
            self.system_trace_audit_number = system_trace_audit_number
        if response_code_source is not APIHelper.SKIP:
            self.response_code_source = response_code_source
        if payment_account_reference_number is not APIHelper.SKIP:
            self.payment_account_reference_number = payment_account_reference_number
        if routing is not APIHelper.SKIP:
            self.routing = routing

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        processor =\
            Processor.from_dictionary(
                dictionary.get("processor"))\
                if "processor" in dictionary.keys()\
                else APIHelper.SKIP
        multi_processor_routing = None
        if dictionary.get("multiProcessorRouting") is not None:
            multi_processor_routing = [
                MultiProcessorRouting.from_dictionary(x)
                    for x in dictionary.get("multiProcessorRouting")
            ]
        else:
            multi_processor_routing = APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else APIHelper.SKIP
        network_transaction_id =\
            dictionary.get("networkTransactionId")\
            if dictionary.get("networkTransactionId")\
                else APIHelper.SKIP
        retrieval_reference_number =\
            dictionary.get("retrievalReferenceNumber")\
            if dictionary.get("retrievalReferenceNumber")\
                else APIHelper.SKIP
        response_id =\
            dictionary.get("responseId")\
            if dictionary.get("responseId")\
                else APIHelper.SKIP
        approval_code =\
            dictionary.get("approvalCode")\
            if dictionary.get("approvalCode")\
                else APIHelper.SKIP
        response_code =\
            dictionary.get("responseCode")\
            if dictionary.get("responseCode")\
                else APIHelper.SKIP
        avs =\
            Avs.from_dictionary(
                dictionary.get("avs"))\
                if "avs" in dictionary.keys()\
                else APIHelper.SKIP
        card_verification =\
            CardVerification1.from_dictionary(
                dictionary.get("cardVerification"))\
                if "cardVerification" in dictionary.keys()\
                else APIHelper.SKIP
        ach_verification =\
            AchVerification.from_dictionary(
                dictionary.get("achVerification"))\
                if "achVerification" in dictionary.keys()\
                else APIHelper.SKIP
        electronic_verification_results =\
            ElectronicVerificationResults1.from_dictionary(
                dictionary.get("electronicVerificationResults"))\
                if "electronicVerificationResults" in dictionary.keys()\
                else APIHelper.SKIP
        event_status =\
            dictionary.get("eventStatus")\
            if dictionary.get("eventStatus")\
                else APIHelper.SKIP
        system_trace_audit_number =\
            dictionary.get("systemTraceAuditNumber")\
            if dictionary.get("systemTraceAuditNumber")\
                else APIHelper.SKIP
        response_code_source =\
            dictionary.get("responseCodeSource")\
            if dictionary.get("responseCodeSource")\
                else APIHelper.SKIP
        payment_account_reference_number =\
            dictionary.get("paymentAccountReferenceNumber")\
            if dictionary.get("paymentAccountReferenceNumber")\
                else APIHelper.SKIP
        routing =\
            Routing.from_dictionary(
                dictionary.get("routing"))\
                if "routing" in dictionary.keys()\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(processor,
                   multi_processor_routing,
                   transaction_id,
                   network_transaction_id,
                   retrieval_reference_number,
                   response_id,
                   approval_code,
                   response_code,
                   avs,
                   card_verification,
                   ach_verification,
                   electronic_verification_results,
                   event_status,
                   system_trace_audit_number,
                   response_code_source,
                   payment_account_reference_number,
                   routing,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _processor=(
            self.processor
            if hasattr(self, "processor")
            else None
        )
        _multi_processor_routing=(
            self.multi_processor_routing
            if hasattr(self, "multi_processor_routing")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _retrieval_reference_number=(
            self.retrieval_reference_number
            if hasattr(self, "retrieval_reference_number")
            else None
        )
        _response_id=(
            self.response_id
            if hasattr(self, "response_id")
            else None
        )
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _avs=(
            self.avs
            if hasattr(self, "avs")
            else None
        )
        _card_verification=(
            self.card_verification
            if hasattr(self, "card_verification")
            else None
        )
        _ach_verification=(
            self.ach_verification
            if hasattr(self, "ach_verification")
            else None
        )
        _electronic_verification_results=(
            self.electronic_verification_results
            if hasattr(self, "electronic_verification_results")
            else None
        )
        _event_status=(
            self.event_status
            if hasattr(self, "event_status")
            else None
        )
        _system_trace_audit_number=(
            self.system_trace_audit_number
            if hasattr(self, "system_trace_audit_number")
            else None
        )
        _response_code_source=(
            self.response_code_source
            if hasattr(self, "response_code_source")
            else None
        )
        _payment_account_reference_number=(
            self.payment_account_reference_number
            if hasattr(self, "payment_account_reference_number")
            else None
        )
        _routing=(
            self.routing
            if hasattr(self, "routing")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"processor={_processor!r}, "
            f"multi_processor_routing={_multi_processor_routing!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"network_transaction_id={_network_transaction_id!r}, "
            f"retrieval_reference_number={_retrieval_reference_number!r}, "
            f"response_id={_response_id!r}, "
            f"approval_code={_approval_code!r}, "
            f"response_code={_response_code!r}, "
            f"avs={_avs!r}, "
            f"card_verification={_card_verification!r}, "
            f"ach_verification={_ach_verification!r}, "
            f"electronic_verification_results={_electronic_verification_results!r}, "
            f"event_status={_event_status!r}, "
            f"system_trace_audit_number={_system_trace_audit_number!r}, "
            f"response_code_source={_response_code_source!r}, "
            f"payment_account_reference_number={_payment_account_reference_number!r}, "
            f"routing={_routing!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _processor=(
            self.processor
            if hasattr(self, "processor")
            else None
        )
        _multi_processor_routing=(
            self.multi_processor_routing
            if hasattr(self, "multi_processor_routing")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _retrieval_reference_number=(
            self.retrieval_reference_number
            if hasattr(self, "retrieval_reference_number")
            else None
        )
        _response_id=(
            self.response_id
            if hasattr(self, "response_id")
            else None
        )
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _avs=(
            self.avs
            if hasattr(self, "avs")
            else None
        )
        _card_verification=(
            self.card_verification
            if hasattr(self, "card_verification")
            else None
        )
        _ach_verification=(
            self.ach_verification
            if hasattr(self, "ach_verification")
            else None
        )
        _electronic_verification_results=(
            self.electronic_verification_results
            if hasattr(self, "electronic_verification_results")
            else None
        )
        _event_status=(
            self.event_status
            if hasattr(self, "event_status")
            else None
        )
        _system_trace_audit_number=(
            self.system_trace_audit_number
            if hasattr(self, "system_trace_audit_number")
            else None
        )
        _response_code_source=(
            self.response_code_source
            if hasattr(self, "response_code_source")
            else None
        )
        _payment_account_reference_number=(
            self.payment_account_reference_number
            if hasattr(self, "payment_account_reference_number")
            else None
        )
        _routing=(
            self.routing
            if hasattr(self, "routing")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"processor={_processor!s}, "
            f"multi_processor_routing={_multi_processor_routing!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"network_transaction_id={_network_transaction_id!s}, "
            f"retrieval_reference_number={_retrieval_reference_number!s}, "
            f"response_id={_response_id!s}, "
            f"approval_code={_approval_code!s}, "
            f"response_code={_response_code!s}, "
            f"avs={_avs!s}, "
            f"card_verification={_card_verification!s}, "
            f"ach_verification={_ach_verification!s}, "
            f"electronic_verification_results={_electronic_verification_results!s}, "
            f"event_status={_event_status!s}, "
            f"system_trace_audit_number={_system_trace_audit_number!s}, "
            f"response_code_source={_response_code_source!s}, "
            f"payment_account_reference_number={_payment_account_reference_number!s}, "
            f"routing={_routing!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
