Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 13405)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 13406)
@@ -49,4 +49,7 @@
 
 
+def dynamic_gateway_amt(fee):
+    return GATEWAY_AMT
+
 def contr_agreement(student):
     if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
@@ -216,6 +219,6 @@
                     - joint_venture_amt
                     - aaue_share_amt
-                    - student_union_due_amt
-                    - student_welfare_assurance_amt
+                    - (student_union_due_amt - GATEWAY_AMT)
+                    - (student_welfare_assurance_amt - GATEWAY_AMT)
                     - GATEWAY_AMT)
                 xmltext = """<payment_item_detail>
@@ -271,6 +274,6 @@
                 xmldict['institution_amt'] = 100 * (
                     self.context.amount_auth
-                    - gown_fee_amt
-                    - aaue_fl_fee_amt
+                    - (gown_fee_amt - GATEWAY_AMT)
+                    - (aaue_fl_fee_amt - GATEWAY_AMT)
                     - GATEWAY_AMT)
                 xmltext = """<payment_item_detail>
@@ -299,5 +302,6 @@
             xmldict['institution_bank_id'] = '123'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -312,5 +316,6 @@
             xmldict['institution_bank_id'] = '51'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -325,5 +330,6 @@
             xmldict['institution_bank_id'] = '123'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -338,5 +344,6 @@
             xmldict['institution_bank_id'] = '51'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -351,5 +358,6 @@
             xmldict['institution_bank_id'] = '117'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -364,5 +372,6 @@
             xmldict['institution_bank_id'] = '117'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -377,5 +386,6 @@
             xmldict['institution_bank_id'] = '123'
             xmldict['institution_amt'] = 100 * (
-                self.context.amount_auth - GATEWAY_AMT)
+                self.context.amount_auth -
+                dynamic_gateway_amt(self.context.amount_auth))
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 13405)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 13406)
@@ -121,5 +121,6 @@
         self.browser.getLink(self.value).click()
         self.assertTrue('Amount Authorized' in self.browser.contents)
-        self.assertTrue('<span>51750.0</span>' in self.browser.contents)
+        # 50250 + 1000 + 500 - 500
+        self.assertTrue('<span>51250.0</span>' in self.browser.contents)
         self.payment_url = self.browser.url
         self.browser.getLink("CollegePAY", index=0).click()
@@ -136,5 +137,5 @@
         self.assertEqual(self.student.current_mode, 'ug_pt')
         self.assertTrue(
-            '<input type="hidden" name="amount" value="5175000" />'
+            '<input type="hidden" name="amount" value="5125000" />'
             in self.browser.contents)
         self.assertTrue(
@@ -203,5 +204,6 @@
         self.browser.getLink(self.value).click()
         self.assertTrue('Amount Authorized' in self.browser.contents)
-        self.assertTrue('<span>43050.0</span>' in  self.browser.contents)
+        # 40250 + 2000 + 800 -500
+        self.assertTrue('<span>42550.0</span>' in self.browser.contents)
         self.payment_url = self.browser.url
         self.browser.getLink("CollegePAY", index=0).click()
@@ -210,5 +212,5 @@
         self.assertTrue('Total Amount Authorized:' in self.browser.contents)
         self.assertTrue(
-            '<input type="hidden" name="amount" value="4305000" />'
+            '<input type="hidden" name="amount" value="4255000" />'
             in self.browser.contents)
         self.assertTrue(
Index: /main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 13405)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 13406)
@@ -317,5 +317,5 @@
         self.browser.getLink(value).click()
         self.assertTrue('Amount Authorized' in self.browser.contents)
-        self.assertEqual(self.student['payments'][value].amount_auth, 51750.0)
+        self.assertEqual(self.student['payments'][value].amount_auth, 51250.0)
         self.browser.open(self.browser.url + '/payment_slip.pdf')
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
Index: /main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py	(revision 13405)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py	(revision 13406)
@@ -24,4 +24,5 @@
 from waeup.kofa.accesscodes import create_accesscode
 from waeup.kofa.students.utils import trans
+from waeup.aaue.interswitch.browser import dynamic_gateway_amt
 from waeup.aaue.interfaces import MessageFactory as _
 
@@ -148,5 +149,7 @@
                     # Otherwise we can't add somtehing
                     amount = 0.0
-                amount += academic_session.matric_gown_fee + academic_session.lapel_fee
+                amount += academic_session.matric_gown_fee + \
+                          academic_session.lapel_fee - \
+                          2*(dynamic_gateway_amt(amount))
         elif category == 'late_registration':
             amount = academic_session.late_registration_fee
@@ -183,5 +186,7 @@
                     # Otherwise we can't add somtehing
                     amount = 0.0
-                amount += academic_session.welfare_fee + academic_session.union_fee
+                amount += academic_session.welfare_fee + \
+                          academic_session.union_fee - \
+                          2*(dynamic_gateway_amt(amount))
         if amount in (0.0, None):
             return _(u'Amount could not be determined.'), None
