from ._PaymentResponse import PaymentResponse


class PaymentResponseData(PaymentResponse):
    def __init__(self, media, result, card_number, auth_code, approved_amount, id_auth, cnpj_auth, bandeira, receipt_merchant, receipt_customer, expiration_date, nsu, transaction_processor, nsu_host=""):
        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.nsu_host = nsu_host

    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' NSUHost='%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.nsu_host)
