Index: main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py
===================================================================
--- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py	(revision 12703)
+++ main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/browser.py	(revision 12704)
@@ -18,17 +18,11 @@
 """UI components for customers and related components.
 """
-
-import sys
 import grok
-import pytz
 import os
 from urllib import urlencode
-from datetime import datetime
 from zope.event import notify
 from zope.i18n import translate
 from zope.catalog.interfaces import ICatalog
 from zope.component import queryUtility, getUtility, createObject
-from zope.schema.interfaces import ConstraintNotSatisfied, RequiredMissing
-from zope.formlib.textwidgets import BytesDisplayWidget
 from zope.security import checkPermission
 from hurry.workflow.interfaces import (
@@ -42,24 +36,26 @@
 from waeup.ikoba.browser.layout import (
     IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage,
-    IkobaForm, NullValidator, jsaction, action, UtilityView)
-from waeup.ikoba.widgets.datewidget import (
-    FriendlyDateWidget, FriendlyDateDisplayWidget,
-    FriendlyDatetimeDisplayWidget)
+    NullValidator, jsaction, action, UtilityView)
 from waeup.ikoba.browser.pages import ContactAdminForm
 from waeup.ikoba.browser.breadcrumbs import Breadcrumb
 from waeup.ikoba.browser.interfaces import ICaptchaManager
 from waeup.ikoba.mandates.mandate import PasswordMandate
-from waeup.ikoba.payments.interfaces import IPaymentGatewayServicesLister
+from waeup.ikoba.payments.payment import format_payment_item_values
+from waeup.ikoba.payments.interfaces import (
+    IPaymentGatewayServicesLister, IPaymentGatewayService, IPayer
+    )
 from waeup.ikoba.widgets.hrefwidget import HREFDisplayWidget
 from waeup.ikoba.utils.helpers import (
-    get_current_principal, to_timezone, now, format_date)
+    get_current_principal, format_date)
 from waeup.ikoba.customers.interfaces import (
     ICustomer, ICustomersContainer, ICustomerRequestPW, ICustomersUtils,
     ICustomerDocument, ICustomerDocumentsContainer, ICustomerCreate,
     ICustomerPDFDocument, IContractsContainer, IContract,
-    IContractSelectProduct, ISampleContract,
+    IContractSelectProduct,
     )
 from waeup.ikoba.customers.catalog import search
 from waeup.ikoba.customers.workflow import PAYMENT_TRANSITIONS
+from waeup.ikoba.customers.contracts import payment_items_from_contract
+
 
 grok.context(IIkobaObject)
@@ -928,5 +924,4 @@
     def createDocument(self, **data):
         form = self.request.form
-        customer = self.context.__parent__
         doctype = form.get('doctype', None)
         # Here we can create various instances of CustomerDocument derived 
@@ -1099,5 +1094,4 @@
         tableheader = []
         tabledata = []
-        contenttitle = []
         for i in range(1,3):
             tabledata.append(sorted(
@@ -1135,5 +1129,4 @@
     @property
     def label(self):
-        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
         return '%s of %s\nTitle: %s' % (
             self.context.translated_class_name,
@@ -1142,5 +1135,4 @@
 
     def render(self):
-        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
         customerview = CustomerBasePDFFormPage(self.context.customer,
             self.request, self.omit_fields)
@@ -1158,5 +1150,4 @@
 
     def render(self):
-        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
         customerview = CustomerBasePDFFormPage(self.context.customer,
             self.request, self.omit_fields)
@@ -1296,5 +1287,4 @@
     def createContract(self, **data):
         form = self.request.form
-        customer = self.context.__parent__
         contype = form.get('contype', None)
         # Here we can create various instances of Contract derived
@@ -1534,6 +1524,19 @@
                        type='warning')
         else:
+
+            service = queryUtility(IPaymentGatewayService, name=self.gw)
+            if service is None:
+                self.flash(_('Invalid payment gateway.'), type='danger')
+                return
+            payer = IPayer(self.context)
+            payment_items = payment_items_from_contract(self.context)
+            payment = service.create_payment(payer, payment_items)
+            payment, view_name = service.next_step(payment.payment_id)
+            url = self.url(payment, view_name)
+            self.flash(_('Payment has been initiated.'))
             IWorkflowInfo(self.context).fireTransition('await')
-            self.flash(_('Payment has been initiated.'))
+            self.redirect(url)
+            return
+
         return
 
@@ -1618,5 +1621,4 @@
         tableheader = []
         tabledata = []
-        contenttitle = []
         for i in range(1,3):
             tabledata.append(sorted(
@@ -1673,5 +1675,4 @@
     @property
     def label(self):
-        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
         return self.context.title
 
@@ -1688,5 +1689,4 @@
 
     def render(self):
-        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
         customerview = CustomerBasePDFFormPage(self.context.customer,
             self.request, self.omit_fields)
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 12703)
+++ main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/demo_provider.py	(revision 12704)
@@ -1,6 +1,10 @@
 import grok
 from waeup.ikoba.interfaces import MessageFactory as _
-from waeup.ikoba.payments.interfaces import IPaymentGatewayService
+from waeup.ikoba.browser.layout import IkobaPage
+from waeup.ikoba.payments.interfaces import IPaymentGatewayService, IPayment
 from waeup.ikoba.payments.payment import Payment, get_payment
+
+
+grok.templatedir('templates')
 
 
@@ -36,3 +40,16 @@
         if payment is None:
             return None, None
-        return payment, 'index'
+        return payment, 'demo_cc1'
+
+
+class CreditCardStep1(IkobaPage):
+    grok.context(IPayment)
+    grok.name('demo_cc1')
+    grok.require('waeup.Public')
+    #grok.require('waeup.handleCustomer')
+    label = "Enter Credit Card Details"
+    grok.template('demo_cc_step1')
+    pnav = 0
+
+    def update(self):
+        print "UPDATE"
Index: main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/templates/demo_cc_step1.pt
===================================================================
--- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/templates/demo_cc_step1.pt	(revision 12704)
+++ main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/templates/demo_cc_step1.pt	(revision 12704)
@@ -0,0 +1,9 @@
+<p>
+  Enter your Credit Card Details here...
+</p>
+<!--
+
+  Here we will get a form with action target at the gateway providers
+  site. As demo provider is fake, we can send people to ourselves.
+
+-->
