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)
示例#2
0
 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()
示例#3
0
def bill_extra_subscription(extra):
    period = ExtraSubBillingPeriodDao.get_current_period_per_type(extra.type)
    bill_extra_subscription(extra, period)
示例#4
0
 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