debits.debits_base package¶
Submodules¶
debits.debits_base.base module¶
-
class
debits.debits_base.base.
Period
(unit=None, count=None)[source]¶ Bases:
composite_field.base.CompositeField
Period (for example of recurring payment or of a trial subscription).
It may be expressed in days, weeks, months, or years. Several units cannot be mixed: for example, it cannot be 2 months and 13 days.
-
UNIT_DAYS
= 1¶
-
UNIT_MONTHS
= 3¶
-
UNIT_WEEKS
= 2¶
-
UNIT_YEARS
= 4¶
-
count
= None¶ The number of the units
-
period_choices
= ((1, 'days'), (2, 'weeks'), (3, 'months'), (4, 'years'))¶ For Django
ChoiceField
.
-
subfields
= {'count': <django.db.models.fields.SmallIntegerField>, 'unit': <django.db.models.fields.SmallIntegerField>}¶
-
unit
= None¶ days, weeks, months, or years.
-
-
debits.debits_base.base.
logger
= <Logger debits (WARNING)>¶ The logger used by Debits.
debits.debits_base.models module¶
-
class
debits.debits_base.models.
AggregateItem
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.SimpleItem
Several payments in one.
TODO: Not tested!
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
simpleitem_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.
-
simpleitem_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
AggregatePurchase
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.SimplePurchase
Several payments in one.
TODO: Not tested!
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
childs
¶ 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.
-
is_aggregate
¶
-
simplepurchase_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.
-
simplepurchase_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
AutomaticPayment
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.Payment
Automatic (recurring) payment.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
payment_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.
-
payment_ptr_id
¶
-
processor
¶ Payment processor.
-
processor_id
¶
-
subscription_reference
¶ As recurring_payment_id in PayPal.
TODO: Avangate has it for every product, but PayPal for transaction as a whole.
-
exception
-
class
debits.debits_base.models.
BaseTransaction
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A redirect (or other query) to the payment processor.
It may be paid or (not yet) paid.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
creation_date
¶ Date of the redirect.
-
static
custom_from_pk
(pk)[source]¶ Secret code of a transaction.
Secret can be known only to one who created a BaseTransaction. This prevents third parties to make fake IPNs from a payment processor.
- Args:
- pk: the serial primary key (of
BaseTransaction
) used to calculate the secret transaction code. - Returns:
- A secret string.
-
get_next_by_creation_date
(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)¶
-
get_previous_by_creation_date
(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
invoice_id
()[source]¶ Invoice ID.
Used internally to prevent more than one payment for the same transaction.
-
objects
= <django.db.models.manager.Manager object>¶
-
payment
¶ 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.
-
static
pk_from_custom
(custom)[source]¶ Restore the
BaseTransaction
primary key from the secret “custom”.Raises
BaseTransaction.DoesNotExist
if the custom is wrong.- Args:
- custom: A secret string.
- Returns:
- The primary key for
BaseTransaction
.
-
processor
¶ Payment processor.
-
processor_id
¶
-
purchase
¶ The stuff sold by this transaction.
-
purchase_id
¶
-
simpletransaction
¶ 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.
-
subinvoice
()[source]¶ Subinvoice ID.
Used internally to prevent more than one payment for the same transaction.
-
subscriptiontransaction
¶ 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.
-
exception
-
exception
debits.debits_base.models.
CannotCancelSubscription
[source]¶ Bases:
Exception
Canceling subscription failed.
-
exception
debits.debits_base.models.
CannotRefund
[source]¶ Bases:
Exception
Refunding payment failed.
-
class
debits.debits_base.models.
Item
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Anything sold or rent.
Apps using this package should create their product records manually. Then you create an instance of a subclass of this class before allowing the user to make a transaction.
In a future we may provide an interface for registering new products.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
currency
¶ The currency for which this is sold.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
price
¶ Price of the item.
For recurring payment it is the amount of one payment.
-
product
¶ The sold product.
-
product_id
¶
-
product_qty
¶ Quantity of the sold product (often 1).
-
purchase_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.
-
simpleitem
¶ 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.
-
subscriptionitem
¶ 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.
-
exception
-
class
debits.debits_base.models.
ModelRef
(prefix=None, default=None, verbose_name=None)[source]¶ Bases:
composite_field.base.CompositeField
Reference to a Django model
-
app_label
= None¶ Django app with the model.
-
model
= None¶ The model class name.
-
subfields
= {'app_label': <django.db.models.fields.CharField>, 'model': <django.db.models.fields.CharField>}¶
-
-
class
debits.debits_base.models.
Payment
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Base class describing a particular payment.
It generated by our IPN handler.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
automaticpayment
¶ 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.
-
email
¶ User’s email.
DalPay requires to notify the customer 10 days before every payment.
-
get_next_by_payment_time
(*, field=<django.db.models.fields.DateTimeField: payment_time>, is_next=True, **kwargs)¶
-
get_previous_by_payment_time
(*, field=<django.db.models.fields.DateTimeField: payment_time>, is_next=False, **kwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
payment_time
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
purchase
¶ 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.
-
simplepayment
¶ 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.
-
transaction
¶ The transaction we accepted.
-
transaction_id
¶
-
exception
-
class
debits.debits_base.models.
PaymentProcessor
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Payment processor (such as PayPal, DalPay, etc.)
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
automaticpayment_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.
-
basetransaction_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.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
klass
¶ The Django model which handles API for payments and similar stuff.
-
klass_app_label
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
klass_model
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
name
¶ The name of the payment processing company or service.
-
objects
= <django.db.models.manager.Manager object>¶
-
subscriptionpurchase_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.
-
url
¶ The site of the payment processor.
-
exception
-
class
debits.debits_base.models.
Product
(id, name)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
item_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
¶ Product name.
-
objects
= <django.db.models.manager.Manager object>¶
-
pricingplan_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.
-
exception
-
class
debits.debits_base.models.
ProlongPurchase
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.SimplePurchase
Prolong
prolonged
item.This is meant to be a one-time payment which prolongs a manual subscription item.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
period
¶ The amount of days (or weeks, months, etc.) how much to prolong.
-
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.
-
prolonged
¶ Which subscription item to prolong.
-
prolonged_id
¶
-
refund_payment
()[source]¶ Handle payment refund.
For
ProlongPurchase
we subtract the prolong days back from theparent
item.
-
simplepurchase_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.
-
simplepurchase_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
Purchase
(id, item, parent, creation_date, payment, blocked, gratis, shipping, tax, reminders_sent, old_subscription)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
blocked
¶ A hacker or misbehavior detected.
-
creation_date
¶ Date of item creation.
-
do_upgrade_subscription
()[source]¶ Internal.
TODO: Remove ALL old subscriptions as in payment_system2.
-
get_next_by_creation_date
(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)¶
-
get_previous_by_creation_date
(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)¶
-
gratis
¶ Provide a product or service for free.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
is_aggregate
¶
-
item
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
item_id
¶
-
new_subscription
¶ 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.
-
objects
= <django.db.models.manager.Manager object>¶
-
old_subscription
¶ We remove old_subscription (if not None) automatically when new subscription is created.
The new payment may be either one-time (
SimpleItem
(usuallyProlongPurchase
)) or subscription (SubscriptionItem
).
-
old_subscription_id
¶
-
parent
¶ This purchase is a part of a composite purchase.
-
parent_id
¶
-
payment
¶ Payment accomplished for this item or None.
-
payment_id
¶
-
reminders_sent
¶ Email (or SMS, etc.) payment reminders sent state.
- 0 - no reminder sent
- 1 - before due payment sent
- 2 - at due payment sent
- 3 - day before deadline sent
TODO: Move to
SubscriptionPurchase
?
-
shipping
¶ Price of shipping.
Remain zero if doubt.
-
simplepurchase
¶ 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.
-
subscriptionpurchase
¶ 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.
-
tax
¶ Tax for the sale.
Remain zero if doubt.
-
transactions
¶ 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.
-
exception
-
class
debits.debits_base.models.
SimpleItem
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.Item
Non-subscription item.
To sell a non-subscription item, create a subclass of this model, describing your sold good.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
aggregateitem
¶ 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.
-
item_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.
-
item_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
SimplePayment
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.Payment
Non-recurring payment.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
payment_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.
-
payment_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
SimplePaymentStatus
[source]¶ Bases:
object
-
NOT_PAID
= 1¶
-
PAID
= 2¶
-
REFUNDED
= 3¶
-
-
class
debits.debits_base.models.
SimplePurchase
(id, item, parent, creation_date, payment, blocked, gratis, shipping, tax, reminders_sent, old_subscription, purchase_ptr, status)[source]¶ Bases:
debits.debits_base.models.Purchase
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
aggregatepurchase
¶ 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.
-
paid
¶ It was paid by the user (and not refunded).
-
prolongpurchase
¶ 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.
-
purchase_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.
-
purchase_ptr_id
¶
-
status
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
debits.debits_base.models.
SimpleTransaction
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.BaseTransaction
A one-time (non-recurring) transaction.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
advance_parent
(prolongpurchase, payment)[source]¶ Advances the parent transaction on receive of a “prolong” payment.
- Args:
- prolongpurchase:
ProlongPurchase
.
prolongitem.period contains the number of days to advance the parent (
SubscriptionItem
) item. The parent transaction is advanced this number of days.
-
basetransaction_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.
-
basetransaction_ptr_id
¶
-
exception
-
class
debits.debits_base.models.
SubscriptionItem
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.Item
Subscription (recurring) item.
To sell a subscription item, create a subclass of this model, describing your sold service.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
grace_period
¶ How much
payment_deadline
is abovedue_payment_data
.
-
grace_period_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
grace_period_unit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
item_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.
-
item_ptr_id
¶
-
payment_period
¶ How often to pay (for automatic recurring payments).
-
payment_period_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
payment_period_unit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
trial_period
¶ Trial period.
It may be zero.
-
trial_period_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
trial_period_unit
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
debits.debits_base.models.
SubscriptionPurchase
(id, item, parent, creation_date, payment, blocked, gratis, shipping, tax, reminders_sent, old_subscription, purchase_ptr, due_payment_date, payment_deadline, trial, subinvoice, subscription_reference, processor, email)[source]¶ Bases:
debits.debits_base.models.Purchase
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
activate_subscription
(ref, email, processor)[source]¶ Internal.
“Competes” with
on_accept_regular_payment()
.
-
child
¶ 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.
-
due_payment_date
¶ The reference payment date.
-
email
¶ User’s email.
DalPay requires to notify the customer 10 days before every payment.
-
get_next_by_due_payment_date
(*, field=<django.db.models.fields.DateField: due_payment_date>, is_next=True, **kwargs)¶
-
get_previous_by_due_payment_date
(*, field=<django.db.models.fields.DateField: due_payment_date>, is_next=False, **kwargs)¶
-
is_active
()[source]¶ Is the item active (paid on time and not blocked).
Usually you should use quick_is_active() instead because that is faster.
-
mypurchase
¶ 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.
-
payment_deadline
¶ The dealine payment date.
After it is reached, the item is considered inactive.
-
processor
¶ Payment processor for a subscription payment.
-
processor_id
¶
-
purchase_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.
-
purchase_ptr_id
¶
-
static
quick_is_active
(item_id)[source]¶ Is the item with given PK active (paid on time and not blocked).
Usually you should use quick_is_active() instead because that is faster.
-
set_payment_date
(date)[source]¶ Sets both
due_payment_date
andpayment_deadline
.
-
start_trial
()[source]¶ Start trial period.
This should be called after setting non-zero
trial_period
.
-
subinvoice
¶ Internal.
-
subscribed
¶ Is in automatic (not manual) recurring mode.
-
subscription_reference
¶ As recurring_payment_id in PayPal.
TODO: Avangate has it for every product, but PayPal for transaction as a whole.
-
trial
¶ Now in trial period.
-
exception
-
class
debits.debits_base.models.
SubscriptionTransaction
(*args, **kwargs)[source]¶ Bases:
debits.debits_base.models.BaseTransaction
A transaction for a subscription service.
-
exception
DoesNotExist
¶ Bases:
debits.debits_base.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
debits.debits_base.models.MultipleObjectsReturned
-
basetransaction_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.
-
basetransaction_ptr_id
¶
-
exception
debits.debits_base.processors module¶
-
class
debits.debits_base.processors.
BasePaymentProcessor
[source]¶ Bases:
abc.ABC
Executing a transaction for a particular payment processor (by a derived class).
We receive a derivative of
BaseTransaction
object and a hash (see for example PayPay documentation) from user.Then the hash is amended (for example added the price from the transaction object) and passed to the payment processor.
-
change_subscription
(transaction, hash)[source]¶ Start the process of changing a subscription with given hash and transaction.
-
change_subscription_from_form
(hash)[source]¶ Start the process of changing a subscription with hash received from a HTML form and transaction.
-
make_purchase
(hash, transaction)[source]¶ Start the process of purchase with given hash and transaction.
-
make_purchase_from_form
(hash, transaction)[source]¶ Start the process of purchase with hash received from a HTML form and transaction.
-
ready_for_subscription
(transaction)[source]¶ Check if ready for subscription.
If we are in manual recurring mode, we can be not ready for subscription, because some payment processors (PayPal) don’t allow to delay the first payment of a subscription for more than
self.subscription_allowed_date()
days.
-
-
class
debits.debits_base.processors.
PaymentCallback
[source]¶ Bases:
object
Mixin this class to make callbacks on a payment.
In current implementation,
on_subscription_created()
may be called when it was already started andon_subscription_canceled()
may be called when it is already stopped. (In other words, they can be called multiple times in a row.)
Internal.