Module Import alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword NameLoad keyword NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore Dict If NameLoad body Assign SubscriptStore NameLoad Index Str BinOpAdd Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr keyword NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad Call AttributeLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword NameLoad attr BinOpBitOr Call NameLoad keyword NameLoad Call NameLoad keyword Call AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return CompareGt AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return CompareIn AttributeLoad NameLoad attr ListLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot Call NameLoad NameLoad body Return NameLoad If BoolOpAnd AttributeLoad NameLoad attr UnaryOpNot Call NameLoad NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot NameLoad body Return TryExcept body Return Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body If CompareEq Call AttributeLoad Call NameLoad NameLoad attr Str Num body Raise decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str keyword Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str keyword Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str keyword Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str keyword Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword SubscriptLoad SubscriptLoad NameLoad Index Str Index Str keyword SubscriptLoad NameLoad Index Str keyword Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword IfExp SubscriptLoad NameLoad Index Str Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str NameLoad keyword IfExp SubscriptLoad NameLoad Index Str Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword SubscriptLoad NameLoad Index Str keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore AttributeLoad NameLoad attr If NameLoad body Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad NameLoad decorator_list
N/A N/A datetime django.db.models Q django.utils timezone django.utils.encoding smart_str N/A stripe N/A hooks N/A models N/A utils cancel N/A N/A subscription at_period_end N/A True N/A N/A 
    Cancels a subscription

    Args:
        subscription: the subscription to cancel
        at_period_end: True, to cancel at the end, otherwise immediately cancel
     N/A sub N/A N/A N/A subscription stripe_subscription delete at_period_end at_period_end N/A N/A sync_subscription_from_stripe_data N/A subscription customer sub N/A create N/A N/A customer plan quantity trial_days token coupon N/A None None None None N/A N/A 
    Creates a subscription for the given customer

    Args:
        customer: the customer to create the subscription for
        plan: the plan to subscribe to
        quantity: if provided, the number to subscribe to
        trial_days: if provided, the number of days to trial before starting
        token: if provided, a token from Stripe.js that will be used as the
               payment source for the subscription and set as the default
               source for the customer, otherwise the current default source
               will be used
        coupon: if provided, a coupon to apply towards the subscription

    Returns:
        the data representing the subscription object that was created
     N/A quantity N/A N/A N/A hooks hookset adjust_subscription_quantity customer customer plan plan quantity quantity N/A cu N/A customer stripe_customer N/A subscription_params N/A N/A trial_days N/A N/A N/A subscription_params N/A trial_end N/A N/A N/A N/A datetime datetime utcnow N/A N/A datetime timedelta days trial_days N/A token N/A N/A N/A subscription_params N/A source token N/A N/A subscription_params N/A plan plan N/A N/A subscription_params N/A quantity quantity N/A N/A subscription_params N/A coupon coupon N/A resp N/A N/A N/A cu subscriptions create subscription_params N/A resp N/A has_active_subscription N/A N/A customer N/A N/A N/A 
    Checks if the given customer has an active subscription

    Args:
        customer: the customer to check

    Returns:
        True, if there is an active subscription, otherwise False
     N/A N/A N/A N/A N/A N/A N/A N/A N/A models Subscription objects filter customer customer filter N/A N/A Q ended_at__isnull True N/A Q ended_at__gt N/A N/A timezone now exists N/A is_period_current N/A N/A subscription N/A N/A N/A 
    Tests if the provided subscription object for the current period

    Args:
        subscription: a pinax.stripe.models.Subscription object to test
     N/A N/A N/A subscription current_period_end N/A N/A timezone now N/A is_status_current N/A N/A subscription N/A N/A N/A 
    Tests if the provided subscription object has a status that means current

    Args:
        subscription: a pinax.stripe.models.Subscription object to test
     N/A N/A N/A subscription status N/A trialing active N/A is_valid N/A N/A subscription N/A N/A N/A 
    Tests if the provided subscription object is valid

    Args:
        subscription: a pinax.stripe.models.Subscription object to test
     N/A N/A N/A is_status_current subscription N/A N/A False N/A N/A N/A subscription cancel_at_period_end N/A N/A is_period_current subscription N/A N/A False N/A True N/A retrieve N/A N/A customer sub_id N/A N/A N/A 
    Retrieve a subscription object from Stripe's API

    Stripe throws an exception if a subscription has been deleted that we are
    attempting to sync. In this case we want to just silently ignore that
    exception but pass on any other.

    Args:
        customer: the customer who's subscription you are trying to retrieve
        sub_id: the Stripe ID of the subscription you are fetching

    Returns:
        the data for a subscription object from the Stripe API
     N/A N/A sub_id N/A N/A N/A N/A N/A N/A N/A N/A N/A customer stripe_customer subscriptions retrieve sub_id N/A N/A N/A N/A stripe InvalidRequestError N/A e N/A N/A N/A N/A N/A N/A smart_str e find does not have a subscription with ID -1 N/A N/A N/A sync_subscription_from_stripe_data N/A N/A customer subscription N/A N/A N/A 
    Syncronizes data from the Stripe API for a subscription

    Args:
        customer: the customer who's subscription you are syncronizing
        subscription: data from the Stripe API representing a subscription

    Returns:
        the pinax.stripe.models.Subscription object created or updated
     N/A defaults N/A dict customer customer application_fee_percent N/A subscription N/A application_fee_percent cancel_at_period_end N/A subscription N/A cancel_at_period_end canceled_at N/A N/A utils convert_tstamp N/A subscription N/A canceled_at current_period_start N/A N/A utils convert_tstamp N/A subscription N/A current_period_start current_period_end N/A N/A utils convert_tstamp N/A subscription N/A current_period_end ended_at N/A N/A utils convert_tstamp N/A subscription N/A ended_at plan N/A N/A N/A N/A models Plan objects get stripe_id N/A N/A subscription N/A plan N/A id quantity N/A subscription N/A quantity start N/A N/A utils convert_tstamp N/A subscription N/A start status N/A subscription N/A status trial_start N/A N/A subscription N/A trial_start N/A N/A utils convert_tstamp N/A subscription N/A trial_start None trial_end N/A N/A subscription N/A trial_end N/A N/A utils convert_tstamp N/A subscription N/A trial_end None N/A N/A sub created N/A N/A N/A N/A models Subscription objects get_or_create stripe_id N/A subscription N/A id defaults defaults N/A sub N/A N/A utils update_with_defaults sub defaults created N/A sub N/A update N/A N/A subscription plan quantity prorate coupon charge_immediately N/A None None True None False N/A N/A 
    Updates a subscription

    Args:
        subscription: the subscription to update
        plan: optionally, the plan to change the subscription to
        quantity: optionally, the quantiy of the subscription to change
        prorate: optionally, if the subscription should be prorated or not
        coupon: optionally, a coupon to apply to the subscription
        charge_immediately: optionally, whether or not to charge immediately
     N/A stripe_subscription N/A subscription stripe_subscription N/A plan N/A N/A N/A stripe_subscription plan plan N/A quantity N/A N/A N/A stripe_subscription quantity quantity N/A N/A prorate N/A N/A N/A stripe_subscription prorate False N/A coupon N/A N/A N/A stripe_subscription coupon coupon N/A sub N/A N/A stripe_subscription save N/A customer N/A N/A N/A N/A models Customer objects get pk N/A N/A subscription customer pk N/A N/A sync_subscription_from_stripe_data customer sub N/A