"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.failover import Failover
from cellpointapi.models.fraud_assessment import (
    FraudAssessment,
)
from cellpointapi.models.payment_processor import (
    PaymentProcessor,
)
from cellpointapi.models.payment_status import (
    PaymentStatus,
)
from cellpointapi.models.payment_transaction_authorized_amount import (
    PaymentTransactionAuthorizedAmount,
)
from cellpointapi.models.payment_transaction_canceled_amount import (
    PaymentTransactionCanceledAmount,
)
from cellpointapi.models.payment_transaction_captured_amount import (
    PaymentTransactionCapturedAmount,
)
from cellpointapi.models.payment_transaction_pending_authorize_amount import (
    PaymentTransactionPendingAuthorizeAmount,
)
from cellpointapi.models.payment_transaction_pending_cancel_amount import (
    PaymentTransactionPendingCancelAmount,
)
from cellpointapi.models.payment_transaction_pending_capture_amount import (
    PaymentTransactionPendingCaptureAmount,
)
from cellpointapi.models.payment_transaction_processing_fee import (
    PaymentTransactionProcessingFee,
)
from cellpointapi.models.payment_transaction_refunded_amount import (
    PaymentTransactionRefundedAmount,
)
from cellpointapi.models.related_refund import (
    RelatedRefund,
)
from cellpointapi.models.transaction_failure import (
    TransactionFailure,
)
from cellpointapi.models.type_2 import Type2


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

    A Payment Transaction is a transaction that is processed by a payment processor.

    Attributes:
        id (str): Unique identifier for this transaction.
        order_id (str): Identifier for an order.
        mtype (Type2): Discriminator used to identify the type of transaction.
        failure (TransactionFailure): Details about a failure that happened on a
            transaction.
        created_at (datetime): When the transaction was created.
        payment_processor (PaymentProcessor): Acquirer or Payment Service Provider
            (PSP) that processed the payment.
        status (PaymentStatus): States that a transaction can be in.  <table>
            <thead>     <tr>       <th>Status</th>       <th>Description</th>
            </tr>   </thead>   <tbody>     <tr>       <td>AUTHORIZED</td>       <td>A
            transaction has been fully authorized and the funds are being held.</td>
            </tr>     <tr>       <td>AUTHORIZE_FAILED</td>       <td>Authorization
            has failed. No funds are being held.</td>     </tr>     <tr>
            <td>AUTHORIZE_INITIATED</td>       <td>A payment authorization has been
            initiated with CellPoint Digital.</td>     </tr>     <tr>
            <td>CANCELED</td>       <td>Authorization has been canceled and no funds
            are being held anymore.</td>     </tr>     <tr>
            <td>CANCELLATION_FAILED</td>       <td>Cancellation has failed. Funds are
            still held as part of the authorization.</td>     </tr>     <tr>
            <td>CANCELLATION_INITIATED</td>       <td>Cancellation of funds have been
            initiated and is pending completion.</td>     </tr>     <tr>
            <td>CAPTURED</td>       <td>         Authorized transaction that has been
            fully captured.         Depending on how settlement is done by payment
            processor, funds have been moved from buyer's account to merchant's
            account.       </td>     </tr>     <tr>       <td>CAPTURE_FAILED</td>
            <td>Capture has failed. Funds are still held as part of the
            authorization, but have not moved.</td>     </tr>     <tr>
            <td>CAPTURE_INITIATED</td>       <td>Capture has been initiated, but is
            pending completion.</td>     </tr>     <tr>
            <td>CAPTURE_PENDING</td>       <td>Authorization has already happened,
            and the transaction has now been marked as pending for capture. Capture
            will take place automatically as per configured schedule.</td>     </tr>
            <tr>       <td>CAPTURE_BATCHED</td>       <td>Authorization has already
            happened, and the transaction has been sent for capturing in a batch.
            Capture will finally take place automatically as per configured
            schedule.</td>     </tr>     <tr>       <td>PARTIALLY_CANCELED</td>
            <td>Authorized transaction is partially canceled<td>     </tr>     <tr>
            <td>PARTIALLY_CAPTURED</td>       <td>Authorized transaction is partially
            captured<td>     </tr>     <tr>       <td>PENDING_ACTION_COMPLETION</td>
            <td>The transaction is in a state where an action has been initiated, but
            is pending completion.</td>     </tr>     <tr>       <td>CLOSED</td>
            <td>The transaction that has previously failed has been closed to avoid
            its stagnation in review pools.</td>     </tr>   </tbody> </table>
        authorized_at (datetime): When the transaction was authorized.
        captured_at (datetime): When the transaction's funds were captured. If
            multiple captures have happened, this is the latest capture.
        canceled_at (datetime): When the transaction's authorization was canceled.
        refunds (List[RelatedRefund]): List of refund transaction(s) that have
            happened for this payment.
        has_failed_over (bool): If the transaction had to failover to a different
            payment processor. List of failover failures can be found in `failovers`
            property.
        failovers (List[Failover]): The model property of type List[Failover].
        pending_authorize_amount (PaymentTransactionPendingAuthorizeAmount): If
            `status` is `AUTHORIZE_INITIATED` this is the amount that will be
            attempted to be authorized.
        authorized_amount (PaymentTransactionAuthorizedAmount): Amount that was
            authorized on the transaction.
        pending_capture_amount (PaymentTransactionPendingCaptureAmount): If `status`
            is `CAPTURE_PENDING`, this will be the amount that will be captured.
        captured_amount (PaymentTransactionCapturedAmount): Amount captured from an
            authorised transaction.
        refunded_amount (PaymentTransactionRefundedAmount): Amount refunded from a
            captured transaction.
        pending_cancel_amount (PaymentTransactionPendingCancelAmount): During the
            cancellation process this will be the amount that will be canceled.
        canceled_amount (PaymentTransactionCanceledAmount): Amount canceled from an
            authorized transaction.
        processing_fee (PaymentTransactionProcessingFee): If there is a fee for using
            the payment method (i.e. $5 fee for using ACH), that should be included
            here.
        payment_instrument (CardPaymentInstrument | ApplePayPaymentInstrument |
            PayPalPaymentInstrument | VoucherPaymentInstrument |
            WalletPaymentInstrument | UpliftPaymentInstrument): The payment
            instrument that is being used in the transaction.
        authorization_group_id (str): Authorization group ID that this transaction
            belongs to.
        address_verification_status (AddressVerificationStatus): Address Verification
            Status (AVS)  <table> <thead>   <tr>     <th>AVS Status</th>
            <th>Description</th>   </tr> </thead> <tbody>   <tr>     <td>MATCH</td>
            <td>Both address or postal code match</td>   </tr>   <tr>
            <td>PARTIAL_MATCH_POSTAL_CODE_ONLY</td>     <td>postal code matches but
            address does not</td>   </tr>   <tr>
            <td>PARTIAL_MATCH_ADDRESS_ONLY</td>     <td>address matches but postal
            code does not</td>   </tr>   <tr>     <td>FAILURE</td>     <td>neither
            address or postal code match</td>   </tr>   <tr>     <td>UNAVAILABLE</td>
            <td>AVS is unavailable for card/country</td>   </tr> </tbody> </table>
        security_code_status (SecurityCodeMatchStatus): Security Code Status  <table>
            <thead>   <tr>     <th>Security Code Status</th>     <th>Description</th>
            </tr> </thead> <tbody>   <tr>     <td>MATCH</td>     <td>Provided
            Security Code matches expected value.</td>   </tr>   <tr>
            <td>NOT_PROVIDED</td>     <td>Security Code not provided.</td>   </tr>
            <tr>     <td>FAILURE</td>     <td>Security Code does not match expected
            value.</td>   </tr>   <tr>     <td>UNAVAILABLE</td>     <td>Security Code
            check not available.</td>   </tr> </tbody> </table>
        fraud_assessments (List[FraudAssessment]): List of assessments on if the
            transaction is considered acceptable or not.
        action (PayPalAction | RedirectAction | None): The action to be taken on the
            transaction.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "id",
        "mtype": "type",
        "status": "status",
        "payment_instrument": "paymentInstrument",
        "order_id": "orderId",
        "failure": "failure",
        "created_at": "createdAt",
        "payment_processor": "paymentProcessor",
        "authorized_at": "authorizedAt",
        "captured_at": "capturedAt",
        "canceled_at": "canceledAt",
        "refunds": "refunds",
        "has_failed_over": "hasFailedOver",
        "failovers": "failovers",
        "pending_authorize_amount": "pendingAuthorizeAmount",
        "authorized_amount": "authorizedAmount",
        "pending_capture_amount": "pendingCaptureAmount",
        "captured_amount": "capturedAmount",
        "refunded_amount": "refundedAmount",
        "pending_cancel_amount": "pendingCancelAmount",
        "canceled_amount": "canceledAmount",
        "processing_fee": "processingFee",
        "authorization_group_id": "authorizationGroupId",
        "address_verification_status": "addressVerificationStatus",
        "security_code_status": "securityCodeStatus",
        "fraud_assessments": "fraudAssessments",
        "action": "action",
    }

    _optionals = [
        "order_id",
        "failure",
        "created_at",
        "payment_processor",
        "authorized_at",
        "captured_at",
        "canceled_at",
        "refunds",
        "has_failed_over",
        "failovers",
        "pending_authorize_amount",
        "authorized_amount",
        "pending_capture_amount",
        "captured_amount",
        "refunded_amount",
        "pending_cancel_amount",
        "canceled_amount",
        "processing_fee",
        "authorization_group_id",
        "address_verification_status",
        "security_code_status",
        "fraud_assessments",
        "action",
    ]

    def __init__(
        self,
        id=None,
        mtype=None,
        status=None,
        payment_instrument=None,
        order_id=APIHelper.SKIP,
        failure=APIHelper.SKIP,
        created_at=APIHelper.SKIP,
        payment_processor=APIHelper.SKIP,
        authorized_at=APIHelper.SKIP,
        captured_at=APIHelper.SKIP,
        canceled_at=APIHelper.SKIP,
        refunds=APIHelper.SKIP,
        has_failed_over=APIHelper.SKIP,
        failovers=APIHelper.SKIP,
        pending_authorize_amount=APIHelper.SKIP,
        authorized_amount=APIHelper.SKIP,
        pending_capture_amount=APIHelper.SKIP,
        captured_amount=APIHelper.SKIP,
        refunded_amount=APIHelper.SKIP,
        pending_cancel_amount=APIHelper.SKIP,
        canceled_amount=APIHelper.SKIP,
        processing_fee=APIHelper.SKIP,
        authorization_group_id=APIHelper.SKIP,
        address_verification_status=APIHelper.SKIP,
        security_code_status=APIHelper.SKIP,
        fraud_assessments=APIHelper.SKIP,
        action=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentTransaction instance."""
        # Initialize members of the class
        self.id = id
        if order_id is not APIHelper.SKIP:
            self.order_id = order_id
        self.mtype = mtype
        if failure is not APIHelper.SKIP:
            self.failure = failure
        if created_at is not APIHelper.SKIP:
            self.created_at =\
                 APIHelper.apply_datetime_converter(
                created_at, APIHelper.RFC3339DateTime)\
                 if created_at else None
        if payment_processor is not APIHelper.SKIP:
            self.payment_processor = payment_processor
        self.status = status
        if authorized_at is not APIHelper.SKIP:
            self.authorized_at =\
                 APIHelper.apply_datetime_converter(
                authorized_at, APIHelper.RFC3339DateTime)\
                 if authorized_at else None
        if captured_at is not APIHelper.SKIP:
            self.captured_at =\
                 APIHelper.apply_datetime_converter(
                captured_at, APIHelper.RFC3339DateTime)\
                 if captured_at else None
        if canceled_at is not APIHelper.SKIP:
            self.canceled_at =\
                 APIHelper.apply_datetime_converter(
                canceled_at, APIHelper.RFC3339DateTime)\
                 if canceled_at else None
        if refunds is not APIHelper.SKIP:
            self.refunds = refunds
        if has_failed_over is not APIHelper.SKIP:
            self.has_failed_over = has_failed_over
        if failovers is not APIHelper.SKIP:
            self.failovers = failovers
        if pending_authorize_amount is not APIHelper.SKIP:
            self.pending_authorize_amount = pending_authorize_amount
        if authorized_amount is not APIHelper.SKIP:
            self.authorized_amount = authorized_amount
        if pending_capture_amount is not APIHelper.SKIP:
            self.pending_capture_amount = pending_capture_amount
        if captured_amount is not APIHelper.SKIP:
            self.captured_amount = captured_amount
        if refunded_amount is not APIHelper.SKIP:
            self.refunded_amount = refunded_amount
        if pending_cancel_amount is not APIHelper.SKIP:
            self.pending_cancel_amount = pending_cancel_amount
        if canceled_amount is not APIHelper.SKIP:
            self.canceled_amount = canceled_amount
        if processing_fee is not APIHelper.SKIP:
            self.processing_fee = processing_fee
        self.payment_instrument = payment_instrument
        if authorization_group_id is not APIHelper.SKIP:
            self.authorization_group_id = authorization_group_id
        if address_verification_status is not APIHelper.SKIP:
            self.address_verification_status = address_verification_status
        if security_code_status is not APIHelper.SKIP:
            self.security_code_status = security_code_status
        if fraud_assessments is not APIHelper.SKIP:
            self.fraud_assessments = fraud_assessments
        if action is not APIHelper.SKIP:
            self.action = action

        # 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.

        """
        from cellpointapi.utilities.union_type_lookup import (
            UnionTypeLookUp,
        )

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

        # Extract variables from the dictionary
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else None
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else None
        status =\
            dictionary.get("status")\
            if dictionary.get("status")\
                else None
        payment_instrument = APIHelper.deserialize_union_type(
            UnionTypeLookUp.get("PaymentInstrument"),
            dictionary.get("paymentInstrument"),
            False)\
            if dictionary.get("paymentInstrument") is not None\
            else None
        order_id =\
            dictionary.get("orderId")\
            if dictionary.get("orderId")\
                else APIHelper.SKIP
        failure =\
            TransactionFailure.from_dictionary(
                dictionary.get("failure"))\
                if "failure" in dictionary.keys()\
                else APIHelper.SKIP
        created_at = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("createdAt")).datetime\
            if dictionary.get("createdAt") else APIHelper.SKIP
        payment_processor =\
            PaymentProcessor.from_dictionary(
                dictionary.get("paymentProcessor"))\
                if "paymentProcessor" in dictionary.keys()\
                else APIHelper.SKIP
        authorized_at = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("authorizedAt")).datetime\
            if dictionary.get("authorizedAt") else APIHelper.SKIP
        captured_at = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("capturedAt")).datetime\
            if dictionary.get("capturedAt") else APIHelper.SKIP
        canceled_at = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("canceledAt")).datetime\
            if dictionary.get("canceledAt") else APIHelper.SKIP
        refunds = None
        if dictionary.get("refunds") is not None:
            refunds = [
                RelatedRefund.from_dictionary(x)
                    for x in dictionary.get("refunds")
            ]
        else:
            refunds = APIHelper.SKIP
        has_failed_over =\
            dictionary.get("hasFailedOver")\
            if "hasFailedOver" in dictionary.keys()\
                else APIHelper.SKIP
        failovers = None
        if dictionary.get("failovers") is not None:
            failovers = [
                Failover.from_dictionary(x)
                    for x in dictionary.get("failovers")
            ]
        else:
            failovers = APIHelper.SKIP
        pending_authorize_amount =\
            PaymentTransactionPendingAuthorizeAmount.from_dictionary(
                dictionary.get("pendingAuthorizeAmount"))\
                if "pendingAuthorizeAmount" in dictionary.keys()\
                else APIHelper.SKIP
        authorized_amount =\
            PaymentTransactionAuthorizedAmount.from_dictionary(
                dictionary.get("authorizedAmount"))\
                if "authorizedAmount" in dictionary.keys()\
                else APIHelper.SKIP
        pending_capture_amount =\
            PaymentTransactionPendingCaptureAmount.from_dictionary(
                dictionary.get("pendingCaptureAmount"))\
                if "pendingCaptureAmount" in dictionary.keys()\
                else APIHelper.SKIP
        captured_amount =\
            PaymentTransactionCapturedAmount.from_dictionary(
                dictionary.get("capturedAmount"))\
                if "capturedAmount" in dictionary.keys()\
                else APIHelper.SKIP
        refunded_amount =\
            PaymentTransactionRefundedAmount.from_dictionary(
                dictionary.get("refundedAmount"))\
                if "refundedAmount" in dictionary.keys()\
                else APIHelper.SKIP
        pending_cancel_amount =\
            PaymentTransactionPendingCancelAmount.from_dictionary(
                dictionary.get("pendingCancelAmount"))\
                if "pendingCancelAmount" in dictionary.keys()\
                else APIHelper.SKIP
        canceled_amount =\
            PaymentTransactionCanceledAmount.from_dictionary(
                dictionary.get("canceledAmount"))\
                if "canceledAmount" in dictionary.keys()\
                else APIHelper.SKIP
        processing_fee =\
            PaymentTransactionProcessingFee.from_dictionary(
                dictionary.get("processingFee"))\
                if "processingFee" in dictionary.keys()\
                else APIHelper.SKIP
        authorization_group_id =\
            dictionary.get("authorizationGroupId")\
            if dictionary.get("authorizationGroupId")\
                else APIHelper.SKIP
        address_verification_status =\
            dictionary.get("addressVerificationStatus")\
            if dictionary.get("addressVerificationStatus")\
                else APIHelper.SKIP
        security_code_status =\
            dictionary.get("securityCodeStatus")\
            if dictionary.get("securityCodeStatus")\
                else APIHelper.SKIP
        fraud_assessments = None
        if dictionary.get("fraudAssessments") is not None:
            fraud_assessments = [
                FraudAssessment.from_dictionary(x)
                    for x in dictionary.get("fraudAssessments")
            ]
        else:
            fraud_assessments = APIHelper.SKIP
        action = APIHelper.deserialize_union_type(
            UnionTypeLookUp.get("Action"),
            dictionary.get("action"),
            False)\
            if dictionary.get("action") is not None\
            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(id,
                   mtype,
                   status,
                   payment_instrument,
                   order_id,
                   failure,
                   created_at,
                   payment_processor,
                   authorized_at,
                   captured_at,
                   canceled_at,
                   refunds,
                   has_failed_over,
                   failovers,
                   pending_authorize_amount,
                   authorized_amount,
                   pending_capture_amount,
                   captured_amount,
                   refunded_amount,
                   pending_cancel_amount,
                   canceled_amount,
                   processing_fee,
                   authorization_group_id,
                   address_verification_status,
                   security_code_status,
                   fraud_assessments,
                   action,
                   additional_properties)

    @classmethod
    def validate(cls, dictionary):
        """Validate dictionary against class required properties

        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:
            boolean : if dictionary is valid contains required properties.

        """
        from cellpointapi.utilities.union_type_lookup import (
            UnionTypeLookUp,
        )

        if isinstance(dictionary, cls):
            return APIHelper.is_valid_type(
                    value=dictionary.id,
                    type_callable=lambda value:
                        isinstance(
                        value,
                        str,
                )) \
                and APIHelper.is_valid_type(
                    value=dictionary.mtype,
                    type_callable=lambda value:
                        Type2.validate(value)) \
                and APIHelper.is_valid_type(
                    value=dictionary.status,
                    type_callable=lambda value:
                        PaymentStatus.validate(value)) \
                and (UnionTypeLookUp.get("PaymentInstrument")
                .validate(dictionary.payment_instrument).is_valid)

        if not isinstance(dictionary, dict):
            return False

        return APIHelper.is_valid_type(
                value=dictionary.get("id"),
                type_callable=lambda value:
                    isinstance(
                    value,
                    str,
            )) \
            and APIHelper.is_valid_type(
                value=dictionary.get("type"),
                type_callable=lambda value:
                    Type2.validate(value)) \
            and APIHelper.is_valid_type(
                value=dictionary.get("status"),
                type_callable=lambda value:
                    PaymentStatus.validate(value)) \
            and (UnionTypeLookUp.get("PaymentInstrument")
            .validate(dictionary.get("paymentInstrument")).is_valid)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=self.id
        _order_id=(
            self.order_id
            if hasattr(self, "order_id")
            else None
        )
        _mtype=self.mtype
        _failure=(
            self.failure
            if hasattr(self, "failure")
            else None
        )
        _created_at=(
            self.created_at
            if hasattr(self, "created_at")
            else None
        )
        _payment_processor=(
            self.payment_processor
            if hasattr(self, "payment_processor")
            else None
        )
        _status=self.status
        _authorized_at=(
            self.authorized_at
            if hasattr(self, "authorized_at")
            else None
        )
        _captured_at=(
            self.captured_at
            if hasattr(self, "captured_at")
            else None
        )
        _canceled_at=(
            self.canceled_at
            if hasattr(self, "canceled_at")
            else None
        )
        _refunds=(
            self.refunds
            if hasattr(self, "refunds")
            else None
        )
        _has_failed_over=(
            self.has_failed_over
            if hasattr(self, "has_failed_over")
            else None
        )
        _failovers=(
            self.failovers
            if hasattr(self, "failovers")
            else None
        )
        _pending_authorize_amount=(
            self.pending_authorize_amount
            if hasattr(self, "pending_authorize_amount")
            else None
        )
        _authorized_amount=(
            self.authorized_amount
            if hasattr(self, "authorized_amount")
            else None
        )
        _pending_capture_amount=(
            self.pending_capture_amount
            if hasattr(self, "pending_capture_amount")
            else None
        )
        _captured_amount=(
            self.captured_amount
            if hasattr(self, "captured_amount")
            else None
        )
        _refunded_amount=(
            self.refunded_amount
            if hasattr(self, "refunded_amount")
            else None
        )
        _pending_cancel_amount=(
            self.pending_cancel_amount
            if hasattr(self, "pending_cancel_amount")
            else None
        )
        _canceled_amount=(
            self.canceled_amount
            if hasattr(self, "canceled_amount")
            else None
        )
        _processing_fee=(
            self.processing_fee
            if hasattr(self, "processing_fee")
            else None
        )
        _payment_instrument=self.payment_instrument
        _authorization_group_id=(
            self.authorization_group_id
            if hasattr(self, "authorization_group_id")
            else None
        )
        _address_verification_status=(
            self.address_verification_status
            if hasattr(self, "address_verification_status")
            else None
        )
        _security_code_status=(
            self.security_code_status
            if hasattr(self, "security_code_status")
            else None
        )
        _fraud_assessments=(
            self.fraud_assessments
            if hasattr(self, "fraud_assessments")
            else None
        )
        _action=(
            self.action
            if hasattr(self, "action")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"order_id={_order_id!r}, "
            f"mtype={_mtype!r}, "
            f"failure={_failure!r}, "
            f"created_at={_created_at!r}, "
            f"payment_processor={_payment_processor!r}, "
            f"status={_status!r}, "
            f"authorized_at={_authorized_at!r}, "
            f"captured_at={_captured_at!r}, "
            f"canceled_at={_canceled_at!r}, "
            f"refunds={_refunds!r}, "
            f"has_failed_over={_has_failed_over!r}, "
            f"failovers={_failovers!r}, "
            f"pending_authorize_amount={_pending_authorize_amount!r}, "
            f"authorized_amount={_authorized_amount!r}, "
            f"pending_capture_amount={_pending_capture_amount!r}, "
            f"captured_amount={_captured_amount!r}, "
            f"refunded_amount={_refunded_amount!r}, "
            f"pending_cancel_amount={_pending_cancel_amount!r}, "
            f"canceled_amount={_canceled_amount!r}, "
            f"processing_fee={_processing_fee!r}, "
            f"payment_instrument={_payment_instrument!r}, "
            f"authorization_group_id={_authorization_group_id!r}, "
            f"address_verification_status={_address_verification_status!r}, "
            f"security_code_status={_security_code_status!r}, "
            f"fraud_assessments={_fraud_assessments!r}, "
            f"action={_action!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=self.id
        _order_id=(
            self.order_id
            if hasattr(self, "order_id")
            else None
        )
        _mtype=self.mtype
        _failure=(
            self.failure
            if hasattr(self, "failure")
            else None
        )
        _created_at=(
            self.created_at
            if hasattr(self, "created_at")
            else None
        )
        _payment_processor=(
            self.payment_processor
            if hasattr(self, "payment_processor")
            else None
        )
        _status=self.status
        _authorized_at=(
            self.authorized_at
            if hasattr(self, "authorized_at")
            else None
        )
        _captured_at=(
            self.captured_at
            if hasattr(self, "captured_at")
            else None
        )
        _canceled_at=(
            self.canceled_at
            if hasattr(self, "canceled_at")
            else None
        )
        _refunds=(
            self.refunds
            if hasattr(self, "refunds")
            else None
        )
        _has_failed_over=(
            self.has_failed_over
            if hasattr(self, "has_failed_over")
            else None
        )
        _failovers=(
            self.failovers
            if hasattr(self, "failovers")
            else None
        )
        _pending_authorize_amount=(
            self.pending_authorize_amount
            if hasattr(self, "pending_authorize_amount")
            else None
        )
        _authorized_amount=(
            self.authorized_amount
            if hasattr(self, "authorized_amount")
            else None
        )
        _pending_capture_amount=(
            self.pending_capture_amount
            if hasattr(self, "pending_capture_amount")
            else None
        )
        _captured_amount=(
            self.captured_amount
            if hasattr(self, "captured_amount")
            else None
        )
        _refunded_amount=(
            self.refunded_amount
            if hasattr(self, "refunded_amount")
            else None
        )
        _pending_cancel_amount=(
            self.pending_cancel_amount
            if hasattr(self, "pending_cancel_amount")
            else None
        )
        _canceled_amount=(
            self.canceled_amount
            if hasattr(self, "canceled_amount")
            else None
        )
        _processing_fee=(
            self.processing_fee
            if hasattr(self, "processing_fee")
            else None
        )
        _payment_instrument=self.payment_instrument
        _authorization_group_id=(
            self.authorization_group_id
            if hasattr(self, "authorization_group_id")
            else None
        )
        _address_verification_status=(
            self.address_verification_status
            if hasattr(self, "address_verification_status")
            else None
        )
        _security_code_status=(
            self.security_code_status
            if hasattr(self, "security_code_status")
            else None
        )
        _fraud_assessments=(
            self.fraud_assessments
            if hasattr(self, "fraud_assessments")
            else None
        )
        _action=(
            self.action
            if hasattr(self, "action")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"order_id={_order_id!s}, "
            f"mtype={_mtype!s}, "
            f"failure={_failure!s}, "
            f"created_at={_created_at!s}, "
            f"payment_processor={_payment_processor!s}, "
            f"status={_status!s}, "
            f"authorized_at={_authorized_at!s}, "
            f"captured_at={_captured_at!s}, "
            f"canceled_at={_canceled_at!s}, "
            f"refunds={_refunds!s}, "
            f"has_failed_over={_has_failed_over!s}, "
            f"failovers={_failovers!s}, "
            f"pending_authorize_amount={_pending_authorize_amount!s}, "
            f"authorized_amount={_authorized_amount!s}, "
            f"pending_capture_amount={_pending_capture_amount!s}, "
            f"captured_amount={_captured_amount!s}, "
            f"refunded_amount={_refunded_amount!s}, "
            f"pending_cancel_amount={_pending_cancel_amount!s}, "
            f"canceled_amount={_canceled_amount!s}, "
            f"processing_fee={_processing_fee!s}, "
            f"payment_instrument={_payment_instrument!s}, "
            f"authorization_group_id={_authorization_group_id!s}, "
            f"address_verification_status={_address_verification_status!s}, "
            f"security_code_status={_security_code_status!s}, "
            f"fraud_assessments={_fraud_assessments!s}, "
            f"action={_action!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
