Index: main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 8204)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 8247)
@@ -19,5 +19,7 @@
 from zope.formlib.textwidgets import BytesDisplayWidget
 from zope.component import getUtility
+from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
 from waeup.kofa.interfaces import IExtFileStore
+from waeup.kofa.browser.layout import action
 from waeup.kofa.students.browser import (
     StudentPersonalDisplayFormPage,
@@ -25,13 +27,21 @@
     StudentClearanceDisplayFormPage, OnlinePaymentCallbackPage,
     ExportPDFClearanceSlipPage, StudentBaseManageFormPage,
-    StudentBaseEditFormPage, StudentPersonalEditFormPage)
+    StudentBaseEditFormPage, StudentPersonalEditFormPage,
+    OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage,
+    OnlinePaymentBreadcrumb)
 from waeup.kofa.students.viewlets import RequestCallbackActionButton
 from waeup.uniben.students.interfaces import (
     ICustomStudentBase, ICustomStudent, ICustomStudentPersonal,
     ICustomUGStudentClearance,ICustomPGStudentClearance,
+    ICustomStudentOnlinePayment,
     )
 from waeup.uniben.interfaces import MessageFactory as _
 
-class CustomRequestCallbackActionButton(RequestCallbackActionButton):
+class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
+    """A breadcrumb for payments.
+    """
+    grok.context(ICustomStudentOnlinePayment)
+
+class RequestCallbackActionButton(RequestCallbackActionButton):
     """ Do not display the base package callback button in custom pages.
     """
@@ -144,2 +154,30 @@
         return False
 
+class CustomOnlinePaymentDisplayFormPage(OnlinePaymentDisplayFormPage):
+    """ Page to view an online payment ticket
+    """
+    grok.context(ICustomStudentOnlinePayment)
+    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
+    form_fields[
+        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+    form_fields[
+        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+    grok.template('payment_view')
+
+    @property
+    def transaction_code(self):
+        tcode = self.context.p_id
+        return tcode[len(tcode)-8:len(tcode)]
+
+class CustomOnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
+    """ Page to add an online payment ticket
+    """
+    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
+        'p_category')
+    factory = u'waeup.CustomStudentOnlinePayment'
+
+    def _fillCustomFields(self, payment, pay_details):
+        payment.surcharge_1 = pay_details['surcharge_1']
+        payment.surcharge_2 = pay_details['surcharge_2']
+        payment.surcharge_3 = pay_details['surcharge_3']
+        return payment
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/browser_templates/payment_view.pt
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/browser_templates/payment_view.pt	(revision 8247)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/browser_templates/payment_view.pt	(revision 8247)
@@ -0,0 +1,18 @@
+<table class="form-table" i18n:domain="waeup.uniben"
+  tal:define="files provider:files">
+  <tbody>
+    <tal:widgets content="structure provider:widgets" />
+    <tr tal:condition="python: files.replace('\n','')">
+      <td class="separator" colspan=2 i18n:translate="">
+        Uploaded Files
+      </td>
+    </tr>
+    <tal:files content="structure files" />
+    <tr>
+      <td class="fieldname">
+        <span i18n:translate="">Transaction Code</span>:
+      </td>
+      <td tal:content="view/transaction_code">TRANSACTIONCODE</td>
+    </tr>
+  </tbody>
+</table>
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 8204)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 8247)
@@ -18,5 +18,5 @@
 from zope import schema
 from waeup.kofa.schema import TextLineChoice
-from waeup.kofa.interfaces import SimpleKofaVocabulary
+from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
 from waeup.kofa.schema import FormattedDate
 from waeup.kofa.schoolgrades import ResultEntryField
@@ -31,4 +31,5 @@
     lgas_vocab, high_qual, high_grade, exam_types)
 from waeup.uniben.interfaces import MessageFactory as _
+from waeup.uniben.payments.interfaces import ICustomOnlinePayment
 
 class ICustomStudentBase(IStudentBase):
@@ -339,2 +340,7 @@
 
     """
+
+class ICustomStudentOnlinePayment(ICustomOnlinePayment):
+    """A student payment via payment gateways.
+
+    """
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/payments.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/payments.py	(revision 8247)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/payments.py	(revision 8247)
@@ -0,0 +1,57 @@
+## $Id$
+##
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Student payment components.
+"""
+import grok
+from zope.component.interfaces import IFactory
+from zope.interface import implementedBy
+from waeup.kofa.students.interfaces import IStudentNavigation
+from waeup.kofa.payments import PaymentsContainer, OnlinePayment
+from waeup.kofa.utils.helpers import attrs_to_fields
+from waeup.uniben.students.interfaces import ICustomStudentOnlinePayment
+
+class CustomStudentOnlinePayment(OnlinePayment):
+    """This is an online payment.
+    """
+    grok.implements(ICustomStudentOnlinePayment, IStudentNavigation)
+    grok.provides(ICustomStudentOnlinePayment)
+
+    def __init__(self):
+        super(CustomStudentOnlinePayment, self).__init__()
+        return
+
+    def getStudent(self):
+        return self.__parent__.__parent__
+
+CustomStudentOnlinePayment = attrs_to_fields(CustomStudentOnlinePayment)
+
+# Student online payments must be importable. So we might need a factory.
+class CustomStudentOnlinePaymentFactory(grok.GlobalUtility):
+    """A factory for student online payments.
+    """
+    grok.implements(IFactory)
+    grok.name(u'waeup.CustomStudentOnlinePayment')
+    title = u"Create a new online payment.",
+    description = u"This factory instantiates new online payment instances."
+
+    def __call__(self, *args, **kw):
+        return CustomStudentOnlinePayment()
+
+    def getInterfaces(self):
+        return implementedBy(CustomStudentOnlinePayment)
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 8204)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 8247)
@@ -20,4 +20,5 @@
 from waeup.kofa.students.utils import StudentsUtils
 from waeup.kofa.students.interfaces import IStudentsUtils
+from waeup.kofa.accesscodes import create_accesscode
 from waeup.uniben.interfaces import MessageFactory as _
 
@@ -41,4 +42,32 @@
     else:
         return 0.0
+
+def actions_after_student_payment(student, payment, view):
+    if payment.p_category == 'clearance':
+        # Create CLR access code
+        pin, error = create_accesscode('CLR',0,student.student_id)
+        if error:
+            view.flash(_('Valid callback received. ${a}',
+                mapping = {'a':error}))
+            return
+        payment.ac = pin
+    elif payment.p_category == 'schoolfee':
+        # Create SFE access code
+        pin, error = create_accesscode('SFE',0,student.student_id)
+        if error:
+            view.flash(_('Valid callback received. ${a}',
+                mapping = {'a':error}))
+            return
+        payment.ac = pin
+    elif payment.p_category == 'bed_allocation':
+        # Create HOS access code
+        pin, error = create_accesscode('HOS',0,student.student_id)
+        if error:
+            view.flash(_('Valid callback received. ${a}',
+                mapping = {'a':error}))
+            return
+        payment.ac = pin
+    view.flash(_('Valid callback received.'))
+    return
 
 class CustomStudentsUtils(StudentsUtils):
