## $Id: payment.py 7627 2012-02-10 20:35:28Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """ These are the payment tickets. """ import grok from datetime import datetime from grok import index from waeup.sirp.payments.interfaces import ( IPayment, ISCPayment, IOnlinePayment, payment_states, payment_categories) from waeup.sirp.utils.helpers import attrs_to_fields class Payment(grok.Container): """This is a payment. """ grok.implements(IPayment) grok.provides(IPayment) grok.baseclass() def __init__(self): super(Payment, self).__init__() self.creation_date = datetime.now() self.p_id = None return @property def state(self): return payment_states.getTermByToken(self.p_state).title @property def category(self): return payment_categories.getTermByToken(self.p_category).title class SCPayment(Payment): """This is a scratch card payment. """ grok.implements(ISCPayment) grok.provides(ISCPayment) def __init__(self): super(SCPayment, self).__init__() p_id = None return SCPayment = attrs_to_fields(SCPayment) class OnlinePayment(Payment): """This is an online payment. """ grok.implements(IOnlinePayment) grok.provides(IOnlinePayment) def __init__(self): super(OnlinePayment, self).__init__() p_id = None return OnlinePayment = attrs_to_fields(OnlinePayment)