source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_epayment/epayment_cb.py @ 17929

Last change on this file since 17929 was 1596, checked in by joachim, 18 years ago

merged changes from trunk to joachim-event-branch

  • Property svn:keywords set to Id
File size: 1.5 KB
RevLine 
[1224]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: epayment_cb.py 1596 2007-03-19 21:45:44Z joachim $
11"""
12payment callback
13"""
14import logging
[1596]15logger = logging.getLogger('Skins.epayment_cb')
[1224]16import DateTime
[1365]17if context.portal_membership.isAnonymousUser():
18    return None
[1224]19
20request = context.REQUEST
21students = context.portal_url.getPortalObject().campus.students
[1303]22wftool = context.portal_workflow
[1224]23student_id = context.getStudentId()
24if student_id is None:
25    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
26
27student = getattr(students,student_id)
28
[1246]29resp_codes = (("x_RespDesc","resp_desc"),
[1224]30              ("x_RespPayRef","resp_pay_reference"),
31              ("x_RespCode","resp_code"),
32              ("x_CardNum","resp_card_num"),
33              ("x_ApprAmt","resp_approved_amount"),
34              )
[1229]35pd = {}
[1243]36#from Products.zdb import set_trace;set_trace()
[1224]37for rc,pdk in resp_codes:
38    pd[pdk] = request.get(rc)
[1229]39context.getContent().edit(mapping=pd)
[1367]40#resp = pd['resp_desc']
41#if  resp.startswith('Appro') and resp.endswith('essful'):
42resp = pd['resp_code']
43if  resp == '00':
[1348]44    wftool.doActionFor(student,'pay_school_fee')
[1596]45    logger.info('%s received valid callback' % student_id)
[1367]46
[1349]47elif len(resp) < 3:
[1596]48    logger.info('%s received no callback' % student_id)
[1348]49else:
[1596]50    logger.info('%s received unsuccessfull callback' % student_id)
[1308]51wftool.doActionFor(context,'close')
[1303]52
[1304]53return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.