"""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.merchant_descriptor import (
    MerchantDescriptor,
)
from visaacceptancemergedspec.models.service_fee_descriptor import (
    ServiceFeeDescriptor,
)
from visaacceptancemergedspec.models.service_location import (
    ServiceLocation,
)


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

    Attributes:
        merchant_descriptor (MerchantDescriptor): The model property of type
            MerchantDescriptor.
        domain_name (str): This field will contain either the merchant url or the
            reverse domain as per the requirement for DSRP Format 3. This might vary
            transaction to transaction and might not be static. Merchant needs to
            have access to send this value for all DSRP program.
        sales_organization_id (str): Company ID assigned to an independent sales
            organization. Get this value from Mastercard.  #### Visa Acceptance
            through VisaNet The value for this field corresponds to the following
            data in the TC 33 capture file: - Record: CP01 TCR6 - Position: 106-116 -
            Field: Independent Sales Organization ID  This field is supported for
            Visa, Mastercard and Discover Transactions.  **Note** The TC 33 Capture
            file contains information about the purchases and refunds that a merchant
            submits to Visa Acceptance. Visa Acceptance through VisaNet creates the
            TC 33 Capture file at the end of the day and sends it to the merchant’s
            acquirer, who uses this information to facilitate end-of-day clearing
            processing with payment card companies.
        category_code (int): The value for this field is a four-digit number that the
            payment card industry uses to classify merchants into market segments. A
            payment card company assigned one or more of these values to your
            business when you started accepting the payment card company’s cards.
            When you do not include this field in your request, Visa Acceptance uses
            the value in your Visa Acceptance account.  #### Visa Acceptance through
            VisaNet The value for this field corresponds to the following data in the
            TC 33 capture file5: - Record: CP01 TCR4 - Position: 150-153 - Field:
            Merchant Category Code
        category_code_domestic (int): Merchant category code for domestic
            transactions. The value for this field is a four-digit number that the
            payment card industry uses to classify merchants into market segments. A
            payment card company assigned one or more of these values to your
            business when you started accepting the payment card company’s cards.
            Including this field in a request for a domestic transaction might reduce
            interchange fees.  When you include this field in a request: - Do not
            include the `merchant_category_code` field. - The value for this field
            overrides the value in your Visa Acceptance account.  This field is
            supported only for: - Domestic transactions with Mastercard in Spain.
            Domestic means that you and the cardholder are in the same country. -
            Merchants enrolled in the OmniPay Direct interchange program. - First
            Data Merchant Solutions (Europe) on OmniPay Direct.
        tax_id (str): Your Cadastro Nacional da Pessoa Jurídica (CNPJ) number.  This
            field is supported only for BNDES transactions on Visa Acceptance through
            VisaNet.  The value for this field corresponds to the following data in
            the TC 33 capture file5: - Record: CP07 TCR6 - Position: 40-59 - Field:
            BNDES Reference Field 1
        vat_registration_number (str): Your government-assigned tax identification
            number.  #### Tax Calculation Required field for value added tax only.
            Not applicable to U.S. and Canadian taxes.  #### Visa Acceptance through
            VisaNet For CtV processors, the maximum length is 20.
        card_acceptor_reference_number (str): Reference number that facilitates card
            acceptor/corporation communication and record keeping.
        transaction_local_date_time (str): Date and time at your physical location.
            Format: `YYYYMMDDhhmmss`, where:  - `YYYY` = year  - `MM` = month  - `DD`
            = day  - `hh` = hour  - `mm` = minutes  - `ss` = seconds  #### Used by
            **Authorization** Required for these processors: - American Express
            Direct
            - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global -
            SIX  Optional for all other processors.
        service_fee_descriptor (ServiceFeeDescriptor): The model property of type
            ServiceFeeDescriptor.
        cancel_url (str): customer would be redirected to this url based on the
            decision of the transaction
        success_url (str): customer would be redirected to this url based on the
            decision of the transaction
        failure_url (str): customer would be redirected to this url based on the
            decision of the transaction
        return_url (str): URL for displaying payment results to the consumer
            (notifications) after the transaction is processed. Usually this URL
            belongs to merchant and its behavior is defined by merchant
        partner_id_code (str): #### Visa Platform Connect This field may be used for
            transactions on accounts issued under co-branding agreements when one of
            the co-branding partners.
        service_location (ServiceLocation): The model property of type
            ServiceLocation.
        note_to_buyer (str): Free-form text field.
        merchant_name (str): Use this field only if you are requesting payment with
            Payer Authentication serice together.  Your company’s name as you want it
            to appear to the customer in the issuing bank’s authentication form. This
            value overrides the value specified by your merchant bank.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_descriptor": "merchantDescriptor",
        "domain_name": "domainName",
        "sales_organization_id": "salesOrganizationId",
        "category_code": "categoryCode",
        "category_code_domestic": "categoryCodeDomestic",
        "tax_id": "taxId",
        "vat_registration_number": "vatRegistrationNumber",
        "card_acceptor_reference_number": "cardAcceptorReferenceNumber",
        "transaction_local_date_time": "transactionLocalDateTime",
        "service_fee_descriptor": "serviceFeeDescriptor",
        "cancel_url": "cancelUrl",
        "success_url": "successUrl",
        "failure_url": "failureUrl",
        "return_url": "returnUrl",
        "partner_id_code": "partnerIdCode",
        "service_location": "serviceLocation",
        "note_to_buyer": "noteToBuyer",
        "merchant_name": "merchantName",
    }

    _optionals = [
        "merchant_descriptor",
        "domain_name",
        "sales_organization_id",
        "category_code",
        "category_code_domestic",
        "tax_id",
        "vat_registration_number",
        "card_acceptor_reference_number",
        "transaction_local_date_time",
        "service_fee_descriptor",
        "cancel_url",
        "success_url",
        "failure_url",
        "return_url",
        "partner_id_code",
        "service_location",
        "note_to_buyer",
        "merchant_name",
    ]

    def __init__(
        self,
        merchant_descriptor=APIHelper.SKIP,
        domain_name=APIHelper.SKIP,
        sales_organization_id=APIHelper.SKIP,
        category_code=APIHelper.SKIP,
        category_code_domestic=APIHelper.SKIP,
        tax_id=APIHelper.SKIP,
        vat_registration_number=APIHelper.SKIP,
        card_acceptor_reference_number=APIHelper.SKIP,
        transaction_local_date_time=APIHelper.SKIP,
        service_fee_descriptor=APIHelper.SKIP,
        cancel_url=APIHelper.SKIP,
        success_url=APIHelper.SKIP,
        failure_url=APIHelper.SKIP,
        return_url=APIHelper.SKIP,
        partner_id_code=APIHelper.SKIP,
        service_location=APIHelper.SKIP,
        note_to_buyer=APIHelper.SKIP,
        merchant_name=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MerchantInformation instance."""
        # Initialize members of the class
        if merchant_descriptor is not APIHelper.SKIP:
            self.merchant_descriptor = merchant_descriptor
        if domain_name is not APIHelper.SKIP:
            self.domain_name = domain_name
        if sales_organization_id is not APIHelper.SKIP:
            self.sales_organization_id = sales_organization_id
        if category_code is not APIHelper.SKIP:
            self.category_code = category_code
        if category_code_domestic is not APIHelper.SKIP:
            self.category_code_domestic = category_code_domestic
        if tax_id is not APIHelper.SKIP:
            self.tax_id = tax_id
        if vat_registration_number is not APIHelper.SKIP:
            self.vat_registration_number = vat_registration_number
        if card_acceptor_reference_number is not APIHelper.SKIP:
            self.card_acceptor_reference_number = card_acceptor_reference_number
        if transaction_local_date_time is not APIHelper.SKIP:
            self.transaction_local_date_time = transaction_local_date_time
        if service_fee_descriptor is not APIHelper.SKIP:
            self.service_fee_descriptor = service_fee_descriptor
        if cancel_url is not APIHelper.SKIP:
            self.cancel_url = cancel_url
        if success_url is not APIHelper.SKIP:
            self.success_url = success_url
        if failure_url is not APIHelper.SKIP:
            self.failure_url = failure_url
        if return_url is not APIHelper.SKIP:
            self.return_url = return_url
        if partner_id_code is not APIHelper.SKIP:
            self.partner_id_code = partner_id_code
        if service_location is not APIHelper.SKIP:
            self.service_location = service_location
        if note_to_buyer is not APIHelper.SKIP:
            self.note_to_buyer = note_to_buyer
        if merchant_name is not APIHelper.SKIP:
            self.merchant_name = merchant_name

        # 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_descriptor =\
            MerchantDescriptor.from_dictionary(
                dictionary.get("merchantDescriptor"))\
                if "merchantDescriptor" in dictionary.keys()\
                else APIHelper.SKIP
        domain_name =\
            dictionary.get("domainName")\
            if dictionary.get("domainName")\
                else APIHelper.SKIP
        sales_organization_id =\
            dictionary.get("salesOrganizationId")\
            if dictionary.get("salesOrganizationId")\
                else APIHelper.SKIP
        category_code =\
            dictionary.get("categoryCode")\
            if dictionary.get("categoryCode")\
                else APIHelper.SKIP
        category_code_domestic =\
            dictionary.get("categoryCodeDomestic")\
            if dictionary.get("categoryCodeDomestic")\
                else APIHelper.SKIP
        tax_id =\
            dictionary.get("taxId")\
            if dictionary.get("taxId")\
                else APIHelper.SKIP
        vat_registration_number =\
            dictionary.get("vatRegistrationNumber")\
            if dictionary.get("vatRegistrationNumber")\
                else APIHelper.SKIP
        card_acceptor_reference_number =\
            dictionary.get("cardAcceptorReferenceNumber")\
            if dictionary.get("cardAcceptorReferenceNumber")\
                else APIHelper.SKIP
        transaction_local_date_time =\
            dictionary.get("transactionLocalDateTime")\
            if dictionary.get("transactionLocalDateTime")\
                else APIHelper.SKIP
        service_fee_descriptor =\
            ServiceFeeDescriptor.from_dictionary(
                dictionary.get("serviceFeeDescriptor"))\
                if "serviceFeeDescriptor" in dictionary.keys()\
                else APIHelper.SKIP
        cancel_url =\
            dictionary.get("cancelUrl")\
            if dictionary.get("cancelUrl")\
                else APIHelper.SKIP
        success_url =\
            dictionary.get("successUrl")\
            if dictionary.get("successUrl")\
                else APIHelper.SKIP
        failure_url =\
            dictionary.get("failureUrl")\
            if dictionary.get("failureUrl")\
                else APIHelper.SKIP
        return_url =\
            dictionary.get("returnUrl")\
            if dictionary.get("returnUrl")\
                else APIHelper.SKIP
        partner_id_code =\
            dictionary.get("partnerIdCode")\
            if dictionary.get("partnerIdCode")\
                else APIHelper.SKIP
        service_location =\
            ServiceLocation.from_dictionary(
                dictionary.get("serviceLocation"))\
                if "serviceLocation" in dictionary.keys()\
                else APIHelper.SKIP
        note_to_buyer =\
            dictionary.get("noteToBuyer")\
            if dictionary.get("noteToBuyer")\
                else APIHelper.SKIP
        merchant_name =\
            dictionary.get("merchantName")\
            if dictionary.get("merchantName")\
                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_descriptor,
                   domain_name,
                   sales_organization_id,
                   category_code,
                   category_code_domestic,
                   tax_id,
                   vat_registration_number,
                   card_acceptor_reference_number,
                   transaction_local_date_time,
                   service_fee_descriptor,
                   cancel_url,
                   success_url,
                   failure_url,
                   return_url,
                   partner_id_code,
                   service_location,
                   note_to_buyer,
                   merchant_name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _domain_name=(
            self.domain_name
            if hasattr(self, "domain_name")
            else None
        )
        _sales_organization_id=(
            self.sales_organization_id
            if hasattr(self, "sales_organization_id")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _category_code_domestic=(
            self.category_code_domestic
            if hasattr(self, "category_code_domestic")
            else None
        )
        _tax_id=(
            self.tax_id
            if hasattr(self, "tax_id")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _card_acceptor_reference_number=(
            self.card_acceptor_reference_number
            if hasattr(self, "card_acceptor_reference_number")
            else None
        )
        _transaction_local_date_time=(
            self.transaction_local_date_time
            if hasattr(self, "transaction_local_date_time")
            else None
        )
        _service_fee_descriptor=(
            self.service_fee_descriptor
            if hasattr(self, "service_fee_descriptor")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _success_url=(
            self.success_url
            if hasattr(self, "success_url")
            else None
        )
        _failure_url=(
            self.failure_url
            if hasattr(self, "failure_url")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _partner_id_code=(
            self.partner_id_code
            if hasattr(self, "partner_id_code")
            else None
        )
        _service_location=(
            self.service_location
            if hasattr(self, "service_location")
            else None
        )
        _note_to_buyer=(
            self.note_to_buyer
            if hasattr(self, "note_to_buyer")
            else None
        )
        _merchant_name=(
            self.merchant_name
            if hasattr(self, "merchant_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!r}, "
            f"domain_name={_domain_name!r}, "
            f"sales_organization_id={_sales_organization_id!r}, "
            f"category_code={_category_code!r}, "
            f"category_code_domestic={_category_code_domestic!r}, "
            f"tax_id={_tax_id!r}, "
            f"vat_registration_number={_vat_registration_number!r}, "
            f"card_acceptor_reference_number={_card_acceptor_reference_number!r}, "
            f"transaction_local_date_time={_transaction_local_date_time!r}, "
            f"service_fee_descriptor={_service_fee_descriptor!r}, "
            f"cancel_url={_cancel_url!r}, "
            f"success_url={_success_url!r}, "
            f"failure_url={_failure_url!r}, "
            f"return_url={_return_url!r}, "
            f"partner_id_code={_partner_id_code!r}, "
            f"service_location={_service_location!r}, "
            f"note_to_buyer={_note_to_buyer!r}, "
            f"merchant_name={_merchant_name!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _domain_name=(
            self.domain_name
            if hasattr(self, "domain_name")
            else None
        )
        _sales_organization_id=(
            self.sales_organization_id
            if hasattr(self, "sales_organization_id")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _category_code_domestic=(
            self.category_code_domestic
            if hasattr(self, "category_code_domestic")
            else None
        )
        _tax_id=(
            self.tax_id
            if hasattr(self, "tax_id")
            else None
        )
        _vat_registration_number=(
            self.vat_registration_number
            if hasattr(self, "vat_registration_number")
            else None
        )
        _card_acceptor_reference_number=(
            self.card_acceptor_reference_number
            if hasattr(self, "card_acceptor_reference_number")
            else None
        )
        _transaction_local_date_time=(
            self.transaction_local_date_time
            if hasattr(self, "transaction_local_date_time")
            else None
        )
        _service_fee_descriptor=(
            self.service_fee_descriptor
            if hasattr(self, "service_fee_descriptor")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _success_url=(
            self.success_url
            if hasattr(self, "success_url")
            else None
        )
        _failure_url=(
            self.failure_url
            if hasattr(self, "failure_url")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _partner_id_code=(
            self.partner_id_code
            if hasattr(self, "partner_id_code")
            else None
        )
        _service_location=(
            self.service_location
            if hasattr(self, "service_location")
            else None
        )
        _note_to_buyer=(
            self.note_to_buyer
            if hasattr(self, "note_to_buyer")
            else None
        )
        _merchant_name=(
            self.merchant_name
            if hasattr(self, "merchant_name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!s}, "
            f"domain_name={_domain_name!s}, "
            f"sales_organization_id={_sales_organization_id!s}, "
            f"category_code={_category_code!s}, "
            f"category_code_domestic={_category_code_domestic!s}, "
            f"tax_id={_tax_id!s}, "
            f"vat_registration_number={_vat_registration_number!s}, "
            f"card_acceptor_reference_number={_card_acceptor_reference_number!s}, "
            f"transaction_local_date_time={_transaction_local_date_time!s}, "
            f"service_fee_descriptor={_service_fee_descriptor!s}, "
            f"cancel_url={_cancel_url!s}, "
            f"success_url={_success_url!s}, "
            f"failure_url={_failure_url!s}, "
            f"return_url={_return_url!s}, "
            f"partner_id_code={_partner_id_code!s}, "
            f"service_location={_service_location!s}, "
            f"note_to_buyer={_note_to_buyer!s}, "
            f"merchant_name={_merchant_name!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
