"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


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

    Attributes:
        reason (str): The reason why the captured payment status is PENDING or
            DENIED. BUYER_COMPLAINT The payer initiated a dispute for this captured
            payment with processor. CHARGEBACK The captured funds were reversed in
            response to the payer disputing this captured payment with the issuer of
            the financial instrument used to pay for this captured payment. ECHECK
            The payer paid by an eCheck that has not yet cleared.
            INTERNATIONAL_WITHDRAWAL Visit your online account. In your Account
            Overview, accept and deny this payment. OTHER No additional specific
            reason can be provided. For more information about this captured payment,
            visit your account online or contact processor. PENDING_REVIEW The
            captured payment is pending manual review.
            RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION The payee has not yet set up
            appropriate receiving preferences for their account. For more information
            about how to accept or deny this payment, visit your account online. This
            reason is typically offered in scenarios such as when the currency of the
            captured payment is different from the primary holding currency of the
            payee. REFUNDED The captured funds were refunded.
            TRANSACTION_APPROVED_AWAITING_FUNDING The payer must send the funds for
            this captured payment. This code generally appears for manual EFTs.
            UNILATERAL The payee does not have a processor account.
            VERIFICATION_REQUIRED The payee's processor account is not verified.
            String with values,  `BUYER_COMPLAINT`  `CHARGEBACK`  `ECHECK`
            `INTERNATIONAL_WITHDRAWAL`  `OTHER`  `PENDING_REVIEW`
            `RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION`  `REFUNDED`
            `TRANSACTION_APPROVED_AWAITING_FUNDING`  `UNILATERAL`
            `VERIFICATION_REQUIRED`
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reason": "reason",
    }

    _optionals = [
        "reason",
    ]

    def __init__(
        self,
        reason=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ApCapture instance."""
        # Initialize members of the class
        if reason is not APIHelper.SKIP:
            self.reason = reason

        # 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
        reason =\
            dictionary.get("reason")\
            if dictionary.get("reason")\
                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(reason,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _reason=(
            self.reason
            if hasattr(self, "reason")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reason={_reason!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _reason=(
            self.reason
            if hasattr(self, "reason")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reason={_reason!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
