Class s.d.p.m.PaymentMethod(Domain):

Part of stoqlib.domain.payment.method View In Hierarchy

A PaymentMethod controls how a payments is paid. Example of payment methods are: money, bill, check and credit card. This class consists of the persistent part of a payment method. The logic itself for the various different methods are in the PaymentMethodOperation classes. Each PaymentMethod has a PaymentMethodOperation associated.
Instance Variablesname
description
is_active
daily_penalty
interesta value for the interest. It must always be in the format: 0 <= interest <= 100
payment_daywhich day in the month is the credit provider going to pay the store? Usually they pay in the same day every month.
closing_daywhich day the credit provider stoq counting sales to pay in the payment_day? Sales after this day will be paid only in the next month.
destinationthe payment destination or None
Method inactivate Undocumented
Method activate Undocumented
Method get_status_string Undocumented
Method get_description Undocumented
Method operation Get the operation for this method.
Method _check_installments_number Undocumented
Method _check_interest_value Undocumented
Method _calculate_payment_value Undocumented
Method create_payment Creates a new payment according to a payment method interface
Method create_payments Creates new payments according to a payment method interface.
Method describe_payment Returns a string describing payment, in the following
Method create_inpayment Creates a new inpayment
Method create_outpayment Creates a new outpayment
Method create_inpayments Creates a list of new inpayments, the values of the individual
Method create_outpayments Creates a list of new outpayments, the values of the individual
Class Method get_active_methods Returns a list of payment method interfaces tied with the
Class Method get_by_name Returns the Payment method associated by the nmae
Method selectable Finds out if the method is selectable, eg

Inherited from Domain:

Method __init__ Undocumented
Method _create Undocumented
Method user Undocumented
Class Method iselect Like select, but search on the adapter implementing the interface iface
Class Method iselectBy Like selectBy, but search on the adapter implementing the interface iface
Class Method iselectOne Like selectOne, but search on the adapter implementing the interface iface
Class Method iselectOneBy Like selectOneBy, but search on the adapter implementing the interface iface
Class Method iget Like get, but gets on the adapter implementing the interface iface

Inherited from AbstractModel (via Domain, BaseDomain):

Method __ne__ Undocumented
Method __eq__ Undocumented
Method _SO_setValue Undocumented
Method clone Get a persistent copy of an existent object. Remember that we can
Method get_connection Undocumented

Inherited from AdaptableORMObject (via Domain):

Class Method registerFacet Registers a facet for class cls.

Inherited from Adaptable (via Domain, AdaptableORMObject):

Class Method getFacetType Fetches a facet type associated with an interface, or raise
Class Method getFacetTypes Returns facet classes for this object
Method addFacet Adds a facet implementing iface for the current object
Method removeFacet Removes a facet from the current object
Method getFacets Gets a list of facets assoicated with the current object.
def inactivate(self):
Undocumented
def activate(self):
Undocumented
def get_status_string(self):
Undocumented
def get_description(self):
Undocumented
@property
def operation(self):
Get the operation for this method. The operation contains method specific logic when creating/deleting a payment.
Returnsthe operation associated with the method (type: object implementing IPaymentOperation )
def _check_installments_number(self, installments_number, maximum=None):
Undocumented
def _check_interest_value(self, interest):
Undocumented
def _calculate_payment_value(self, total_value, installments_number, iface, interest=None):
Undocumented
@argcheck(object, PaymentGroup, Decimal, datetime.datetime, basestring, basestring, Till)
def create_payment(self, iface, payment_group, value, due_date=None, description=None, base_value=None, till=None):
Creates a new payment according to a payment method interface
Parametersifacea payment method interface eg IOutPayment or IInPayment
payment_groupa PaymentGroup subclass
valuevalue of payment
due_dateoptional, due date of payment
detailsoptional
descriptionoptional, description of the payment
base_valueoptional
tilloptional
Returnsa PaymentAdaptToOutPayment or PaymentAdaptToInPayment
@argcheck(object, PaymentGroup, Decimal, object)
def create_payments(self, iface, group, value, due_dates):
Creates new payments according to a payment method interface. The values of the individual payments are calculated by taking the value and dividing it by the number of payments. The number of payments is determined by the length of the due_dates sequence.
Parametersifacea payment method interface eg IOutPayment or IInPayment
payment_groupa PaymentGroup subclass
valuevalue of payment
due_datesa list of datetime objects
Returnsa list of PaymentAdaptToOutPayment or PaymentAdaptToInPayment
def describe_payment(self, payment_group, installment=1, installments=1):
Returns a string describing payment, in the following format: current_installment/total_of_installments payment_description for payment_group_description
Parameterspayment_groupa PaymentGroup
installmentcurrent installment
installmentstotal installments
Returnsa payment description
@argcheck(PaymentGroup, Decimal, datetime.datetime, basestring, Decimal, Till)
def create_inpayment(self, payment_group, value, due_date=None, description=None, base_value=None, till=None):
Creates a new inpayment
Parameterspayment_groupa PaymentGroup subclass
valuevalue of payment
due_dateoptional, due date of payment
descriptionoptional, description of the payment
base_valueoptional
tilloptional
Returnsa PaymentAdaptToInPayment
@argcheck(PaymentGroup, Decimal, datetime.datetime, basestring, Decimal, Till)
def create_outpayment(self, payment_group, value, due_date=None, description=None, base_value=None, till=None):
Creates a new outpayment
Parameterspayment_groupa PaymentGroup subclass
valuevalue of payment
due_dateoptional, due date of payment
descriptionoptional, description of the payment
base_valueoptional
tilloptional
Returnsa PaymentAdaptToOutPayment
@argcheck(PaymentGroup, Decimal, object)
def create_inpayments(self, payment_group, value, due_dates):
Creates a list of new inpayments, the values of the individual payments are calculated by taking the value and dividing it by the number of payments. The number of payments is determined by the length of the due_dates sequence.
Parameterspayment_groupa PaymentGroup subclass
valuetotal value of all payments
due_datesa list of datetime objects
Returnsa list of PaymentAdaptToInPayment
@argcheck(PaymentGroup, Decimal, object)
def create_outpayments(self, payment_group, value, due_dates):
Creates a list of new outpayments, the values of the individual payments are calculated by taking the value and dividing it by the number of payments. The number of payments is determined by the length of the due_dates sequence.
Parameterspayment_groupa PaymentGroup subclass
valuetotal value of all payments
due_datesa list of datetime objects
Returnsa list of PaymentAdaptToOutPayment
@classmethod
def get_active_methods(cls, conn):
Returns a list of payment method interfaces tied with the active payment methods
@classmethod
def get_by_name(cls, conn, name):
Returns the Payment method associated by the nmae
Parametersnamename of a payment method
Returnsthe payment method class (type: PaymentMethod instance )
def selectable(self):
Finds out if the method is selectable, eg if the user can select it when doing a sale.
ReturnsTrue if selectable, otherwise False
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.