Index: WAeUP_SRP/trunk/skins/waeup_epayment/epayment_cb.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/epayment_cb.py	(revision 1973)
+++ 	(revision )
@@ -1,74 +1,0 @@
-## Script (Python) "epayment_cb"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-payment callback
-"""
-import logging
-logger = logging.getLogger('Skins.epayment_cb')
-from AccessControl import Unauthorized
-import 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()
-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 = (("x_RespDesc","resp_desc"),
-              ("x_RespPayRef","resp_pay_reference"),
-              ("x_RespCode","resp_code"),
-              ("x_CardNum","resp_card_num"),
-              ("x_ApprAmt","resp_approved_amount"),
-              )
-pd = {}
-#from Products.zdb import set_trace;set_trace()
-for rc,pdk in resp_codes:
-    pd[pdk] = request.get(rc)
-try:
-    context.getContent().edit(mapping=pd)
-except UnAuthorized,E:
-    logger.info('%s ' % student_id)
-
-#resp = pd['resp_desc']
-#if  resp.startswith('Appro') and resp.endswith('essful'):
-resp = pd['resp_code']
-if  resp == '00':
-    wftool.doActionFor(student,'pay_school_fee')
-    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))
-
-elif len(resp) < 3:
-    logger.info('%s received no callback' % student_id)
-else:
-    logger.info('%s received unsuccessfull callback' % student_id)
-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/trunk/skins/waeup_epayment/epayment_cb.py_not_used
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/epayment_cb.py_not_used	(revision 1992)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/epayment_cb.py_not_used	(revision 1992)
@@ -0,0 +1,74 @@
+## Script (Python) "epayment_cb"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: epayment_cb.py 1867 2007-06-08 09:59:59Z joachim $
+"""
+payment callback
+"""
+import logging
+logger = logging.getLogger('Skins.epayment_cb')
+from AccessControl import Unauthorized
+import 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()
+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 = (("x_RespDesc","resp_desc"),
+              ("x_RespPayRef","resp_pay_reference"),
+              ("x_RespCode","resp_code"),
+              ("x_CardNum","resp_card_num"),
+              ("x_ApprAmt","resp_approved_amount"),
+              )
+pd = {}
+#from Products.zdb import set_trace;set_trace()
+for rc,pdk in resp_codes:
+    pd[pdk] = request.get(rc)
+try:
+    context.getContent().edit(mapping=pd)
+except UnAuthorized,E:
+    logger.info('%s ' % student_id)
+
+#resp = pd['resp_desc']
+#if  resp.startswith('Appro') and resp.endswith('essful'):
+resp = pd['resp_code']
+if  resp == '00':
+    wftool.doActionFor(student,'pay_school_fee')
+    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))
+
+elif len(resp) < 3:
+    logger.info('%s received no callback' % student_id)
+else:
+    logger.info('%s received unsuccessfull callback' % student_id)
+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/trunk/skins/waeup_epayment/getSchoolFee.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/getSchoolFee.py	(revision 1973)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/getSchoolFee.py	(revision 1992)
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=faculty=None
+##parameters=faculty=None, session=None
 ##title=
 ##
@@ -18,6 +18,8 @@
         "EDU",
         )
-fee_1_data = ("22200","School Fee for Session 2006/2007")
-fee_2_data = ("23700","School Fee for Session 2006/2007")
+        
+sessionstring = "School Fee for Session %s" % context.portal_vocabularies.sessions.get(session)
+fee_1_data = ("22200",sessionstring)
+fee_2_data = ("23700",sessionstring)
 
 if faculty in fee1:
Index: WAeUP_SRP/trunk/skins/waeup_epayment/interswitch_cb.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/interswitch_cb.py	(revision 1973)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/interswitch_cb.py	(revision 1992)
@@ -51,4 +51,12 @@
 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]
@@ -63,9 +71,25 @@
 context.getContent().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)
+
 if  resp == '00':
     if context.getStudentReviewState() == "school_fee_paid":
         logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
     else:
-        wftool.doActionFor(student,'pay_school_fee')
+        if next_session == context.getSessionId()[-2:]:
+            wftool.doActionFor(student,'pay_school_fee')
+        else:
+            study_course = getattr(student,'study_course')
+            try:
+                wftool.doActionFor(study_course,'open')
+            except:
+                pass
+            study_course_doc = study_course.getContent()
+            next_level = "%s" % (int(s_brain.level) + 100)
+            study_course_doc.edit(mapping= {'current_level': next_level,
+                                            'current_session': next_session,})
     logger.info('%s received valid callback' % student_id)
     referer = request.get('HTTP_REFERER','none')
Index: WAeUP_SRP/trunk/skins/waeup_epayment/pay_interswitch.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/pay_interswitch.py	(revision 1973)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/pay_interswitch.py	(revision 1992)
@@ -34,5 +34,5 @@
 
 sbrain = context.students_catalog(id=student_id)[0]
-amount,description = context.getSchoolFee(sbrain.faculty)
+amount,description = context.getSchoolFee(sbrain.faculty,sbrain.session)
 info = {}
 info['site_id'] = '61'
@@ -111,9 +111,9 @@
 uniben_amount = itotal - interswitch_amount
 xmldict = {}
-xmldict['detail_ref'] = args['txn_ref'] 
-xmldict['department'] = sbrain.department 
+xmldict['detail_ref'] = args['txn_ref']
+xmldict['department'] = sbrain.department
 xmldict['faculty'] = sbrain.faculty
 #xmldict['wema_amt'] = "%d" % wema_amount
-#xmldict['provider_amt'] = "%d" % provider_amount 
+#xmldict['provider_amt'] = "%d" % provider_amount
 xmldict['uniben_amt'] = "%d" % uniben_amount
 ##<item_detail item_id="2" item_name="WEMA" item_amt="%(wema_amt)s" bank_id="16" acct_num="48398023902" />
@@ -121,7 +121,7 @@
 xmltext = """
 <payment_item_detail>
-<item_details detail_ref="%(detail_ref)s" college="UNIBEN" department="%(department)s" 
+<item_details detail_ref="%(detail_ref)s" college="UNIBEN" department="%(department)s"
 faculty="%(faculty)s">
-<item_detail item_id="1" item_name="UNIBEN" item_amt="%(uniben_amt)s" bank_id="16" acct_num="384950902390" /> 
+<item_detail item_id="1" item_name="UNIBEN" item_amt="%(uniben_amt)s" bank_id="16" acct_num="384950902390" />
 </item_details>
 </payment_item_detail>
Index: WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py	(revision 1973)
+++ 	(revision )
@@ -1,113 +1,0 @@
-## Script (Python) "pay_online"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-pay online
-"""
-from urllib import urlencode
-import logging
-logger = logging.getLogger('Skins.pay_online')
-import DateTime
-
-if context.portal_membership.isAnonymousUser():
-    return None
-
-request = context.REQUEST
-wftool = context.portal_workflow
-students = context.portal_url.getPortalObject().campus.students
-
-student_id = context.getStudentId()
-student = getattr(students,student_id)
-
-sbrain = context.students_catalog(id=student_id)[0]
-amount,description = context.getSchoolFee(sbrain.faculty)
-##res = context.portal_catalog(portal_type="Certificate",
-##                                     id = sbrain.course)
-##
-##if not res:
-##    logger.info('"%s","certificate not found", "%s"' % (student_id,course))
-##    sfc = "ART"
-##else:
-##    sfc = res[0].getPath().split('/')[-4]
-info = {}
-info['site_id'] = '300100100'
-info['currency_id'] = '566'
-info['amount'] = amount
-info['type_code'] = sbrain.faculty
-info['type_description'] = description
-info['pay_bill_to'] = sbrain.name
-info['pay_ship_to'] = "University of Benin"
-info['student_id'] = student_id
-info['student_name'] = sbrain.name
-info['student_email'] = sbrain.email
-now = DateTime.DateTime()
-info['date'] = now
-order_id = info['order_id'] = "%d" % int(now.timeTime()*1000)
-info['order_id'] = "%s%s" % (student_id[1:],order_id)
-p_id = "p%s" % order_id
-
-#from Products.zdb import set_trace;set_trace()
-if student_id is None:
-    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
-
-if context.portal_url().find('uniben-demo.waeup.org') >-1 or\
-   context.portal_url().find('uniben.waeup.org') >-1:
-    info['action'] = "http://www.wemaonlinepayments.biz/payment.aspx"
-else:
-    #pass
-    #return None
-    info['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),p_id)
-
-
-if "payments" not in student.objectIds():
-    student.invokeFactory('PaymentsFolder','payments')
-    payments = getattr(student,'payments')
-    d = {}
-    d['Title'] = 'Payments'
-    payments.getContent().edit(mapping=d)
-    wftool.doActionFor(payments,'open')
-else:
-    payments = getattr(student,'payments')
-if request.has_key('epayment'):
-    return context.wema_form(info=info)
-
-
-payments.invokeFactory('Payment', p_id)
-payment = getattr(payments,p_id)
-wftool.doActionFor(payment,'open')
-d = {}
-d.update(info)
-#from Products.zdb import set_trace;set_trace()
-payment.getContent().edit(mapping=d)
-#wftool.doActionFor(payment,'close')
-#wftool.doActionFor(student,'pay_school_fee')
-info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id)
-
-logger.info('%(student_id)s initiated online school fee payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
-payment_fields = (('x_SiteID','site_id'),
-                  ('x_Redirect_url','callback_url'),
-                  ('x_CurrencyID','currency_id'),
-                  ('x_PaymentCode','type_code'),
-                  ('x_PayDesc','type_description'),
-                  ('x_Billto','pay_bill_to'),
-                  ('x_Shipto','pay_ship_to'),
-                  ('x_PayerID','student_id'),
-                  ('x_PayerNames','student_name'),
-                  ('x_PayerEmail','student_email'),
-                  ('x_OrderID','order_id'),
-                  ('x_amt','amount'),
-                  )
-args = {}
-for arg,field in payment_fields:
-    args[arg] = info[field]
-info['args'] = args
-return context.goto_wema_form(info=info)
-url = info['action'] + "?" + urlencode(args)
-request.RESPONSE.redirect(url)
Index: WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py_not_used
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py_not_used	(revision 1992)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py_not_used	(revision 1992)
@@ -0,0 +1,113 @@
+## Script (Python) "pay_online"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: pay_online.py 1633 2007-03-23 22:20:52Z henrik $
+"""
+pay online
+"""
+from urllib import urlencode
+import logging
+logger = logging.getLogger('Skins.pay_online')
+import DateTime
+
+if context.portal_membership.isAnonymousUser():
+    return None
+
+request = context.REQUEST
+wftool = context.portal_workflow
+students = context.portal_url.getPortalObject().campus.students
+
+student_id = context.getStudentId()
+student = getattr(students,student_id)
+
+sbrain = context.students_catalog(id=student_id)[0]
+amount,description = context.getSchoolFee(sbrain.faculty)
+##res = context.portal_catalog(portal_type="Certificate",
+##                                     id = sbrain.course)
+##
+##if not res:
+##    logger.info('"%s","certificate not found", "%s"' % (student_id,course))
+##    sfc = "ART"
+##else:
+##    sfc = res[0].getPath().split('/')[-4]
+info = {}
+info['site_id'] = '300100100'
+info['currency_id'] = '566'
+info['amount'] = amount
+info['type_code'] = sbrain.faculty
+info['type_description'] = description
+info['pay_bill_to'] = sbrain.name
+info['pay_ship_to'] = "University of Benin"
+info['student_id'] = student_id
+info['student_name'] = sbrain.name
+info['student_email'] = sbrain.email
+now = DateTime.DateTime()
+info['date'] = now
+order_id = info['order_id'] = "%d" % int(now.timeTime()*1000)
+info['order_id'] = "%s%s" % (student_id[1:],order_id)
+p_id = "p%s" % order_id
+
+#from Products.zdb import set_trace;set_trace()
+if student_id is None:
+    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
+
+if context.portal_url().find('uniben-demo.waeup.org') >-1 or\
+   context.portal_url().find('uniben.waeup.org') >-1:
+    info['action'] = "http://www.wemaonlinepayments.biz/payment.aspx"
+else:
+    #pass
+    #return None
+    info['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),p_id)
+
+
+if "payments" not in student.objectIds():
+    student.invokeFactory('PaymentsFolder','payments')
+    payments = getattr(student,'payments')
+    d = {}
+    d['Title'] = 'Payments'
+    payments.getContent().edit(mapping=d)
+    wftool.doActionFor(payments,'open')
+else:
+    payments = getattr(student,'payments')
+if request.has_key('epayment'):
+    return context.wema_form(info=info)
+
+
+payments.invokeFactory('Payment', p_id)
+payment = getattr(payments,p_id)
+wftool.doActionFor(payment,'open')
+d = {}
+d.update(info)
+#from Products.zdb import set_trace;set_trace()
+payment.getContent().edit(mapping=d)
+#wftool.doActionFor(payment,'close')
+#wftool.doActionFor(student,'pay_school_fee')
+info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id)
+
+logger.info('%(student_id)s initiated online school fee payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
+payment_fields = (('x_SiteID','site_id'),
+                  ('x_Redirect_url','callback_url'),
+                  ('x_CurrencyID','currency_id'),
+                  ('x_PaymentCode','type_code'),
+                  ('x_PayDesc','type_description'),
+                  ('x_Billto','pay_bill_to'),
+                  ('x_Shipto','pay_ship_to'),
+                  ('x_PayerID','student_id'),
+                  ('x_PayerNames','student_name'),
+                  ('x_PayerEmail','student_email'),
+                  ('x_OrderID','order_id'),
+                  ('x_amt','amount'),
+                  )
+args = {}
+for arg,field in payment_fields:
+    args[arg] = info[field]
+info['args'] = args
+return context.goto_wema_form(info=info)
+url = info['action'] + "?" + urlencode(args)
+request.RESPONSE.redirect(url)
Index: WAeUP_SRP/trunk/skins/waeup_epayment/requery_payment.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/requery_payment.py	(revision 1973)
+++ 	(revision )
@@ -1,66 +1,0 @@
-## Script (Python) "pay_online"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-requery online-payment
-"""
-from urllib import urlencode
-import logging
-logger = logging.getLogger('Skins.requery_payment')
-import DateTime
-
-if context.portal_membership.isAnonymousUser():
-    return None
-
-request = context.REQUEST
-wftool = context.portal_workflow
-students = context.portal_url.getPortalObject().campus.students
-
-student_id = context.getStudentId()
-student = getattr(students,student_id)
-
-sbrain = context.students_catalog(id=student_id)[0]
-info = {}
-info['site_id'] = '300100100'
-info['currency_id'] = '566'
-
-#from Products.zdb import set_trace;set_trace()
-if student_id is None:
-    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
-
-if context.portal_url().find('uniben-demo.waeup.org') >-1 or\
-   context.portal_url().find('uniben.waeup.org') >-1:
-    info['action'] = "http://www.wemaonlinepayments.biz/querytransaction.aspx"
-else:
-    #pass
-    #return None
-    info['action'] = "%s/payments/%s/simulate_queryatransaction" % (student.absolute_url(),p_id)
-
-
-payment = context
-if payment.portal_type != 'Payment':
-    return
-payment_doc = payment.getContent()
-#from Products.zdb import set_trace;set_trace()
-info['order_id'] = p_id = payment_doc.order_id
-info['callback_url'] = "%s/payments/%s/epayment_requery_cb" % (student.absolute_url(),p_id)
-info['type_description'] = payment_doc.type_description
-info['amount'] = payment_doc.amount
-info['student_id'] = student_id
-logger.info('%(student_id)s requeried online school fee payment for order_id %(order_id)s' % info)
-payment_fields = (('x_SiteID','site_id'),
-                  ('x_OrderID','order_id'),
-                  ('x_Redirect_url','callback_url'),
-                  )
-args = {}
-for arg,field in payment_fields:
-    args[arg] = info[field]
-info['args'] = args
-return context.requery_payment_form(info=info)
Index: WAeUP_SRP/trunk/skins/waeup_epayment/requery_payment_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/requery_payment_form.pt	(revision 1973)
+++ 	(revision )
@@ -1,42 +1,0 @@
-<metal:body use-macro="here/main_template/macros/master">
-    <metal:main fill-slot="main"
-                tal:define="info options/info">
-                
-        <h3>Requery Online Payment! </h3>
-        <br />
-                
-      <form method="post" action="pay_online"
-            tal:attributes="action info/action ">
-      <span tal:repeat="arg python:info['args'].items()"
-            tal:omit-tag="">
-          <input type="hidden" tal:attributes="name python:arg[0];value python:arg[1]" />
-      </span>          
-        <table>
-          <tr>
-            <td width="100px">
-            Payment:</td>
-            <td tal:content="info/type_description"></td>
-          </tr>
-          <tr>
-            <td >
-            Amount:
-            </td>
-            <td> Naira <span tal:content="info/amount" /></td>
-          </tr>
-          <tr>
-            <td >
-            Bank:
-            </td>
-            <td>Wema Bank</td>
-          </tr>          
-        </table>
-        <br />
-        <input type="submit" 
-               class="standalone" 
-               name="goto_bank" 
-               value="Requery this payment with Bank" 
-               />
-      </form>
-    </metal:main>
-</metal:body>
-
