# -*- coding: utf-8 -*-

from modelcommon.model import SitefResponse
from typing import (
    Any,
    Union
)

from _CapptaProcessor import CapptaProcessor
from model import (
    CancelPaymentOrderData,
    ConfirmFinishPaymentData,
    TestConnectionData
)


class CapptaDebitPaymentProcessor(object):
    def __init__(self, message_bus, dialog_manager, config, logger):
        self.cappta_processor = CapptaProcessor(message_bus, dialog_manager, config, logger)

    def connection_status(
        self,
        test_connection_data    # type: TestConnectionData
    ):
        # type: (...) -> bool

        return self.cappta_processor.connection_status(test_connection_data=test_connection_data)

    def add_payment(self, start_payment_data):
        return self.cappta_processor.add_payment(start_payment_data)

    def cancel_payment_order(
        self,
        cancel_payment_order_data   # type: CancelPaymentOrderData
    ):
        # type: (...) -> Any[Union[SitefResponse, str]]

        return self.cappta_processor.cancel_payment_order(cancel_payment_order_data=cancel_payment_order_data)

    def cancel_payment(self):
        return self.cappta_processor.cancel_payment()

    def finish_payment(self, finish_payment_data):
        self.cappta_processor.finish_payment(finish_payment_data)

    def confirm_finish_payment(
        self,
        confirm_finish_payment_data     # type: ConfirmFinishPaymentData
    ):
        # type: (...) -> None

        self.cappta_processor.confirm_finish_payment(confirm_finish_payment_data=confirm_finish_payment_data)

    def get_name(self):
        return self.cappta_processor.get_name()

    def stop(self):
        self.cappta_processor.stop()
