## Script (Python) "getPaymentInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # $Id: getPaymentInfo.py 8315 2012-04-30 12:15:36Z henrik $ """ return Info about the current Student """ import logging logger = logging.getLogger('Skins.getStudentBaseInfo') from DateTime import DateTime try: from Products.zdb import set_trace except: def set_trace(): pass info = context.waeup_tool.getAccessInfo(context) student_id = info['student_id'] if student_id is None: return None res = context.students_catalog(id = student_id) if len(res) != 1: return None sbrain = res[0] info['id'] = student_id info['student'] = context.getFormattedStudentEntry(sbrain) payment = context.getContent() info['payment_doc'] = payment info['is_im_pmt'] = im = payment.resp_code in ('IM',) info['is_etranzact_pmt'] = ie = payment.type == 'etranzact' info['is_online_pmt'] = io = payment.resp_code in ('0','00','AP','IP',) info['is_request_pmt'] = ir = payment.resp_code in ('RP',) info['is_scratchcard_pmt'] = isc = payment.resp_code == 'SC' info['is_interrupted'] = ii = payment.resp_code == '' and not ie info['unknown_code'] = not (io or isc or ii or ir or ie or im) info['resp_code'] = payment.resp_code info['resp_desc'] = payment.resp_desc #info['entry_mode'] = sbrain.entry_mode try: p_date = payment.date.strftime("%d/%m/%y %H:%M:%S") except: p_date = '(no payment date provided)' info['p_date'] = p_date return info