source: WAeUP_SRP/branches/regebro-noskins/skins/waeup_epayment/approve_epayment.py @ 14074

Last change on this file since 14074 was 1427, checked in by Henrik Bettermann, 18 years ago

approve payment modified
payments_view changed to show links

File size: 1.5 KB
Line 
1## Script (Python) "epayment_cb"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: aprove_epayment.py 1425 2007-02-15 17:52:01Z joachim $
11"""
12payment callback
13"""
14import logging
15logger = logging.getLogger('EPayment.Approve')
16import DateTime
17if context.portal_membership.isAnonymousUser():
18    return None
19
20request = context.REQUEST
21students = context.portal_url.getPortalObject().campus.students
22wftool = context.portal_workflow
23mtool = context.portal_membership
24is_anon = mtool.isAnonymousUser()
25member = mtool.getAuthenticatedMember()
26student_id = context.getStudentId()
27is_so = context.isSectionOfficer()
28if student_id is None or not is_so:
29    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
30
31student = getattr(students,student_id)
32
33pd = {}
34#from Products.zdb import set_trace;set_trace()
35doc = context.getContent()
36review_state = wftool.getInfoFor(context,'review_state',None)
37if review_state != "opened":
38    return "not opened %s" % review_state
39pd['resp_code'] = 'AP'
40pd['resp_desc'] = 'Payment approved by %s, %s' % (member,DateTime.DateTime())
41doc.edit(mapping=pd)
42if doc.type_description.startswith('School Fee'):
43    wftool.doActionFor(student,'pay_school_fee')
44logger.info('"%s", "approved epayment for","%s""' % (member,student_id))
45wftool.doActionFor(context,'close')
46return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.