You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
996 B
29 lines
996 B
# -*- coding: utf-8 -*-
|
|
from abc import ABCMeta, abstractmethod
|
|
# from abonapp import Abon
|
|
|
|
|
|
class TariffBase(metaclass=ABCMeta):
|
|
@abstractmethod
|
|
def calc_amount(self, abon_tariff):
|
|
"""Считает итоговую сумму платежа"""
|
|
|
|
@abstractmethod
|
|
def get_avail_time(self):
|
|
"""Возвращает оставшееся время услуги в секундах"""
|
|
|
|
@staticmethod
|
|
def description():
|
|
"""Возвращает текстовое описание"""
|
|
|
|
@staticmethod
|
|
def manage_access(abon):
|
|
"""Управляет доступом абонента к услуге"""
|
|
#assert isinstance(abon, Abon)
|
|
# если абонент не активен то выходим
|
|
if not abon.is_active: return False
|
|
# смотрим на текущую услугу
|
|
act_tar = abon.active_tariff()
|
|
# если есть услуга
|
|
if act_tar:
|
|
return True
|