[1427] | 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 | """ |
---|
| 12 | payment callback |
---|
| 13 | """ |
---|
| 14 | import logging |
---|
| 15 | logger = logging.getLogger('EPayment.Approve') |
---|
| 16 | import DateTime |
---|
| 17 | if context.portal_membership.isAnonymousUser(): |
---|
| 18 | return None |
---|
| 19 | |
---|
| 20 | request = context.REQUEST |
---|
| 21 | students = context.portal_url.getPortalObject().campus.students |
---|
| 22 | wftool = context.portal_workflow |
---|
| 23 | mtool = context.portal_membership |
---|
| 24 | is_anon = mtool.isAnonymousUser() |
---|
| 25 | member = mtool.getAuthenticatedMember() |
---|
| 26 | student_id = context.getStudentId() |
---|
| 27 | is_so = context.isSectionOfficer() |
---|
| 28 | if student_id is None or not is_so: |
---|
| 29 | return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) |
---|
| 30 | |
---|
| 31 | student = getattr(students,student_id) |
---|
| 32 | |
---|
| 33 | pd = {} |
---|
| 34 | #from Products.zdb import set_trace;set_trace() |
---|
| 35 | doc = context.getContent() |
---|
| 36 | review_state = wftool.getInfoFor(context,'review_state',None) |
---|
| 37 | if review_state != "opened": |
---|
| 38 | return "not opened %s" % review_state |
---|
| 39 | pd['resp_code'] = 'AP' |
---|
| 40 | pd['resp_desc'] = 'Payment approved by %s, %s' % (member,DateTime.DateTime()) |
---|
| 41 | doc.edit(mapping=pd) |
---|
| 42 | if doc.type_description.startswith('School Fee'): |
---|
| 43 | wftool.doActionFor(student,'pay_school_fee') |
---|
| 44 | logger.info('"%s", "approved epayment for","%s""' % (member,student_id)) |
---|
| 45 | wftool.doActionFor(context,'close') |
---|
| 46 | return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url()) |
---|