"""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.personal_identification import (
    PersonalIdentification,
)


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

    Attributes:
        merchant_customer_id (str): Your identifier for the customer.  When a
            subscription or customer profile is being created, the maximum length for
            this field for most processors is 30. Otherwise, the maximum length is
            100.  #### Comercio Latino For recurring payments in Mexico, the value is
            the customer’s contract number. Note Before you request the
            authorization, you must inform the issuer of the customer contract
            numbers that will be used for recurring transactions.  #### Worldpay VAP
            For a follow-on credit with Worldpay VAP, Visa Acceptance checks the
            following locations, in the order given, for a customer account ID value
            and uses the first value it finds: 1. `customer_account_id` value in the
            follow-on credit request 2. Customer account ID value that was used for
            the capture that is being credited 3. Customer account ID value that was
            used for the original authorization If a customer account ID value cannot
            be found in any of these locations, then no value is used.
        date_of_birth (str): Recipient’s date of birth. **Format**: `YYYYMMDD`.  This
            field is a `pass-through`, which means that Visa Acceptance ensures that
            the value is eight numeric characters but otherwise does not verify the
            value or modify it in any way before sending it to the processor. If the
            field is not required for the transaction, Visa Acceptance does not
            forward it to the processor.
        vat_registration_number (str): Customer’s government-assigned tax
            identification number.  #### Tax Calculation Optional for international
            and value added taxes only. Not applicable to U.S. and Canadian taxes.
        company_tax_id (str): Company’s tax identifier. This is only used for eCheck
            service.  ** TeleCheck ** Contact your TeleCheck representative to find
            out whether this field is required or optional.  ** All Other Processors
            ** Not used.
        personal_identification (List[PersonalIdentification]): The model property of
            type List[PersonalIdentification].
        hashed_password (str): The merchant's password that Visa Acceptance hashes
            and stores as a hashed password.
        gender (str): Customer's gender. Possible values are F (female), M (male),O
            (other).
        language (str): language setting of the user.  Supports 2-character language
            codes (e.g., en, fr) and 5-character locale values (e.g., en-US, fr-CA).
        note_to_seller (str): Note to the recipient of the funds in this transaction
        mobile_phone (int): Cardholder’s mobile phone number. **Important** Required
            for Visa Secure transactions in Brazil. Do not use this request field for
            any other types of transactions.
        wallet_id (str): The one-time identification code of the Alipay wallet user.
            It is scanned from the barcode that is shown by the mobile application.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_customer_id": "merchantCustomerId",
        "date_of_birth": "dateOfBirth",
        "vat_registration_number": "vatRegistrationNumber",
        "company_tax_id": "companyTaxId",
        "personal_identification": "personalIdentification",
        "hashed_password": "hashedPassword",
        "gender": "gender",
        "language": "language",
        "note_to_seller": "noteToSeller",
        "mobile_phone": "mobilePhone",
        "wallet_id": "walletId",
    }

    _optionals = [
        "merchant_customer_id",
        "date_of_birth",
        "vat_registration_number",
        "company_tax_id",
        "personal_identification",
        "hashed_password",
        "gender",
        "language",
        "note_to_seller",
        "mobile_phone",
        "wallet_id",
    ]

    def __init__(
        self,
        merchant_customer_id=APIHelper.SKIP,
        date_of_birth=APIHelper.SKIP,
        vat_registration_number=APIHelper.SKIP,
        company_tax_id=APIHelper.SKIP,
        personal_identification=APIHelper.SKIP,
        hashed_password=APIHelper.SKIP,
        gender=APIHelper.SKIP,
        language=APIHelper.SKIP,
        note_to_seller=APIHelper.SKIP,
        mobile_phone=APIHelper.SKIP,
        wallet_id=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a BuyerInformation instance."""
        # Initialize members of the class
        if merchant_customer_id is not APIHelper.SKIP:
            self.merchant_customer_id = merchant_customer_id
        if date_of_birth is not APIHelper.SKIP:
            self.date_of_birth = date_of_birth
        if vat_registration_number is not APIHelper.SKIP:
            self.vat_registration_number = vat_registration_number
        if company_tax_id is not APIHelper.SKIP:
            self.company_tax_id = company_tax_id
        if personal_identification is not APIHelper.SKIP:
            self.personal_identification = personal_identification
        if hashed_password is not APIHelper.SKIP:
            self.hashed_password = hashed_password
        if gender is not APIHelper.SKIP:
            self.gender = gender
        if language is not APIHelper.SKIP:
            self.language = language
        if note_to_seller is not APIHelper.SKIP:
            self.note_to_seller = note_to_seller
        if mobile_phone is not APIHelper.SKIP:
            self.mobile_phone = mobile_phone
        if wallet_id is not APIHelper.SKIP:
            self.wallet_id = wallet_id

        # 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
        merchant_customer_id =\
            dictionary.get("merchantCustomerId")\
            if dictionary.get("merchantCustomerId")\
                else APIHelper.SKIP
        date_of_birth =\
            dictionary.get("dateOfBirth")\
            if dictionary.get("dateOfBirth")\
                else APIHelper.SKIP
        vat_registration_number =\
            dictionary.get("vatRegistrationNumber")\
            if dictionary.get("vatRegistrationNumber")\
                else APIHelper.SKIP
        company_tax_id =\
            dictionary.get("companyTaxId")\
            if dictionary.get("companyTaxId")\
                else APIHelper.SKIP
        personal_identification = None
        if dictionary.get("personalIdentification") is not None:
            personal_identification = [
                PersonalIdentification.from_dictionary(x)
                    for x in dictionary.get("personalIdentification")
            ]
        else:
            personal_identification = APIHelper.SKIP
        hashed_password =\
            dictionary.get("hashedPassword")\
            if dictionary.get("hashedPassword")\
                else APIHelper.SKIP
        gender =\
            dictionary.get("gender")\
            if dictionary.get("gender")\
                else APIHelper.SKIP
        language =\
            dictionary.get("language")\
            if dictionary.get("language")\
                else APIHelper.SKIP
        note_to_seller =\
            dictionary.get("noteToSeller")\
            if dictionary.get("noteToSeller")\
                else APIHelper.SKIP
        mobile_phone =\
            dictionary.get("mobilePhone")\
            if dictionary.get("mobilePhone")\
                else APIHelper.SKIP
        wallet_id =\
            dictionary.get("walletId")\
            if dictionary.get("walletId")\
                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(merchant_customer_id,
                   date_of_birth,
                   vat_registration_number,
                   company_tax_id,
                   personal_identification,
                   hashed_password,
                   gender,
                   language,
                   note_to_seller,
                   mobile_phone,
                   wallet_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_customer_id=(
            self.merchant_customer_id
            if hasattr(self, "merchant_customer_id")
            else None
        )
        _date_of_birth=(
            self.date_of_birth
            if hasattr(self, "date_of_birth")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _company_tax_id=(
            self.company_tax_id
            if hasattr(self, "company_tax_id")
            else None
        )
        _personal_identification=(
            self.personal_identification
            if hasattr(self, "personal_identification")
            else None
        )
        _hashed_password=(
            self.hashed_password
            if hasattr(self, "hashed_password")
            else None
        )
        _gender=(
            self.gender
            if hasattr(self, "gender")
            else None
        )
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _note_to_seller=(
            self.note_to_seller
            if hasattr(self, "note_to_seller")
            else None
        )
        _mobile_phone=(
            self.mobile_phone
            if hasattr(self, "mobile_phone")
            else None
        )
        _wallet_id=(
            self.wallet_id
            if hasattr(self, "wallet_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_customer_id={_merchant_customer_id!r}, "
            f"date_of_birth={_date_of_birth!r}, "
            f"vat_registration_number={_vat_registration_number!r}, "
            f"company_tax_id={_company_tax_id!r}, "
            f"personal_identification={_personal_identification!r}, "
            f"hashed_password={_hashed_password!r}, "
            f"gender={_gender!r}, "
            f"language={_language!r}, "
            f"note_to_seller={_note_to_seller!r}, "
            f"mobile_phone={_mobile_phone!r}, "
            f"wallet_id={_wallet_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_customer_id=(
            self.merchant_customer_id
            if hasattr(self, "merchant_customer_id")
            else None
        )
        _date_of_birth=(
            self.date_of_birth
            if hasattr(self, "date_of_birth")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _company_tax_id=(
            self.company_tax_id
            if hasattr(self, "company_tax_id")
            else None
        )
        _personal_identification=(
            self.personal_identification
            if hasattr(self, "personal_identification")
            else None
        )
        _hashed_password=(
            self.hashed_password
            if hasattr(self, "hashed_password")
            else None
        )
        _gender=(
            self.gender
            if hasattr(self, "gender")
            else None
        )
        _language=(
            self.language
            if hasattr(self, "language")
            else None
        )
        _note_to_seller=(
            self.note_to_seller
            if hasattr(self, "note_to_seller")
            else None
        )
        _mobile_phone=(
            self.mobile_phone
            if hasattr(self, "mobile_phone")
            else None
        )
        _wallet_id=(
            self.wallet_id
            if hasattr(self, "wallet_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_customer_id={_merchant_customer_id!s}, "
            f"date_of_birth={_date_of_birth!s}, "
            f"vat_registration_number={_vat_registration_number!s}, "
            f"company_tax_id={_company_tax_id!s}, "
            f"personal_identification={_personal_identification!s}, "
            f"hashed_password={_hashed_password!s}, "
            f"gender={_gender!s}, "
            f"language={_language!s}, "
            f"note_to_seller={_note_to_seller!s}, "
            f"mobile_phone={_mobile_phone!s}, "
            f"wallet_id={_wallet_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
