source: WAeUP_SRP/trunk/skins/waeup_epayment/epayment_cb.py @ 1348

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

condition for transition after call back changed

  • Property svn:keywords set to Id
File size: 1.3 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: epayment_cb.py 1348 2007-01-25 17:06:21Z henrik $
11"""
12payment callback
13"""
14import logging
15logger = logging.getLogger('EPayment.CallBack')
16import DateTime
17
18request = context.REQUEST
19students = context.portal_url.getPortalObject().campus.students
20wftool = context.portal_workflow
21student_id = context.getStudentId()
22if student_id is None:
23    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
24
25student = getattr(students,student_id)
26
27resp_codes = (("x_RespDesc","resp_desc"),
28              ("x_RespPayRef","resp_pay_reference"),
29              ("x_RespCode","resp_code"),
30              ("x_CardNum","resp_card_num"),
31              ("x_ApprAmt","resp_approved_amount"),
32              )
33pd = {}
34#from Products.zdb import set_trace;set_trace()
35for rc,pdk in resp_codes:
36    pd[pdk] = request.get(rc)
37context.getContent().edit(mapping=pd)
38if pd['resp_desc'] == 'Approved Successful':
39    wftool.doActionFor(student,'pay_school_fee')
40    logger.info('"%s", "received valid callback"' % student_id)
41else:
42    logger.info('"%s", "received no callback"' % student_id)   
43wftool.doActionFor(context,'close')
44
45return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.