payments (certego_saas.apps.payments
)
admin.py
cache.py
consts.py
exceptions.py
-
exception
certego_saas.apps.payments.exceptions.
CustomerCantSubmitMultipleProfilesException
(detail=None, code=None)[source] Bases:
rest_framework.exceptions.PermissionDenied
models.py
-
class
certego_saas.apps.payments.models.
AppChoices
(value)[source] Bases:
django.db.models.enums.TextChoices
An enumeration.
-
class
certego_saas.apps.payments.models.
Customer
(*args, **kwargs)[source] Bases:
django.db.models.base.Model
A wrapper class over
stripe-python
SDK combined with django’sUser
model that provides utilities for retrieving customer and their subscription details.-
exception
CustomerWithoutSubscription
(appname: str, detail=None, code=None) Bases:
rest_framework.exceptions.APIException
Raised when a given user/customer has no active subscription on stripe.
-
create_billing_portal_session
(return_url) → stripe.api_resources.billing_portal.session.Session[source] uses :meth:
stripe.billing_portal.Session.create
.
-
exception
-
class
certego_saas.apps.payments.models.
Subscription
(*args, **kwargs)[source] Bases:
certego_saas.ext.models.AppSpecificModel
Each
Customer
can have maximumlen(AppChoices)
number of relatedSubscription
objects; one subscription for each app name (i.e. DRAGONFLY, INTELOWL, etc.).-
property
can_submit_private
metadata.submission_type == "private"
-
property
concurrent_profiles
metadata.max_submissions
-
get_subscription
(expand=None) → stripe.api_resources.subscription.Subscription[source] Returns customer’s active subscription.
(uses :meth:
stripe.Subscription.retrieve()
-
property
monthly_submissions_limit
metadata.max_submissions
-
property
priority
metadata.priority
-
property
permissions.py
serializers.py
-
class
certego_saas.apps.payments.serializers.
InvoiceSerializer
(*args, **kwargs)[source] Bases:
rest_framework.serializers.Serializer
Useful fields from
stripe.Invoice
throttling.py
-
class
certego_saas.apps.payments.throttling.
SubscriptionRateThrottle
[source] Bases:
rest_framework.throttling.BaseThrottle
Restrict access if
User.stripe.monthly_submissions_limit
has been exhausted.
utils.py
-
certego_saas.apps.payments.utils.
get_default_product
() → dict[source] returns default product based on whether stripe is running in livemode or testmode