Signals

Signals for account app.

smarter.apps.account.signals.budget_exceeded = <django.dispatch.dispatcher.Signal object>

Signal sent when a resource’s spending reaches a limit of its budget, or the budget’s duration ends.

Sent once per billing period.

Parameters:
  • resource_constraint (ResourceConstraint) – The budget attached to the resource.

  • lock (Optional[ResourceLock]) – The lock that now refuses charges, or None if the budget only warns.

  • reason (str) – Which limit was reached.

  • actual (Decimal) – The resource’s spending, in the budget’s unit.

  • limit (Decimal) – The limit that was reached.

Example:

budget_exceeded.send(sender=self.__class__, resource_constraint=self, lock=lock, reason=reason, actual=actual, limit=limit)
smarter.apps.account.signals.budget_released = <django.dispatch.dispatcher.Signal object>

Signal sent when a resource’s lock is removed, e.g. at the end of its billing period.

Parameters:

resource_constraint (ResourceConstraint) – The budget attached to the resource.

Example:

budget_released.send(sender=self.__class__, resource_constraint=self)
smarter.apps.account.signals.budget_warning = <django.dispatch.dispatcher.Signal object>

Signal sent when a resource’s spending reaches its budget’s warning threshold.

Sent once per billing period.

Parameters:
  • resource_constraint (ResourceConstraint) – The budget attached to the resource.

  • actual (Decimal) – The resource’s spending, in the budget’s unit.

  • limit (Decimal) – The limit whose threshold was reached.

Example:

budget_warning.send(sender=self.__class__, resource_constraint=self, actual=actual, limit=limit)
smarter.apps.account.signals.cache_invalidate = <django.dispatch.dispatcher.Signal object>

Signal sent to trigger cache invalidation.

Parameters:

None

Example:

cache_invalidate.send(sender=self.__class__)
smarter.apps.account.signals.charge_authorized = <django.dispatch.dispatcher.Signal object>

Signal sent when a charge is authorized.

Parameters:
  • record_locator (str) – The record locator associated with the charge.

  • charge (Charge) – The charge instance that has been authorized.

Example::

charge_authorized.send(sender=self.__class__, record_locator=self.record_locator, charge=self)

smarter.apps.account.signals.charge_declined = <django.dispatch.dispatcher.Signal object>

Signal sent when a charge is declined.

Parameters:
  • record_locator (str) – The record locator associated with the charge.

  • charge (Charge) – The charge instance that has been declined.

Example:

charge_declined.send(sender=self.__class__, record_locator=self.record_locator, charge=self)
smarter.apps.account.signals.new_charge_created = <django.dispatch.dispatcher.Signal object>

Signal sent when a new charge is created.

Parameters:

charge (Charge) – The newly created charge instance.

Example:

new_charge_created.send(sender=self.__class__, charge=self)
smarter.apps.account.signals.new_user_created = <django.dispatch.dispatcher.Signal object>

Signal sent when a new user is created.

Parameters:

user_profile (UserProfile) – The profile of the newly created user.

Example:

new_user_created.send(sender=self.__class__, user_profile=self)