from typing import Optional

from ._PaymentResponse import PaymentResponse


class PaymentResponseData(PaymentResponse):
    def __init__(
        self,
        media,                      # type: str
        result,                     # type: str
        card_number,                # type: str
        auth_code,                  # type: str
        approved_amount,            # type: str
        id_auth,                    # type: str
        cnpj_auth,                  # type: str
        bandeira,                   # type: str
        receipt_merchant,           # type: str
        receipt_customer,           # type: str
        expiration_date,            # type: str
        nsu,                        # type: str
        transaction_processor,      # type: str
        last_digits,                # type: str
        sat_acquirer,               # type: str
        t_pag,                      # type: str
        t_band,                     # type: str
        nsu_host="",                # type: Optional[str]
        electronic_type="",         # type: Optional[str]
        transaction_identifier=""   # type: Optional[str]
    ):
        # type: (...) -> None

        self.media = media
        self.result = result
        self.card_number = card_number
        self.auth_code = auth_code
        self.approved_amount = approved_amount
        self.id_auth = id_auth
        self.cnpj_auth = cnpj_auth
        self.bandeira = bandeira
        self.receipt_merchant = receipt_merchant
        self.receipt_customer = receipt_customer
        self.expiration_date = expiration_date
        self.nsu = nsu
        self.transaction_processor = transaction_processor
        self.last_digits = last_digits
        self.sat_acquirer = sat_acquirer
        self.t_pag = t_pag
        self.t_band = t_band
        self.nsu_host = nsu_host
        self.electronic_type = electronic_type
        self.transaction_identifier = transaction_identifier

    def to_xml(self):
        return """<EftXml 
            Media='%s'
            Result='%s'
            CardNumber='%sXXXXXXXXXX'
            AuthCode='%s'
            ApprovedAmount='%s'
            IdAuth='%s'
            CNPJAuth='%s'
            Bandeira='%s'
            ReceiptMerchant='%s'
            ReceiptCustomer='%s'
            ExpirationDate='%s'
            Nsu='%s'
            TransactionProcessor='%s'
            LastDigits='%s'
            AccreditorSat='%s'
            tPag='%s'
            tBand='%s'
            NsuHost='%s'
            ElectronicType='%s'
            TransactionIdentifier='%s'
            />
            """ % (
            self.media,
            self.result,
            self.card_number,
            self.auth_code,
            self.approved_amount,
            self.id_auth,
            self.cnpj_auth,
            self.bandeira,
            self.receipt_merchant,
            self.receipt_customer,
            self.expiration_date,
            self.nsu,
            self.transaction_processor,
            self.last_digits,
            self.sat_acquirer,
            self.t_pag,
            self.t_band,
            self.nsu_host,
            self.electronic_type,
            self.transaction_identifier
        )
