Esempio n. 1
0
 def get_factory_by_feature_type(cls, feature_type):
     try:
         return {
             FeatureType.SMS: SmsLineItemFactory,
             FeatureType.USER: UserLineItemFactory,
         }[feature_type]
     except KeyError:
         raise LineItemError("No line item factory exists for the feature type '%s" % feature_type)
Esempio n. 2
0
 def subscribed_domains(self):
     if self.subscription.subscriber.domain is None:
         raise LineItemError("No domain could be obtained as the subscriber.")
     if self.subscription.account.is_customer_billing_account:
         return [sub.subscriber.domain for sub in
                 self.subscription.account.subscription_set
                     .filter(plan_version=self.subscription.plan_version)]
     return [self.subscription.subscriber.domain]
Esempio n. 3
0
 def subscribed_domains(self):
     if self.subscription.subscriber.organization is None and self.subscription.subscriber.domain is None:
         raise LineItemError(
             "No domain or organization could be obtained as the subscriber."
         )
     if self.subscription.subscriber.organization is not None:
         return Domain.get_by_organization(
             self.subscription.subscriber.organization)
     return [self.subscription.subscriber.domain]
Esempio n. 4
0
 def subscribed_domains(self):
     if self.subscription.subscriber.domain is None:
         raise LineItemError(
             "No domain could be obtained as the subscriber.")
     return [self.subscription.subscriber.domain]