Index: /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py
===================================================================
--- /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py	(revision 12700)
+++ /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py	(revision 12701)
@@ -2,5 +2,5 @@
 from waeup.ikoba.interfaces import MessageFactory as _
 from waeup.ikoba.payments.interfaces import IPaymentGatewayService
-from waeup.ikoba.payments.payment import Payment
+from waeup.ikoba.payments.payment import Payment, get_payment
 
 
@@ -21,5 +21,18 @@
         payment.gateway_service = 'demo_creditcard'  # must be grok.name above
         payment.payer_id = payer.payer_id
+        # XXX: we should not have to store a payment before adding items
+        site = grok.getSite()
+        site['payments'][payment.payment_id] = payment
         for item in payment_item_list:
             payment.add_payment_item(item)
         return payment
+
+    def next_step(self, payment_id):
+        """Tell where to go next.
+
+        Returns (context, view_name). Both may be none.
+        """
+        payment = get_payment(payment_id)
+        if payment is None:
+            return None, None
+        return payment, 'index'
Index: /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/interfaces.py
===================================================================
--- /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/interfaces.py	(revision 12700)
+++ /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/interfaces.py	(revision 12701)
@@ -102,4 +102,10 @@
         """
 
+    def next_step(payment_id):
+        """Returns a payment (as context) and a view name.
+
+        May result in (None, None).
+        """
+
 
 class IPaymentGatewayServicesLister(Interface):
Index: /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_demo_provider.py
===================================================================
--- /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_demo_provider.py	(revision 12700)
+++ /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_demo_provider.py	(revision 12701)
@@ -1,3 +1,5 @@
 import decimal
+from zope.component import queryUtility
+from zope.component.hooks import setSite
 from zope.interface.verify import verifyClass, verifyObject
 from waeup.ikoba.testing import (
@@ -7,5 +9,6 @@
     IPaymentGatewayService, IPayment, STATE_UNPAID,
     )
-from waeup.ikoba.payments.payment import Payer, PaymentItem, Payee
+from waeup.ikoba.app import Company
+from waeup.ikoba.payments.payment import Payer, PaymentItem, Payee, Payment
 from waeup.ikoba.payments.demo_provider import (
     DemoCreditcardPaymentService,
@@ -16,4 +19,10 @@
 
     layer = FunctionalLayer
+
+    def setUp(self):
+        super(DemoCreditcarPaymentServiceTests, self).setUp()
+        self.app = Company()
+        self.getRootFolder()['app'] = self.app
+        setSite(self.app)
 
     def test_iface(self):
@@ -56,6 +65,20 @@
     def test_get_service_by_utility_name(self):
         # we can get the demo credit card service by its utility name
-        from zope.component import queryUtility
         service = queryUtility(
             IPaymentGatewayService, name="demo_creditcard")
         assert service is not None
+
+    def test_next_step_invalid_id(self):
+        # we cannot go to non-existent payments
+        service = DemoCreditcardPaymentService()
+        result = service.next_step('not-existent-payment-id')
+        assert result == (None, None)
+
+    def test_next_step(self):
+        # we are redirected to 'index' in the beginning
+        service = DemoCreditcardPaymentService()
+        p1 = Payment()
+        self.app['payments']['1'] = p1
+        p_id = p1.payment_id
+        result = service.next_step(p_id)
+        assert result == (p1, 'index')
