Index: /main/waeup.kofa/trunk/src/waeup/kofa/hostels/vocabularies.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/hostels/vocabularies.py	(revision 9506)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/hostels/vocabularies.py	(revision 9507)
@@ -67,3 +67,9 @@
     (_('Block P'),'P'),
     (_('Block Q'),'Q'),
+    (_('Block R'),'R'),
+    (_('Block S'),'S'),
+    (_('Block T'),'T'),
+    (_('Block U'),'U'),
+    (_('Block V'),'V'),
+    (_('Block W'),'W'),
     )
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 9506)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 9507)
@@ -2480,2 +2480,31 @@
         self.browser.open(self.student_path + '/studycourse/200/ctadd')
         self.assertTrue('The requested form is locked' in self.browser.contents)
+
+
+class PublicPagesTests(StudentsFullSetup):
+    # Tests for swebservices
+
+    layer = FunctionalLayer
+
+    def test_paymentrequest(self):
+        payment = createObject('waeup.StudentOnlinePayment')
+        payment.p_category = u'schoolfee'
+        payment.p_session = self.student.current_session
+        payment.p_item = u'My Certificate'
+        payment.p_id = u'anyid'
+        self.student['payments']['anykey'] = payment
+        # Request information about unpaid payment ticket
+        self.browser.open('http://localhost/app/paymentrequest?P_ID=anyid')
+        self.assertEqual(self.browser.contents, '-1')
+        # Request information about paid payment ticket
+        payment.p_state = u'paid'
+        notify(grok.ObjectModifiedEvent(payment))
+        self.browser.open('http://localhost/app/paymentrequest?P_ID=anyid')
+        self.assertEqual(self.browser.contents,
+            'FULL_NAME=Anna Tester&FACULTY=fac1&DEPARTMENT=dep1'
+            '&PAYMENT_ITEM=My Certificate&PAYMENT_CATEGORY=School Fee'
+            '&ACADEMIC_SESSION=2004/2005&MATRIC_NUMBER=234&FEE_AMOUNT=0.0')
+        self.browser.open('http://localhost/app/paymentrequest?NONSENSE=nonsense')
+        self.assertEqual(self.browser.contents, '-1')
+        self.browser.open('http://localhost/app/paymentrequest?P_ID=nonsense')
+        self.assertEqual(self.browser.contents, '-1')
Index: /main/waeup.kofa/trunk/src/waeup/kofa/webservices.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/webservices.py	(revision 9507)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/webservices.py	(revision 9507)
@@ -0,0 +1,81 @@
+## $Id$
+##
+## Copyright (C) 2012 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
+##
+
+import grok
+from zope.component import getUtility
+from zope.catalog.interfaces import ICatalog
+from waeup.kofa.payments.interfaces import IPaymentWebservice
+from waeup.kofa.interfaces import IUniversity, academic_sessions_vocab
+
+# Kofa's webservices to requery payments from outside
+
+class KofaPaymentRequest(grok.View):
+
+    grok.context(IUniversity)
+    grok.name('paymentrequest')
+    grok.require('waeup.Public')
+
+    #ACCEPTED_IP = ('174.36.230.28', )
+    ACCEPTED_IP = ('127.0.0.1', )
+    
+    def update(self, P_ID=None):
+        if P_ID == None:
+            self.output = '-1'
+            return
+        real_ip = self.request.get('HTTP_X_FORWARDED_FOR', None)
+        if real_ip:
+            self.context.logger.info('KofaPaymentRequest called: %s' % real_ip)
+        if real_ip and self.ACCEPTED_IP:
+            if real_ip not in  self.ACCEPTED_IP:
+                self.output = '-4'
+                return
+        cat = getUtility(ICatalog, name='payments_catalog')
+        results = list(
+            cat.searchResults(p_id=(P_ID, P_ID), p_state=('paid', 'paid')))
+        if len(results) != 1:
+            self.output = '-1'
+            return
+        try:
+            owner = IPaymentWebservice(results[0])
+            full_name = owner.display_fullname
+            matric_number = owner.reg_or_matric_number
+            faculty = owner.faculty
+            department = owner.department
+        except (TypeError, AttributeError):
+            self.output = '-3'
+            return
+        amount = results[0].amount_auth
+        payment_category = results[0].category
+        payment_item = results[0].p_item
+        academic_session = academic_sessions_vocab.getTerm(
+            results[0].p_session).title
+        self.output = (
+            'FULL_NAME=%s&' +
+            'FACULTY=%s&' +
+            'DEPARTMENT=%s&' +
+            'PAYMENT_ITEM=%s&' +
+            'PAYMENT_CATEGORY=%s&' +
+            'ACADEMIC_SESSION=%s&' +
+            'MATRIC_NUMBER=%s&' +
+            'FEE_AMOUNT=%s') % (full_name, faculty,
+            department, payment_item, payment_category,
+            academic_session, matric_number, amount)
+        return
+
+    def render(self):
+        return self.output
