debits.debits_test package¶
Submodules¶
debits.debits_test.business module¶
-
debits.debits_test.business.
create_organization
(name, pricing_plan_id, trial_months)[source]¶ Creates a new example organization.
It also associates a
MyPurchase
with it.
debits.debits_test.callbacks module¶
-
class
debits.debits_test.callbacks.
MyPayPalIPN
(**kwargs)[source]¶ Bases:
debits.paypal.views.PayPalIPN
Mixin to handle purchase events.
Two subscription IPNs may call both
on_subscription_created()
andon_payment()
. It is not a problem (if not to count a tiny performance lag).TODO: Generalize it for non PayPal processors.
-
do_purchase
(purchase)[source]¶ Set the
MyPurchase
for anOrganization
.
-
debits.debits_test.forms module¶
-
class
debits.debits_test.forms.
CreateOrganizationForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
Django form to create a new example organization.
-
base_fields
= {'name': <django.forms.fields.CharField object>, 'pricing_plan': <django.forms.models.ModelChoiceField object>, 'use_trial': <django.forms.fields.BooleanField object>}¶
-
declared_fields
= {'name': <django.forms.fields.CharField object>, 'pricing_plan': <django.forms.models.ModelChoiceField object>, 'use_trial': <django.forms.fields.BooleanField object>}¶
-
media
¶
-
-
class
debits.debits_test.forms.
SwitchPricingPlanForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
Django form to switch pricing plan.
-
base_fields
= {'pricing_plan': <django.forms.models.ModelChoiceField object>}¶
-
declared_fields
= {'pricing_plan': <django.forms.models.ModelChoiceField object>}¶
-
media
¶
-
debits.debits_test.models module¶
-
class
debits.debits_test.models.
MyPurchase
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.SubscriptionPurchase
An example purchase.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
for_organization
¶ The organization for which the purchase was initiated.
Don’t mess
for_organization
withorganization
!
-
for_organization_id
¶
-
organization
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
plan
¶ The pricing plan for the purchase.
-
plan_id
¶
-
subscriptionpurchase_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
subscriptionpurchase_ptr_id
¶
-
exception
-
class
debits.debits_test.models.
Organization
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
An example organization.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
for_purchase
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
name
¶ Organization name.
-
objects
= <django.db.models.manager.Manager object>¶
-
purchase
¶ The current active
MyPurchase
for the organization.
-
purchase_id
¶
-
exception
-
class
debits.debits_test.models.
PricingPlan
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Pricing plan (like “Item 1”, $10/month).
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
currency
¶ The currency of payments.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
mypurchase_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
name
¶ Pricing plan name.
-
objects
= <django.db.models.manager.Manager object>¶
-
period
¶ Recurring payments period.
-
period_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
period_unit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
price
¶ The price of each recurring payment.
-
product
¶ Sold product.
-
product_id
¶
-
exception
debits.debits_test.processors module¶
debits.debits_test.products module¶
debits.debits_test.test_settings module¶
debits.debits_test.urls module¶
debits.debits_test.views module¶
-
debits.debits_test.views.
create_organization_view
(request)[source]¶ The view to create an example organization.
-
debits.debits_test.views.
do_organization_payment_view
(request, purchase, organization)[source]¶ The common pars of views for
transaction_payment_view()
andorganization_payment_view()
.
-
debits.debits_test.views.
do_prolong
(hash, form, processor, purchase)[source]¶ Start prolonging our subscription purchase.
-
debits.debits_test.views.
do_subscribe
(hash, form, processor, purchase)[source]¶ Start subscription to our subscription purchase.
-
debits.debits_test.views.
do_upgrade
(hash, form, processor, purchase, organization)[source]¶ Start upgrading a subscription purchase,
-
debits.debits_test.views.
get_processor
(request, hash)[source]¶ Determine the payment processor, from a form.
-
debits.debits_test.views.
list_organizations_view
(request)[source]¶ Django view to list all the organizations.
-
debits.debits_test.views.
organization_payment_view
(request, organization_id)[source]¶ A view initiated for an organization.
-
debits.debits_test.views.
purchase_view
(request)[source]¶ The main test view to make purchases, subscriptions, upgrades.
-
debits.debits_test.views.
transaction_payment_view
(request, transaction_id)[source]¶ A view initiated from a transaction.
-
debits.debits_test.views.
unsubscribe_organization_view
(request, organization_pk)[source]¶ Django view for the “Unsubscribe” button.
debits.debits_test.wsgi module¶
WSGI config for django-debits project.
It exposes the WSGI callable as a module-level variable named application
.
For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/