from json import JSONEncoder

from ._SitefResponse import SitefResponse


class SitefResponseJsonEncoder(JSONEncoder):
    def default(self, o):
        if isinstance(o, SitefResponse):
            return {
                "Nsu": o.nsu,
                "NsuHost": o.nsu_host,
                "NsuOrigin": o.nsu_origin,
                "TransactionValue": o.transaction_value,
                "ReceiptCustomer": o.customer_receipt,
                "ReceiptMerchant": o.merchant_receipt,
                "TransactionIdentifier": o.transaction_identifier
            }

        return super(SitefResponseJsonEncoder, self).default(o)
