source: WAeUP_SRP/trunk/skins/waeup_uniben/pay_etranzact_accept.py @ 8121

Last change on this file since 8121 was 8121, checked in by Henrik Bettermann, 12 years ago

Increase acceptance fee.

  • Property svn:keywords set to Id
File size: 2.8 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_etranzact_accept.py 8121 2012-04-12 09:01:44Z henrik $
11"""
12pay online
13"""
14from urllib import urlencode
15import logging
16logger = logging.getLogger('Skins.pay_etranzact_accept')
17import DateTime
18
19if context.portal_membership.isAnonymousUser():
20    return None
21
22try:
23    from Products.zdb import set_trace
24except:
25    def set_trace():
26        pass
27request = context.REQUEST
28wftool = context.portal_workflow
29students = context.portal_url.getPortalObject().campus.students
30
31
32student_id = context.getStudentId()
33student = getattr(students,student_id)
34
35student_record = context.students_catalog.getRecordByKey(student_id)
36#amount,description = context.getSchoolFee(student_record.faculty,student_record.session,student_record.course)
37info = {}
38info['action'] = 'pay_etranzact_accept'
39info['student'] = student_record
40info['payment_possible'] = False
41info['amount'] = '0'
42info['bank'] = ''
43info['type_description'] = ''
44info['pay_bill_to'] = ''
45
46amount = info['amount'] = 34250
47
48
49info['surcharge'] = '0'  # Uniben doesn't show the surcharge on the slip
50info['payment_possible'] = True
51info['type_description'] = 'Acceptance Fee'
52info['pay_bill_to'] = student_record.name
53info['pay_ship_to'] = "University of Benin"
54info['student_id'] = student_id
55info['student_name'] = student_record.name
56info['student_email'] = student_record.email
57#info['session_id'] = student_record.session   # this holds only for new students und must be replaced when also previous session students will pay online !!!!!!
58info['session_id'] = student_record.session
59info['type'] = 'etranzact'
60info['status'] = 'started'
61info['item'] = student_record.course
62info['category'] = 'acceptance'
63now = DateTime.DateTime()
64info['date'] = now
65timestamp = "%d" % int(now.timeTime()*1000)
66info['order_id'] = "%s%s" % (student_id[1:],timestamp)
67p_id = "p%s" % timestamp
68
69if student_id is None:
70    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
71
72if "payments" not in student.objectIds():
73    student.invokeFactory('PaymentsFolder','payments')
74    payments = getattr(student,'payments')
75    d = {}
76    d['Title'] = 'Payments'
77    payments.getContent().edit(mapping=d)
78    wftool.doActionFor(payments,'open')
79else:
80    payments = getattr(student,'payments')
81if request.has_key('epayment'):
82    return context.etranzact_form(info=info)
83
84payments.invokeFactory('Payment', p_id)
85payment = getattr(payments,p_id)
86wftool.doActionFor(payment,'open')
87d = {}
88d.update(info)
89payment.getContent().edit(mapping=d)
90logger.info('%(student_id)s initiated eTranzact acceptance fee payment with order_id %(order_id)s' % info)
91
92return context.payments_view()
Note: See TracBrowser for help on using the repository browser.