source: main/waeup.kofa/branches/uli-async-update/src/waeup/kofa/payments/interfaces.py @ 10009

Last change on this file since 10009 was 9169, checked in by uli, 12 years ago

Merge changes from trunk, r8786-HEAD

  • Property svn:keywords set to Id
File size: 3.9 KB
RevLine 
[7195]1## $Id: interfaces.py 9169 2012-09-10 11:05:07Z uli $
[6861]2##
[7195]3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
[6969]18from zope.interface import Attribute
[6864]19from zope import schema
[8245]20from waeup.kofa.interfaces import (
21    IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab)
[7811]22from waeup.kofa.interfaces import MessageFactory as _
[6861]23
[7819]24payment_states = SimpleKofaVocabulary(
[7717]25    (_('Not yet paid'),'unpaid'),
26    (_('Paid'),'paid'),
27    (_('Failed'),'failed'),
[7627]28    )
29
[7819]30payment_categories = SimpleKofaVocabulary(
[7717]31    (_('School Fee'),'schoolfee'),
32    (_('Clearance'),'clearance'),
33    (_('Bed Allocation'),'bed_allocation'),
34    (_('Hostel Maintenance'),'hostel_maintenance'),
35    (_('Transfer'),'transfer'),
36    (_('Gown'),'gown'),
[8260]37    (_('Application Fee'), 'application'),
[7627]38    )
39
[7819]40class IPaymentsContainer(IKofaObject):
[6861]41    """A container for all kind of payment objects.
42
43    """
[6864]44
[7819]45class IPayment(IKofaObject):
[6864]46    """A base representation of payments.
47
48    """
[6869]49    p_id = Attribute('Payment identifier.')
[6864]50
51    p_category = schema.Choice(
[7717]52        title = _(u'Payment Category'),
[6865]53        default = u'schoolfee',
[6864]54        vocabulary = payment_categories,
55        required = True,
56        )
57
58    p_item = schema.TextLine(
[7717]59        title = _(u'Payment Item'),
[6869]60        default = None,
[6864]61        required = False,
62        )
63
[8245]64    p_session = schema.Choice(
65        title = _(u'Payment Session'),
66        source = academic_sessions_vocab,
67        required = False,
68        )
69
[7020]70    p_state = schema.Choice(
[7717]71        title = _(u'Payment State'),
[7020]72        default = u'unpaid',
73        vocabulary = payment_states,
74        required = True,
75        )
76
[8170]77    creation_date = schema.Datetime(
[7717]78        title = _(u'Ticket Creation Date'),
[7623]79        readonly = False,
[9169]80        required = False,
[6864]81        )
82
[8170]83    payment_date = schema.Datetime(
[7717]84        title = _(u'Payment Date'),
[6869]85        required = False,
[6934]86        readonly = False,
[6864]87        )
88
[7927]89    amount_auth = schema.Float(
[7717]90        title = _(u'Amount Authorized'),
[7927]91        default = 0.0,
[6864]92        required = True,
[7931]93        readonly = False,
[6864]94        )
95
96class ISCPayment(IPayment):
97    """A scratch card payment.
98
99    """
100
101    p_code = schema.TextLine(
[7717]102        title = _(u'Payment Access Code'),
103        #default = u'Certificate XYZ',
[6864]104        required = False,
[6869]105        readonly = True,
[6864]106        )
107
108class IOnlinePayment(IPayment):
109    """A payment via payment gateways.
110
111    """
112
[6930]113    ac = schema.TextLine(
[7717]114        title = _(u'Activation Code'),
[6930]115        default = None,
116        required = False,
117        readonly = False,
118        )
119
[7927]120    r_amount_approved = schema.Float(
[7717]121        title = _(u'Response Amount Approved'),
[7927]122        default = 0.0,
[6864]123        required = False,
[6930]124        readonly = False,
[6864]125        )
126
127    r_code = schema.TextLine(
[7717]128        title = _(u'Response Code'),
[6864]129        default = None,
[6869]130        required = False,
[6930]131        readonly = False,
[6864]132        )
[8420]133
[8429]134    r_desc = schema.TextLine(
135        title = _(u'Response Description'),
136        default = None,
137        required = False,
138        readonly = False,
139        )
140
[8420]141    def approve():
142        "Approve an online payment and set to paid."
[8703]143
144class IPaymentWebservice(IKofaObject):
145    """An interface for a webservice.
146
147    """
148
[8708]149    def display_fullname():
150        "Name of  payee."
151
152    def id():
153        "Id of payee"
154
155    def faculty():
156        "Faculty of payee"
157
158    def department():
159        "Department of payee"
Note: See TracBrowser for help on using the repository browser.