# coding=utf-8
import base64
import time

from model import EftData, PaymentResponseData
from paymentprocessor import PaymentProcessor

from sysdefs import eft


class FakePaymentProcessor(PaymentProcessor):
    def connection_status(self, test_connection_data):
        return True

    def add_payment(self, start_payment_data):
        pos_id = start_payment_data.pos_id
        session_id = start_payment_data.session_id
        self.register_eft_activity(EftData(pos_id, session_id, eft.EFT_CREDITSALE, 1,
                                           start_payment_data.amount, orderid=start_payment_data.order_id))
        self.dialog_manager.close_dialogs(pos_id)
        return PaymentResponseData(
            '',
            '0',
            '4111XXXXXXXXXXXX',
            '1302',
            start_payment_data.amount,
            '08496898000142',
            "68536379000192",
            '4',
            base64.b64encode("Recibo de teste.\nSitef FAKE"),
            base64.b64encode("Recibo de teste.\nSitef FAKE"),
            '05/2020',
            '1234',
            "00051")

    def cancel_payment(self):
        return ""

    def finish_payment(self, finish_payment_data):
        return ""

    def get_name(self):
        return "FakeElectronicPayment"
