Index: WAeUP_SRP/base/skins/waeup_epayment/approve_epayment.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_epayment/approve_epayment.py	(revision 3239)
+++ WAeUP_SRP/base/skins/waeup_epayment/approve_epayment.py	(revision 3240)
@@ -41,9 +41,5 @@
 
 pd = {}
-#from Products.zdb import set_trace;set_trace()
 doc = context.getContent()
-review_state = wftool.getInfoFor(context,'review_state',None)
-if review_state != "opened":
-    return "not opened %s" % review_state
 pd['resp_code'] = 'AP'
 pd['resp_desc'] = 'Payment approved by %s, %s' % (member,DateTime.DateTime())
@@ -51,22 +47,24 @@
 doc.edit(mapping=pd)
 
-if doc.type_description.startswith('School Fee'):
-    study_course = getattr(student,'study_course')
-    try:
-        wftool.doActionFor(study_course,'open')
-    except:
-        pass
-    verdict = s_brain.verdict
-    if verdict == 'N/A':
-        verdict = ''
-    study_course.getContent().edit(mapping= {'current_level': next_level_id,
-                                             'current_session': next_session_id,
-                                             'current_verdict': next_verdict,
-                                             'previous_verdict': verdict,
-                                             })
-    if next_transition:
-        wftool.doActionFor(student,next_transition)
+#if doc.type_description.startswith('School Fee'):
+#    study_course = getattr(student,'study_course')
+#    try:
+#        wftool.doActionFor(study_course,'open')
+#    except:
+#        pass
+#    verdict = s_brain.verdict
+#    if verdict == 'N/A':
+#        verdict = ''
+#    study_course.getContent().edit(mapping= {'current_level': next_level_id,
+#                                             'current_session': next_session_id,
+#                                             'current_verdict': next_verdict,
+#                                             'previous_verdict': verdict,
+#                                             })
+#    if next_transition:
+#        wftool.doActionFor(student,next_transition)
 
 logger.info('%s approves epayment for %s' % (member,student_id))
-wftool.doActionFor(context,'close')
+review_state = wftool.getInfoFor(context,'review_state',None)
+if review_state == 'opened':
+    wftool.doActionFor(context,'close')
 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Index: WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py	(revision 3239)
+++ 	(revision )
@@ -1,122 +1,0 @@
-## Script (Python) "interswitch_acco_cb"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-payment callback
-"""
-try:
-    from Products.zdb import set_trace
-except:
-    def set_trace():
-        pass
-import logging
-logger = logging.getLogger('Skins.interswitch_acco_cb')
-from AccessControl import Unauthorized
-import DateTime
-current = DateTime.DateTime()
-
-if context.portal_membership.isAnonymousUser():
-    return None
-
-request = context.REQUEST
-students = context.portal_url.getPortalObject().campus.students
-wftool = context.portal_workflow
-mtool = context.portal_membership
-member = mtool.getAuthenticatedMember()
-member_id = str(member)
-#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))
-    referer = request.get('HTTP_REFERER','none')
-    logger.info('%s:%s illegal access, referer = %s' % (member_id,student_id,referer))
-    real_ip = request.get('HTTP_X_REAL_IP',"none")
-    logger.info('%s:%s illegal access, real_x_ip = %s' % (member_id,student_id,real_ip))
-    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
-
-student = getattr(students,student_id)
-resp_codes = (("desc","resp_desc"),
-              ("resp","resp_code"),
-              ("txnRef","pay_reference"),
-              ("payRef","resp_pay_reference"),
-              ("retRef","retRef"),
-              ("cardNum","resp_card_num"),
-              ("apprAmt","resp_approved_amount"),
-              )
-pd = {}
-for rc,pdk in resp_codes:
-    pd[pdk] = request.get(rc,'')
-
-## for testing purposes
-#pd['resp_desc'] = 'Simulated Callback'
-#pd['resp_pay_reference'] = 'XXXX'
-#pd['resp_code'] = '00'
-#pd['resp_card_num'] = '0000'
-#pd['resp_approved_amount'] = '10000'
-
-if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
-    pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2]
-    pd['status'] = 'paid'
-else:
-    pd['resp_approved_amount'] = '0'
-    pd['status'] = 'failed'
-
-review_state = wftool.getInfoFor(context,'review_state',None)
-if pd['resp_code'] == '':
-    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)
-resp = pd['resp_code']
-
-s_brain = context.students_catalog(id=student_id)[0]
-session = s_brain.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':
-    if  resp == '00':
-        acco_info = context.getAccommodationInfo()
-        d = {}
-        d['acco_maint_date'] = pay_doc.date
-        d['acco_maint_fee'] = pay_doc.amount
-        d['acco_maint_pay_id'] = context.getId()
-        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))
-        real_ip = request.get('HTTP_X_REAL_IP',"none")
-        logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
-        try:
-            wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
-        except:
-            logger.info('%s no workflow action pay_maintenance_fee' % student_id)
-            #return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
-    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)
-    return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
-
-
-
Index: WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py	(revision 3239)
+++ WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py	(revision 3240)
@@ -21,5 +21,4 @@
 from AccessControl import Unauthorized
 import DateTime
-
 
 if context.portal_membership.isAnonymousUser():
@@ -92,33 +91,56 @@
 
 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')
+
+    if pay_doc.category == 'schoolfee':  
+        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)
+
+
+    elif pay_doc.category == 'hostel_maintenance':
+        acco_info = context.getAccommodationInfo()
+        d = {}
+        d['acco_maint_date'] = pay_doc.date
+        d['acco_maint_fee'] = pay_doc.amount
+        d['acco_maint_pay_id'] = context.getId()
         try:
-            wftool.doActionFor(study_course,'open')
+            acco_info['acco_doc'].edit(mapping=d)
         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 requeried payment though maintenance already paid' % student_id)
+
+        try:
+            wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
+        except:
+            logger.info('%s no workflow action pay_maintenance_fee' % student_id)
+            
+
 
     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))
+    #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']))
 
-wftool.doActionFor(context,'close')
+review_state = wftool.getInfoFor(context,'review_state',None)
+if review_state == 'opened':
+    wftool.doActionFor(context,'close')
 
 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
