## Script (Python) "getPaymentInfo"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# $Id: getPaymentInfo.py 5195 2010-05-14 14:57:54Z 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_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 == ''
info['unknown_code'] = not (io or isc or ii or ir)
info['resp_code'] = payment.resp_code
info['resp_desc'] = payment.resp_desc
#info['entry_mode'] = sbrain.entry_mode


return info
