Index: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_catalog.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_catalog.py	(revision 8699)
+++ main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_catalog.py	(revision 8700)
@@ -21,4 +21,6 @@
 import shutil
 import tempfile
+import grok
+from zope.component import getUtility, createObject
 from hurry.query import Eq
 from hurry.query.interfaces import IQuery
@@ -86,2 +88,30 @@
         self.assertTrue(isinstance(result_applicant, Applicant))
         self.assertEqual(result_applicant.applicant_id, self.applicant.applicant_id)
+
+    def test_get_payment(self):
+        self.create_applicant()
+        q = getUtility(IQuery)
+        subquery = Eq(('applicants_catalog', 'applicant_id'),
+            self.applicant.applicant_id)
+        results = list(q.searchResults(subquery))
+        self.assertEqual(len(results), 1)
+        result_applicant = results[0]
+        payment = createObject('waeup.ApplicantOnlinePayment')
+        payment.p_id = 'p1234567890'
+        payment.p_item = u'Payment Item'
+        payment.p_session = 2011
+        payment.p_category = 'application'
+        result_applicant[payment.p_id] = payment
+        # We can find a payment ticket by the payment session ...
+        cat = getUtility(ICatalog, name='payments_catalog')
+        results = cat.searchResults(p_session=(2011, 2011))
+        results = [x for x in results] # Turn results generator into list
+        assert len(results) == 1
+        assert results[0] is result_applicant['p1234567890']
+        # ... and by the payment id
+        results = cat.searchResults(p_id=('p1234567890', 'p1234567890'))
+        assert len(results) == 1
+        # If we remove the applicant also the payment disappears
+        del self.app['applicants']['mystuff'][result_applicant.application_number]
+        results = cat.searchResults(p_id=('p1234567890', 'p1234567890'))
+        assert len(results) == 0
Index: main/waeup.kofa/trunk/src/waeup/kofa/payments/catalog.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/payments/catalog.py	(revision 8700)
+++ main/waeup.kofa/trunk/src/waeup/kofa/payments/catalog.py	(revision 8700)
@@ -0,0 +1,35 @@
+## $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
+##
+"""Components to help cataloging and searching payments.
+"""
+import grok
+from waeup.kofa.interfaces import IUniversity
+from waeup.kofa.payments.interfaces import IPayment
+
+class PaymentIndexes(grok.Indexes):
+    """A catalog for all payments.
+    """
+    grok.site(IUniversity)
+    grok.name('payments_catalog')
+    grok.context(IPayment)
+
+    p_id = grok.index.Field(attribute='p_id')
+    p_session = grok.index.Field(attribute='p_session')
+    p_category = grok.index.Field(attribute='p_category')
+    p_item = grok.index.Field(attribute='p_item')
+    p_state = grok.index.Field(attribute='p_state')
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py	(revision 8699)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py	(revision 8700)
@@ -26,6 +26,5 @@
 from waeup.kofa.interfaces import (
     IUniversity, IQueryResultItem, academic_sessions_vocab)
-from waeup.kofa.students.interfaces import (IStudent, ICourseTicket,
-    IStudentOnlinePayment)
+from waeup.kofa.students.interfaces import IStudent, ICourseTicket
 from waeup.kofa.university.vocabularies import course_levels
 
@@ -129,14 +128,2 @@
     session = index.Field(attribute='getLevelSession')
     code = index.Field(attribute='code')
-
-class StudentPaymentIndexes(grok.Indexes):
-    """A catalog for payments.
-    """
-    grok.site(IUniversity)
-    grok.name('payments_catalog')
-    grok.context(IStudentOnlinePayment)
-
-    p_session = index.Field(attribute='p_session')
-    p_category = index.Field(attribute='p_category')
-    p_item = index.Field(attribute='p_item')
-    p_state = index.Field(attribute='p_state')
