"""paypalserversdk.

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

# ruff: noqa: E501

class PaymentAdviceCode(object):
    """Implementation of the 'Payment Advice Code' enum.

    The declined payment transactions might have payment advice codes. The card
    networks, like Visa and Mastercard, return payment advice codes.

    Attributes:
        PAYMENTADVICE_01: For Mastercard, expired card account upgrade or portfolio
            sale conversion. Obtain new account information before next billing cycle.
        PAYMENTADVICE_02: For Mastercard, over credit limit or insufficient funds.
            Retry the transaction 72 hours later. For Visa, the card holder wants to
            stop only one specific payment in the recurring payment relationship. The
            merchant must NOT resubmit the same transaction. The merchant can
            continue the billing process in the subsequent billing period.
        PAYMENTADVICE_03: For Mastercard, account closed as fraudulent. Obtain
            another type of payment from customer due to account being closed or
            fraud. Possible reason: Account closed as fraudulent. For Visa, the card
            holder wants to stop all recurring payment transactions for a specific
            merchant. Stop recurring payment requests.
        PAYMENTADVICE_04: For Mastercard, token requirements not fulfilled for this
            token type.
        PAYMENTADVICE_21: For Mastercard, the card holder has been unsuccessful at
            canceling recurring payment through merchant. Stop recurring payment
            requests. For Visa, all recurring payments were canceled for the card
            number requested. Stop recurring payment requests.
        PAYMENTADVICE_22: For Mastercard, merchant does not qualify for product code.
        PAYMENTADVICE_24: For Mastercard, retry after 1 hour.
        PAYMENTADVICE_25: For Mastercard, retry after 24 hours.
        PAYMENTADVICE_26: For Mastercard, retry after 2 days.
        PAYMENTADVICE_27: For Mastercard, retry after 4 days.
        PAYMENTADVICE_28: For Mastercard, retry after 6 days.
        PAYMENTADVICE_29: For Mastercard, retry after 8 days.
        PAYMENTADVICE_30: For Mastercard, retry after 10 days .
        PAYMENTADVICE_40: For Mastercard, consumer non-reloadable prepaid card.
        PAYMENTADVICE_43: For Mastercard, consumer multi-use virtual card number.

    """

    PAYMENTADVICE_01 = "01"

    PAYMENTADVICE_02 = "02"

    PAYMENTADVICE_03 = "03"

    PAYMENTADVICE_04 = "04"

    PAYMENTADVICE_21 = "21"

    PAYMENTADVICE_22 = "22"

    PAYMENTADVICE_24 = "24"

    PAYMENTADVICE_25 = "25"

    PAYMENTADVICE_26 = "26"

    PAYMENTADVICE_27 = "27"

    PAYMENTADVICE_28 = "28"

    PAYMENTADVICE_29 = "29"

    PAYMENTADVICE_30 = "30"

    PAYMENTADVICE_40 = "40"

    PAYMENTADVICE_43 = "43"

    @classmethod
    def from_value(cls, value, default=None):
        """Return the matching enum value for the given input."""
        if value is None:
            return default

        # If numeric and matches directly
        if isinstance(value, int):
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and val == value:
                    return val

        # If string, perform case-insensitive match
        if isinstance(value, str):
            value_lower = value.lower()
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and (
                    name.lower() == value_lower or str(val).lower() == value_lower
                ):
                    return val

        # Fallback to default
        return default
