Ignore:
Timestamp:
26 Feb 2008, 21:27:15 (17 years ago)
Author:
Henrik Bettermann
Message:

tested and fixed

Callback scripts have been adjusted, so that interswitch_acco_cb.py can be easily extended to cover also interswitch_cb.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py

    r3232 r3239  
    3232member = mtool.getAuthenticatedMember()
    3333member_id = str(member)
    34 student_id = context.getStudentId()
     34#student_id = context.getStudentId()
     35access_info = context.waeup_tool.getAccessInfo(context)
     36student_id = access_info['student_id']
    3537if student_id is None: # or student_id != member_id:
    3638    logger.info('%s tried to access payment object of %s' % (member_id,student_id))
     
    5456    pd[pdk] = request.get(rc,'')
    5557
    56 
    5758## for testing purposes
    5859#pd['resp_desc'] = 'Simulated Callback'
     
    7172review_state = wftool.getInfoFor(context,'review_state',None)
    7273if pd['resp_code'] == '':
    73     logger.info('%s requeried payment %s and got empty response' % (student_id,context.getId()))
     74    logger.info('%s requeried payment %s for %s and got empty response' % (member,context.getId(),student_id))
    7475    return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
     76if access_info['is_student'] and review_state == 'closed':
     77    wftool.doActionFor(context,'open')   
    7578pay_doc = context.getContent()
    7679pay_doc.edit(mapping = pd)
     
    7982s_brain = context.students_catalog(id=student_id)[0]
    8083session = s_brain.session
    81 #next_session, next_session_str = context.getNextSessionId(session)
     84
     85#next_info = context.getNextInfo(s_brain)
     86#next_session_id = next_info['next_session_id']
     87#next_session_str = next_info['next_session_str']
     88#next_level_id = next_info['next_level_id']
     89#next_transition = next_info['next_transition']
     90#next_verdict = next_info['next_verdict']
     91#next_previous_verdict = next_info['next_previous_verdict']
    8292
    8393if pay_doc.category == 'hostel_maintenance':
     
    8898        d['acco_maint_fee'] = pay_doc.amount
    8999        d['acco_maint_pay_id'] = context.getId()
    90         acco_info['acco_doc'].edit(mapping=d)
     100        try:
     101            acco_info['acco_doc'].edit(mapping=d)
     102        except:
     103            logger.info('%s requeried payment though maintenance already paid' % student_id)
    91104        referer = request.get('HTTP_REFERER','none')
    92105        logger.info('%s valid callback referer = %s' % (student_id,referer))
     
    107120
    108121
    109 #else:
    110 #    next_info = context.getNextInfo(s_brain)
    111 #    next_session_id = next_info['next_session_id']
    112 #    next_session_str = next_info['next_session_str']
    113 #    next_level_id = next_info['next_level_id']
    114 #    next_transition = next_info['next_transition']
    115 #    next_verdict = next_info['next_verdict']
    116 #    next_previous_verdict = next_info['next_previous_verdict']
    117 #
    118 #    if  resp == '00':
    119 #        if context.getStudentReviewState() == "school_fee_paid":
    120 #            logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
    121 #        else:
    122 #            study_course = getattr(student,'study_course')
    123 #            try:
    124 #                wftool.doActionFor(study_course,'open')
    125 #            except:
    126 #                pass
    127 #            verdict = s_brain.verdict
    128 #            if next_previous_verdict == 'N/A':
    129 #                next_previous_verdict = ''
    130 #            study_course.getContent().edit(mapping= {'current_level': next_level_id,
    131 #                                                    'current_session': next_session_id,
    132 #                                                    'current_verdict': next_verdict,
    133 #                                                    'previous_verdict': next_previous_verdict,
    134 #                                                    })
    135 #            if next_transition:
    136 #                wftool.doActionFor(student,next_transition)
    137122
    138 #        logger.info('%s received valid callback' % student_id)
    139 #        referer = request.get('HTTP_REFERER','none')
    140 #        logger.info('%s valid callback referer = %s' % (student_id,referer))
    141 #        real_ip = request.get('HTTP_X_REAL_IP',"none")
    142 #        logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
    143 #    else:
    144 #        logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
    145 #    try:
    146 #        wftool.doActionFor(context,'close')
    147 #    except:
    148 #        logger.info('%s no workflow action close' % student_id)
    149 
    150 
Note: See TracChangeset for help on using the changeset viewer.