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.TextChoicesAn enumeration.
-
class
certego_saas.apps.payments.models.Customer(*args, **kwargs)[source] Bases:
django.db.models.base.ModelA wrapper class over
stripe-pythonSDK combined with django’sUsermodel that provides utilities for retrieving customer and their subscription details.-
exception
CustomerWithoutSubscription(appname: str, detail=None, code=None) Bases:
rest_framework.exceptions.APIExceptionRaised 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.AppSpecificModelEach
Customercan have maximumlen(AppChoices)number of relatedSubscriptionobjects; 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.SerializerUseful fields from
stripe.Invoice
throttling.py
-
class
certego_saas.apps.payments.throttling.SubscriptionRateThrottle[source] Bases:
rest_framework.throttling.BaseThrottleRestrict access if
User.stripe.monthly_submissions_limithas 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