source: WAeUP_SRP/trunk/skins/waeup_epayment/pay_online.py @ 1225

Last change on this file since 1225 was 1224, checked in by joachim, 18 years ago

added and changed EPayment Modules

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## Script (Python) "pay_online"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: pay_online.py 1224 2007-01-07 15:20:56Z joachim $
11"""
12pay online
13"""
14import logging
15logger = logging.getLogger('EPayment.')
16import DateTime
17import time
18
19request = context.REQUEST
20students = context.portal_url.getPortalObject().campus.students
21
22student_id = context.getStudentId()
23if student_id is None:
24    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
25
26student = getattr(students,student_id)
27sbrain = context.students_catalog(id=student_id)[0]
28res = context.portal_catalog(portal_type="Certificate",
29                                     id = sbrain.course)
30if not res:
31    return None
32sfc = res[0].getObject().getContent().school_fee_code
33info = {}
34info['type_code'] = "ART" #sfc
35info['type_description'] = "Schoolfee %s for 2006/2007 Session" % sfc
36info['pay_bill_to'] = sbrain.name
37info['pay_ship_to'] = "University of Benin"
38info['student_id'] = student_id
39info['student_name'] = sbrain.name
40info['student_email'] = sbrain.email
41info['pay_date'] = DateTime.DateTime().strftime("%d%m%y%H%M%S")
42order_id = info['order_id'] = "%d" % int(time.time()*1000)
43info['order_id'] = "%s%s" % (student_id[1:],order_id)
44info['amount'] = "75000"
45if "payments" not in student.objectIds():
46    student.invokeFactory('PaymentsFolder','payment')
47    payments = getattr(student,'payments')
48    d = {}
49    d['Title'] = 'Online Payments'
50    payment.getContent().edit(mapping=d)
51else:
52    payments = getattr(student,'payments')
53p_id = "p%s" % order_id
54payments.invokeFactory('Payment', p_id)
55payment = getattr(payments,p_id)
56d = {}
57d.update(info)
58d['Title'] = "%(payment_type_description)s %(pay_date) %(amount)s N" % info
59payment.getContent().edit(mapping=d)
60info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id)
61logger.info('"%(student_id)s","%(payment_type_description)s", "%(amount)s N"' % info)
62return context.wema_form(info=info)
Note: See TracBrowser for help on using the repository browser.