Index: /WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py	(revision 3238)
+++ /WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py	(revision 3239)
@@ -32,5 +32,7 @@
 member = mtool.getAuthenticatedMember()
 member_id = str(member)
-student_id = context.getStudentId()
+#student_id = context.getStudentId()
+access_info = context.waeup_tool.getAccessInfo(context)
+student_id = access_info['student_id']
 if student_id is None: # or student_id != member_id:
     logger.info('%s tried to access payment object of %s' % (member_id,student_id))
@@ -54,5 +56,4 @@
     pd[pdk] = request.get(rc,'')
 
-
 ## for testing purposes
 #pd['resp_desc'] = 'Simulated Callback'
@@ -71,6 +72,8 @@
 review_state = wftool.getInfoFor(context,'review_state',None)
 if pd['resp_code'] == '':
-    logger.info('%s requeried payment %s and got empty response' % (student_id,context.getId()))
+    logger.info('%s requeried payment %s for %s and got empty response' % (member,context.getId(),student_id))
     return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
+if access_info['is_student'] and review_state == 'closed':
+    wftool.doActionFor(context,'open')    
 pay_doc = context.getContent()
 pay_doc.edit(mapping = pd)
@@ -79,5 +82,12 @@
 s_brain = context.students_catalog(id=student_id)[0]
 session = s_brain.session
-#next_session, next_session_str = context.getNextSessionId(session)
+
+#next_info = context.getNextInfo(s_brain)
+#next_session_id = next_info['next_session_id']
+#next_session_str = next_info['next_session_str']
+#next_level_id = next_info['next_level_id']
+#next_transition = next_info['next_transition']
+#next_verdict = next_info['next_verdict']
+#next_previous_verdict = next_info['next_previous_verdict']
 
 if pay_doc.category == 'hostel_maintenance':
@@ -88,5 +98,8 @@
         d['acco_maint_fee'] = pay_doc.amount
         d['acco_maint_pay_id'] = context.getId()
-        acco_info['acco_doc'].edit(mapping=d)
+        try:
+            acco_info['acco_doc'].edit(mapping=d)
+        except:
+            logger.info('%s requeried payment though maintenance already paid' % student_id)
         referer = request.get('HTTP_REFERER','none')
         logger.info('%s valid callback referer = %s' % (student_id,referer))
@@ -107,44 +120,3 @@
 
 
-#else:
-#    next_info = context.getNextInfo(s_brain)
-#    next_session_id = next_info['next_session_id']
-#    next_session_str = next_info['next_session_str']
-#    next_level_id = next_info['next_level_id']
-#    next_transition = next_info['next_transition']
-#    next_verdict = next_info['next_verdict']
-#    next_previous_verdict = next_info['next_previous_verdict']
-#
-#    if  resp == '00':
-#        if context.getStudentReviewState() == "school_fee_paid":
-#            logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
-#        else:
-#            study_course = getattr(student,'study_course')
-#            try:
-#                wftool.doActionFor(study_course,'open')
-#            except:
-#                pass
-#            verdict = s_brain.verdict
-#            if next_previous_verdict == 'N/A':
-#                next_previous_verdict = ''
-#            study_course.getContent().edit(mapping= {'current_level': next_level_id,
-#                                                    'current_session': next_session_id,
-#                                                    'current_verdict': next_verdict,
-#                                                    'previous_verdict': next_previous_verdict,
-#                                                    })
-#            if next_transition:
-#                wftool.doActionFor(student,next_transition)
 
-#        logger.info('%s received valid callback' % student_id)
-#        referer = request.get('HTTP_REFERER','none')
-#        logger.info('%s valid callback referer = %s' % (student_id,referer))
-#        real_ip = request.get('HTTP_X_REAL_IP',"none")
-#        logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
-#    else:
-#        logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
-#    try:
-#        wftool.doActionFor(context,'close')
-#    except:
-#        logger.info('%s no workflow action close' % student_id)
-
-
Index: /WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py	(revision 3238)
+++ /WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py	(revision 3239)
@@ -21,4 +21,5 @@
 from AccessControl import Unauthorized
 import DateTime
+
 
 if context.portal_membership.isAnonymousUser():
@@ -72,21 +73,13 @@
 if pd['resp_code'] == '':
     logger.info('%s requeried payment %s for %s and got empty response' % (member,context.getId(),student_id))
-    #if review_state == 'opened':
-    #    wftool.doActionFor(context,'close')
     return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
 if access_info['is_student'] and review_state == 'closed':
     wftool.doActionFor(context,'open')
-context.getContent().edit(mapping = pd)
-# except:
-#     logger.info('%s tried to edit payment %s in state %s' % (student_id,
-#                                                              context.getId(),
-#                                                              review_state))
-#     return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
-
+pay_doc = context.getContent()
+pay_doc.edit(mapping = pd)
 resp = pd['resp_code']
 
 s_brain = context.students_catalog(id=student_id)[0]
 session = s_brain.session
-#next_session, next_session_str = context.getNextSessionId(session)
 
 next_info = context.getNextInfo(s_brain)
@@ -126,7 +119,6 @@
 else:
     logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
-if review_state == 'opened':
-    wftool.doActionFor(context,'close')
 
+wftool.doActionFor(context,'close')
 
 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
