Index: WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py	(revision 1274)
+++ WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py	(revision 1274)
@@ -0,0 +1,77 @@
+## Script (Python) "pay_by_sc"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+pay online
+"""
+import logging
+from urllib import urlencode
+logger = logging.getLogger('EPayment.')
+import DateTime
+lt = context.portal_layouts
+request = context.REQUEST
+students = context.portal_url.getPortalObject().campus.students
+
+student_id = context.getStudentId()
+if student_id is None:
+    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
+
+student = getattr(students,student_id)
+sbrain = context.students_catalog(id=student_id)[0]
+amount,description = context.getSchoolFee(sbrain.faculty)
+validate = request.has_key("cpsdocument_edit_button")
+res,psm,ds = lt.renderLayout(layout_id= 'student_schoolfee',
+                      schema_id= 'epayment',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode="create",
+                      formaction = "pay_by_sc",
+                      button = 'Pay'
+                      )
+if psm == 'invalid':
+    psm = 'Please correct your errors!'
+    return context.pay_by_sc_form(rendered = res,
+                                 psm = psm,
+                                 mode = 'edit',
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.pay_by_sc_form(rendered = res,
+                                 psm = None,
+                                 mode = 'edit',
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+if "payments" not in student.objectIds():
+    student.invokeFactory('PaymentsFolder','payments')
+    payments = getattr(student,'payments')
+    d = {}
+    d['Title'] = 'Payments'
+    payments.getContent().edit(mapping=d)
+    wftool.doActionFor(payments,'open')
+else:
+    payments = getattr(student,'payments')
+info = {}
+order_id = info['order_id'] = ds.get('payment_id')
+p_id = "p%s" % order_id
+now = DateTime.DateTime()
+info['date'] = now
+info['type_code'] = "schoolfee_%s"
+info['type_code'] = 'description'
+info['amount'] = amount
+payments.invokeFactory('Payment', p_id)
+payment = getattr(payments,p_id)
+#from Products.zdb import set_trace;set_trace()
+payment.getContent().edit(mapping=info)
+url = "%s/payments/%s" % (student.absolute_url(),p_id)
+request.RESPONSE.redirect(url)
+
