def handle(self, *args, **options): now = timezone.now() periods = ExtraSubBillingPeriodDao.get_starting_for_date(now) for period in periods: for extra in period.type.extra_subscriptions.filter(active=True): bill_extra_subscription(extra, period) bs = Config.business_year_start() if now.day == bs['day'] and now.month == bs['month']: for subscription in SubscriptionDao.all_active_subscritions(): bill_subscription(subscrtption)
def can_cancel(self): period = ExtraSubBillingPeriodDao.get_current_period_per_type( self.type) print(period.get_actual_cancel()) return timezone.now().date() <= period.get_actual_cancel()
def bill_extra_subscription(extra): period = ExtraSubBillingPeriodDao.get_current_period_per_type(extra.type) bill_extra_subscription(extra, period)
def can_cancel(self): period = ExtraSubBillingPeriodDao.get_current_period_per_type( self.type) if period is not None: return timezone.now().date() <= period.get_actual_cancel() return True