Index: /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py	(revision 8321)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py	(revision 8322)
@@ -588,5 +588,5 @@
     return fire_transition(access_code, 'reenable', comment=comment)
 
-def create_accesscode(batch_prefix, batch_num, owner):
+def create_accesscode(batch_prefix, batch_num, cost, owner):
     """
     """
@@ -598,5 +598,5 @@
     rand_num = list(batch.getNewRandomNum())[0]
     num = len(batch) + 1
-    batch.addAccessCode(num, rand_num, owner)
+    batch.addAccessCode(num, rand_num, cost, owner)
     batch.entry_num += 1
     pin = u'%s-%s-%s' % (batch_prefix,batch_num,rand_num)
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8321)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8322)
@@ -1152,5 +1152,6 @@
         if self.context.p_category == 'clearance':
             # Create CLR access code
-            pin, error = create_accesscode('CLR',0,student.student_id)
+            pin, error = create_accesscode(
+                'CLR',0,self.context.amount_auth,student.student_id)
             if error:
                 self.flash(_('Valid callback received. ${a}',
@@ -1160,5 +1161,6 @@
         elif self.context.p_category == 'schoolfee':
             # Create SFE access code
-            pin, error = create_accesscode('SFE',0,student.student_id)
+            pin, error = create_accesscode(
+                'SFE',0,self.context.amount_auth,student.student_id)
             if error:
                 self.flash(_('Valid callback received. ${a}',
@@ -1168,5 +1170,6 @@
         elif self.context.p_category == 'bed_allocation':
             # Create HOS access code
-            pin, error = create_accesscode('HOS',0,student.student_id)
+            pin, error = create_accesscode(
+                'HOS',0,self.context.amount_auth,student.student_id)
             if error:
                 self.flash(_('Valid callback received. ${a}',
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 8321)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 8322)
@@ -175,4 +175,5 @@
         configuration = createObject('waeup.SessionConfiguration')
         configuration.academic_session = 2004
+        configuration.clearance_fee = 3456.0
         self.app['configuration'].addSessionConfiguration(configuration)
 
@@ -1294,4 +1295,8 @@
                           self.browser.contents)
 
+        # The authorized amount has been stored in the access code
+        self.assertEqual(
+            self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0)
+
         # Callback can't be applied twice
         self.browser.open(payment_url + '/simulate_callback')
@@ -1349,5 +1354,6 @@
         pin = self.app['accesscodes']['CLR-0'].keys()[0]
         ac = self.app['accesscodes']['CLR-0'][pin]
-        ac.owner = self.student_id
+        self.assertEqual(ac.owner, self.student_id)
+        self.assertEqual(ac.cost, 3456.0)
         return
 
@@ -1384,5 +1390,6 @@
         pin = self.app['accesscodes']['CLR-0'].keys()[0]
         ac = self.app['accesscodes']['CLR-0'][pin]
-        ac.owner = self.student_id
+        self.assertEqual(ac.owner, self.student_id)
+        self.assertEqual(ac.cost, 3456.0)
 
         # Students can open the pdf payment slip
@@ -1493,5 +1500,5 @@
         pin = self.app['accesscodes']['HOS-0'].keys()[0]
         ac = self.app['accesscodes']['HOS-0'][pin]
-        ac.owner = self.student_id
+        self.assertEqual(ac.owner, self.student_id)
         parts = pin.split('-')[1:]
         sfeseries, sfenumber = parts
@@ -1622,5 +1629,4 @@
         pin = self.app['accesscodes']['HOS-0'].keys()[0]
         ac = self.app['accesscodes']['HOS-0'][pin]
-        ac.owner = u'Anybody'
         parts = pin.split('-')[1:]
         sfeseries, sfenumber = parts
@@ -1640,4 +1646,5 @@
         self.assertMatches('...Activation code is invalid...',
                            self.browser.contents)
+        ac.owner = u'Anybody'
         self.browser.getControl(name="ac_series").value = sfeseries
         self.browser.getControl(name="ac_number").value = sfenumber
