Ignore:
Timestamp:
26 Feb 2008, 22:40:31 (17 years ago)
Author:
Henrik Bettermann
Message:

merge callback scripts and more

Location:
WAeUP_SRP/base/skins/waeup_epayment
Files:
1 deleted
2 edited

Legend:

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

    r2941 r3240  
    4141
    4242pd = {}
    43 #from Products.zdb import set_trace;set_trace()
    4443doc = context.getContent()
    45 review_state = wftool.getInfoFor(context,'review_state',None)
    46 if review_state != "opened":
    47     return "not opened %s" % review_state
    4844pd['resp_code'] = 'AP'
    4945pd['resp_desc'] = 'Payment approved by %s, %s' % (member,DateTime.DateTime())
     
    5147doc.edit(mapping=pd)
    5248
    53 if doc.type_description.startswith('School Fee'):
    54     study_course = getattr(student,'study_course')
    55     try:
    56         wftool.doActionFor(study_course,'open')
    57     except:
    58         pass
    59     verdict = s_brain.verdict
    60     if verdict == 'N/A':
    61         verdict = ''
    62     study_course.getContent().edit(mapping= {'current_level': next_level_id,
    63                                              'current_session': next_session_id,
    64                                              'current_verdict': next_verdict,
    65                                              'previous_verdict': verdict,
    66                                              })
    67     if next_transition:
    68         wftool.doActionFor(student,next_transition)
     49#if doc.type_description.startswith('School Fee'):
     50#    study_course = getattr(student,'study_course')
     51#    try:
     52#        wftool.doActionFor(study_course,'open')
     53#    except:
     54#        pass
     55#    verdict = s_brain.verdict
     56#    if verdict == 'N/A':
     57#        verdict = ''
     58#    study_course.getContent().edit(mapping= {'current_level': next_level_id,
     59#                                             'current_session': next_session_id,
     60#                                             'current_verdict': next_verdict,
     61#                                             'previous_verdict': verdict,
     62#                                             })
     63#    if next_transition:
     64#        wftool.doActionFor(student,next_transition)
    6965
    7066logger.info('%s approves epayment for %s' % (member,student_id))
    71 wftool.doActionFor(context,'close')
     67review_state = wftool.getInfoFor(context,'review_state',None)
     68if review_state == 'opened':
     69    wftool.doActionFor(context,'close')
    7270return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
  • WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py

    r3239 r3240  
    2121from AccessControl import Unauthorized
    2222import DateTime
    23 
    2423
    2524if context.portal_membership.isAnonymousUser():
     
    9291
    9392if  resp == '00':
    94     if context.getStudentReviewState() == "school_fee_paid":
    95         logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
    96     else:
    97         study_course = getattr(student,'study_course')
     93
     94    if pay_doc.category == 'schoolfee': 
     95        if context.getStudentReviewState() == "school_fee_paid":
     96            logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
     97        else:
     98            study_course = getattr(student,'study_course')
     99            try:
     100                wftool.doActionFor(study_course,'open')
     101            except:
     102                pass
     103            verdict = s_brain.verdict
     104            if next_previous_verdict == 'N/A':
     105                next_previous_verdict = ''
     106            study_course.getContent().edit(mapping= {'current_level': next_level_id,
     107                                                     'current_session': next_session_id,
     108                                                     'current_verdict': next_verdict,
     109                                                     'previous_verdict': next_previous_verdict,
     110                                                     })
     111            if next_transition:
     112                wftool.doActionFor(student,next_transition)
     113
     114
     115    elif pay_doc.category == 'hostel_maintenance':
     116        acco_info = context.getAccommodationInfo()
     117        d = {}
     118        d['acco_maint_date'] = pay_doc.date
     119        d['acco_maint_fee'] = pay_doc.amount
     120        d['acco_maint_pay_id'] = context.getId()
    98121        try:
    99             wftool.doActionFor(study_course,'open')
     122            acco_info['acco_doc'].edit(mapping=d)
    100123        except:
    101             pass
    102         verdict = s_brain.verdict
    103         if next_previous_verdict == 'N/A':
    104             next_previous_verdict = ''
    105         study_course.getContent().edit(mapping= {'current_level': next_level_id,
    106                                                  'current_session': next_session_id,
    107                                                  'current_verdict': next_verdict,
    108                                                  'previous_verdict': next_previous_verdict,
    109                                                  })
    110         if next_transition:
    111             wftool.doActionFor(student,next_transition)
     124            logger.info('%s requeried payment though maintenance already paid' % student_id)
     125
     126        try:
     127            wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
     128        except:
     129            logger.info('%s no workflow action pay_maintenance_fee' % student_id)
     130           
     131
    112132
    113133    logger.info('%s received valid callback' % student_id)
    114     referer = request.get('HTTP_REFERER','none')
    115     logger.info('%s valid callback referer = %s' % (student_id,referer))
    116     real_ip = request.get('HTTP_X_REAL_IP',"none")
    117     logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
     134    #referer = request.get('HTTP_REFERER','none')
     135    #logger.info('%s valid callback referer = %s' % (student_id,referer))
     136    #real_ip = request.get('HTTP_X_REAL_IP',"none")
     137    #logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
    118138
    119139else:
    120140    logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
    121141
    122 wftool.doActionFor(context,'close')
     142review_state = wftool.getInfoFor(context,'review_state',None)
     143if review_state == 'opened':
     144    wftool.doActionFor(context,'close')
    123145
    124146return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracChangeset for help on using the changeset viewer.