Changeset 2857 for WAeUP_SRP/base/skins/waeup_epayment
- Timestamp:
- 4 Dec 2007, 16:28:13 (17 years ago)
- Location:
- WAeUP_SRP/base/skins/waeup_epayment
- Files:
-
- 2 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py
r2836 r2857 1 ## Script (Python) "interswitch_ cb"1 ## Script (Python) "interswitch_acco_cb" 2 2 ##bind container=container 3 3 ##bind context=context … … 18 18 pass 19 19 import logging 20 logger = logging.getLogger('Skins.interswitch_ cb')20 logger = logging.getLogger('Skins.interswitch_acco_cb') 21 21 from AccessControl import Unauthorized 22 22 import DateTime 23 current = DateTime.DateTime() 24 23 25 if context.portal_membership.isAnonymousUser(): 24 26 return None … … 52 54 pd[pdk] = request.get(rc,'') 53 55 54 ## for testing purposes55 #pd['resp_desc'] = 'Simulated Callback'56 #pd['resp_pay_reference'] = 'XXXX'57 #pd['resp_code'] = '00'58 #pd['resp_card_num'] = '0000'59 #pd['resp_approved_amount'] = '10000'60 61 56 if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4: 62 57 pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2] … … 69 64 wftool.doActionFor(context,'close') 70 65 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url()) 71 context.getContent().edit(mapping = pd) 66 pay_doc = context.getContent() 67 pay_doc.edit(mapping = pd) 72 68 resp = pd['resp_code'] 73 69 … … 76 72 #next_session, next_session_str = context.getNextSessionId(session) 77 73 78 next_info = context.getNextInfo(s_brain) 79 next_session_id = next_info['next_session_id'] 80 next_session_str = next_info['next_session_str'] 81 next_level_id = next_info['next_level_id'] 82 next_transition = next_info['next_transition'] 83 next_verdict = next_info['next_verdict'] 84 next_previous_verdict = next_info['next_previous_verdict'] 74 if pay_doc.subject == 'hostel_maintenance': 75 if resp == '00': 76 d = {} 77 acco_info = context.getAccommodationInfo() 78 d['acco_maint_date'] = pay_doc.date 79 d['acco_maint_fee'] = pay_doc.amount 80 d['acco_maint_pay_id'] = context.getId() 81 acco_info['acco_doc'].edit(mapping=d) 82 referer = request.get('HTTP_REFERER','none') 83 logger.info('%s valid callback referer = %s' % (student_id,referer)) 84 real_ip = request.get('HTTP_X_REAL_IP',"none") 85 logger.info('%s valid callback real_ip = %s' % (student_id,real_ip)) 86 else: 87 logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc'])) 88 try: 89 wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco']) 90 return request.RESPONSE.redirect("%s/accommodation_view" % acco_info['student'].absolute_url()) 91 except: 92 logger.info('%s no workflow action pay_maintainance_fee' % student_id) 93 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url()) 94 95 else: 96 next_info = context.getNextInfo(s_brain) 97 next_session_id = next_info['next_session_id'] 98 next_session_str = next_info['next_session_str'] 99 next_level_id = next_info['next_level_id'] 100 next_transition = next_info['next_transition'] 101 next_verdict = next_info['next_verdict'] 102 next_previous_verdict = next_info['next_previous_verdict'] 103 104 if resp == '00': 105 if context.getStudentReviewState() == "school_fee_paid": 106 logger.info('%s paid school_fee in state school_fee_paid' % (student_id)) 107 else: 108 study_course = getattr(student,'study_course') 109 try: 110 wftool.doActionFor(study_course,'open') 111 except: 112 pass 113 verdict = s_brain.verdict 114 if next_previous_verdict == 'N/A': 115 next_previous_verdict = '' 116 study_course.getContent().edit(mapping= {'current_level': next_level_id, 117 'current_session': next_session_id, 118 'current_verdict': next_verdict, 119 'previous_verdict': next_previous_verdict, 120 }) 121 if next_transition: 122 wftool.doActionFor(student,next_transition) 123 124 logger.info('%s received valid callback' % student_id) 125 referer = request.get('HTTP_REFERER','none') 126 logger.info('%s valid callback referer = %s' % (student_id,referer)) 127 real_ip = request.get('HTTP_X_REAL_IP',"none") 128 logger.info('%s valid callback real_ip = %s' % (student_id,real_ip)) 129 else: 130 logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc'])) 131 try: 132 wftool.doActionFor(context,'close') 133 except: 134 logger.info('%s no workflow action close' % student_id) 135 85 136 86 if resp == '00':87 if context.getStudentReviewState() == "school_fee_paid":88 logger.info('%s paid school_fee in state school_fee_paid' % (student_id))89 else:90 study_course = getattr(student,'study_course')91 try:92 wftool.doActionFor(study_course,'open')93 except:94 pass95 verdict = s_brain.verdict96 if next_previous_verdict == 'N/A':97 next_previous_verdict = ''98 study_course.getContent().edit(mapping= {'current_level': next_level_id,99 'current_session': next_session_id,100 'current_verdict': next_verdict,101 'previous_verdict': next_previous_verdict,102 })103 if next_transition:104 wftool.doActionFor(student,next_transition)105 106 logger.info('%s received valid callback' % student_id)107 referer = request.get('HTTP_REFERER','none')108 logger.info('%s valid callback referer = %s' % (student_id,referer))109 real_ip = request.get('HTTP_X_REAL_IP',"none")110 logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))111 112 else:113 logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))114 try:115 wftool.doActionFor(context,'close')116 except:117 logger.info('%s no workflow action close' % student_id)118 119 120 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracChangeset for help on using the changeset viewer.