"""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,
)


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

    Attributes:
        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.
        transaction_id (str): Processor transaction ID.  This value identifies the
            transaction on a host system. This value is supported only for Moneris.
            It contains this 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
        forwarded_acquirer_code (str): Name of the Japanese acquirer that processed
            the transaction. Returned only for JCN Gateway. Please contact the Visa
            Acceptance Japan Support Group for more information.
        merchant_number (str): Identifier that was assigned to you by your acquirer.
            This value must be printed on the receipt.  #### Returned by
            Authorizations and Credits.  This reply field is only supported by
            merchants who have installed client software on their POS terminals and
            use these processors: - American Express Direct - Credit Mutuel-CIC - FDC
            Nashville Global - OmniPay Direct - SIX
        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.
        ach_verification (AchVerification): The model property of type
            AchVerification.
        network_transaction_id (str): Same value as
            `processorInformation.transactionId`
        settlement_date (str): Field contains a settlement date. The date is in mmdd
            format, where: mm = month and dd = day.
        update_time_utc (str): The date and time when the transaction was last
            updated, in Internet date and time format.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "approval_code": "approvalCode",
        "transaction_id": "transactionId",
        "forwarded_acquirer_code": "forwardedAcquirerCode",
        "merchant_number": "merchantNumber",
        "response_code": "responseCode",
        "ach_verification": "achVerification",
        "network_transaction_id": "networkTransactionId",
        "settlement_date": "settlementDate",
        "update_time_utc": "updateTimeUtc",
    }

    _optionals = [
        "approval_code",
        "transaction_id",
        "forwarded_acquirer_code",
        "merchant_number",
        "response_code",
        "ach_verification",
        "network_transaction_id",
        "settlement_date",
        "update_time_utc",
    ]

    def __init__(
        self,
        approval_code=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        forwarded_acquirer_code=APIHelper.SKIP,
        merchant_number=APIHelper.SKIP,
        response_code=APIHelper.SKIP,
        ach_verification=APIHelper.SKIP,
        network_transaction_id=APIHelper.SKIP,
        settlement_date=APIHelper.SKIP,
        update_time_utc=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ProcessorInformation7 instance."""
        # Initialize members of the class
        if approval_code is not APIHelper.SKIP:
            self.approval_code = approval_code
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if forwarded_acquirer_code is not APIHelper.SKIP:
            self.forwarded_acquirer_code = forwarded_acquirer_code
        if merchant_number is not APIHelper.SKIP:
            self.merchant_number = merchant_number
        if response_code is not APIHelper.SKIP:
            self.response_code = response_code
        if ach_verification is not APIHelper.SKIP:
            self.ach_verification = ach_verification
        if network_transaction_id is not APIHelper.SKIP:
            self.network_transaction_id = network_transaction_id
        if settlement_date is not APIHelper.SKIP:
            self.settlement_date = settlement_date
        if update_time_utc is not APIHelper.SKIP:
            self.update_time_utc = update_time_utc

        # 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
        approval_code =\
            dictionary.get("approvalCode")\
            if dictionary.get("approvalCode")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else APIHelper.SKIP
        forwarded_acquirer_code =\
            dictionary.get("forwardedAcquirerCode")\
            if dictionary.get("forwardedAcquirerCode")\
                else APIHelper.SKIP
        merchant_number =\
            dictionary.get("merchantNumber")\
            if dictionary.get("merchantNumber")\
                else APIHelper.SKIP
        response_code =\
            dictionary.get("responseCode")\
            if dictionary.get("responseCode")\
                else APIHelper.SKIP
        ach_verification =\
            AchVerification.from_dictionary(
                dictionary.get("achVerification"))\
                if "achVerification" in dictionary.keys()\
                else APIHelper.SKIP
        network_transaction_id =\
            dictionary.get("networkTransactionId")\
            if dictionary.get("networkTransactionId")\
                else APIHelper.SKIP
        settlement_date =\
            dictionary.get("settlementDate")\
            if dictionary.get("settlementDate")\
                else APIHelper.SKIP
        update_time_utc =\
            dictionary.get("updateTimeUtc")\
            if dictionary.get("updateTimeUtc")\
                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(approval_code,
                   transaction_id,
                   forwarded_acquirer_code,
                   merchant_number,
                   response_code,
                   ach_verification,
                   network_transaction_id,
                   settlement_date,
                   update_time_utc,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _forwarded_acquirer_code=(
            self.forwarded_acquirer_code
            if hasattr(self, "forwarded_acquirer_code")
            else None
        )
        _merchant_number=(
            self.merchant_number
            if hasattr(self, "merchant_number")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _ach_verification=(
            self.ach_verification
            if hasattr(self, "ach_verification")
            else None
        )
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _settlement_date=(
            self.settlement_date
            if hasattr(self, "settlement_date")
            else None
        )
        _update_time_utc=(
            self.update_time_utc
            if hasattr(self, "update_time_utc")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"forwarded_acquirer_code={_forwarded_acquirer_code!r}, "
            f"merchant_number={_merchant_number!r}, "
            f"response_code={_response_code!r}, "
            f"ach_verification={_ach_verification!r}, "
            f"network_transaction_id={_network_transaction_id!r}, "
            f"settlement_date={_settlement_date!r}, "
            f"update_time_utc={_update_time_utc!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _approval_code=(
            self.approval_code
            if hasattr(self, "approval_code")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _forwarded_acquirer_code=(
            self.forwarded_acquirer_code
            if hasattr(self, "forwarded_acquirer_code")
            else None
        )
        _merchant_number=(
            self.merchant_number
            if hasattr(self, "merchant_number")
            else None
        )
        _response_code=(
            self.response_code
            if hasattr(self, "response_code")
            else None
        )
        _ach_verification=(
            self.ach_verification
            if hasattr(self, "ach_verification")
            else None
        )
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _settlement_date=(
            self.settlement_date
            if hasattr(self, "settlement_date")
            else None
        )
        _update_time_utc=(
            self.update_time_utc
            if hasattr(self, "update_time_utc")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"approval_code={_approval_code!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"forwarded_acquirer_code={_forwarded_acquirer_code!s}, "
            f"merchant_number={_merchant_number!s}, "
            f"response_code={_response_code!s}, "
            f"ach_verification={_ach_verification!s}, "
            f"network_transaction_id={_network_transaction_id!s}, "
            f"settlement_date={_settlement_date!s}, "
            f"update_time_utc={_update_time_utc!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
