1 | ## $Id: interfaces.py 17254 2022-12-30 09:25:50Z henrik $ |
---|
2 | ## |
---|
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 | ## |
---|
18 | |
---|
19 | import zope.i18nmessageid |
---|
20 | from zope import schema |
---|
21 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
22 | from waeup.kofa.interfaces import (SimpleKofaVocabulary, |
---|
23 | ISessionConfiguration, academic_sessions_vocab, IKofaObject, |
---|
24 | DisablePaymentGroupSource) |
---|
25 | |
---|
26 | _ = MessageFactory = zope.i18nmessageid.MessageFactory('kofacustom.lpng') |
---|
27 | |
---|
28 | class ICustomSessionConfiguration(IKofaObject): |
---|
29 | """A session configuration object. |
---|
30 | """ |
---|
31 | |
---|
32 | academic_session = schema.Choice( |
---|
33 | title = _(u'Session'), |
---|
34 | source = academic_sessions_vocab, |
---|
35 | default = None, |
---|
36 | required = True, |
---|
37 | readonly = True, |
---|
38 | ) |
---|
39 | |
---|
40 | payment_disabled = schema.List( |
---|
41 | title = _(u'Payment disabled'), |
---|
42 | value_type = schema.Choice( |
---|
43 | source = DisablePaymentGroupSource(), |
---|
44 | ), |
---|
45 | required = False, |
---|
46 | defaultFactory=list, |
---|
47 | ) |
---|
48 | |
---|
49 | def getSessionString(): |
---|
50 | """Return the session string from the vocabulary. |
---|
51 | """ |
---|
52 | |
---|
53 | interswitch_enabled = schema.Bool( |
---|
54 | title = _(u'Interswitch Collegepay integration enabled'), |
---|
55 | default = False, |
---|
56 | ) |
---|
57 | |
---|
58 | interswitch_paydirect_enabled = schema.Bool( |
---|
59 | title = _(u'Interswitch Paydirect integration enabled'), |
---|
60 | default = False, |
---|
61 | ) |
---|
62 | |
---|
63 | interswitch_webcheckout_enabled = schema.Bool( |
---|
64 | title = _(u'Interswitch WebCheckout integration enabled'), |
---|
65 | default = False, |
---|
66 | ) |
---|
67 | |
---|
68 | etranzact_webconnect_enabled = schema.Bool( |
---|
69 | title = _(u'Etranzact Webconnect integration enabled'), |
---|
70 | default = False, |
---|
71 | ) |
---|
72 | |
---|
73 | etranzact_payoutlet_enabled = schema.Bool( |
---|
74 | title = _(u'Etranzact Payoutlet integration enabled'), |
---|
75 | default = False, |
---|
76 | ) |
---|
77 | |
---|
78 | paypal_enabled = schema.Bool( |
---|
79 | title = _(u'Paypal integration enabled'), |
---|
80 | default = False, |
---|
81 | ) |
---|
82 | |
---|
83 | |
---|
84 | # Additional fees in custom package add here |
---|
85 | |
---|
86 | |
---|
87 | def getSessionString(): |
---|
88 | """Returns the session string from the vocabulary. |
---|
89 | """ |
---|
90 | |
---|
91 | |
---|
92 | class ICustomSessionConfigurationAdd(ICustomSessionConfiguration): |
---|
93 | """A session configuration object in add mode. |
---|
94 | """ |
---|
95 | |
---|
96 | academic_session = schema.Choice( |
---|
97 | title = _(u'Academic Session'), |
---|
98 | source = academic_sessions_vocab, |
---|
99 | default = None, |
---|
100 | required = True, |
---|
101 | readonly = False, |
---|
102 | ) |
---|
103 | |
---|
104 | ICustomSessionConfigurationAdd[ |
---|
105 | 'academic_session'].order = ICustomSessionConfiguration[ |
---|
106 | 'academic_session'].order |
---|