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

Last change on this file since 15362 was 8295, checked in by Henrik Bettermann, 13 years ago

if student_record.course in ('BEDCET', 'BIOEDCET', 'CHMEDCET', 'ISEDCET',

'MTHEDCET', 'PHYEDCET', 'ITECET', 'AGREDCET', 'HEEDCET'):
amount = infoamount? = 17250

else:

amount = infoamount? = 34250

  • Property svn:keywords set to Id
File size: 3.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_etranzact_accept.py 8295 2012-04-27 10:51:33Z 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
46if student_record.course in ('BEDCET', 'BIOEDCET', 'CHMEDCET', 'ISEDCET',
47    'MTHEDCET', 'PHYEDCET', 'ITECET', 'AGREDCET', 'HEEDCET'):
48    amount = info['amount'] = 17250
49else:
50    amount = info['amount'] = 34250
51
52info['surcharge'] = '0'  # Uniben doesn't show the surcharge on the slip
53info['payment_possible'] = True
54info['type_description'] = 'Acceptance Fee'
55info['pay_bill_to'] = student_record.name
56info['pay_ship_to'] = "University of Benin"
57info['student_id'] = student_id
58info['student_name'] = student_record.name
59info['student_email'] = student_record.email
60#info['session_id'] = student_record.session   # this holds only for new students und must be replaced when also previous session students will pay online !!!!!!
61info['session_id'] = student_record.session
62info['type'] = 'etranzact'
63info['status'] = 'started'
64info['item'] = student_record.course
65info['category'] = 'acceptance'
66now = DateTime.DateTime()
67info['date'] = now
68timestamp = "%d" % int(now.timeTime()*1000)
69info['order_id'] = "%s%s" % (student_id[1:],timestamp)
70p_id = "p%s" % timestamp
71
72if student_id is None:
73    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
74
75if "payments" not in student.objectIds():
76    student.invokeFactory('PaymentsFolder','payments')
77    payments = getattr(student,'payments')
78    d = {}
79    d['Title'] = 'Payments'
80    payments.getContent().edit(mapping=d)
81    wftool.doActionFor(payments,'open')
82else:
83    payments = getattr(student,'payments')
84if request.has_key('epayment'):
85    return context.etranzact_form(info=info)
86
87payments.invokeFactory('Payment', p_id)
88payment = getattr(payments,p_id)
89wftool.doActionFor(payment,'open')
90d = {}
91d.update(info)
92payment.getContent().edit(mapping=d)
93logger.info('%(student_id)s initiated eTranzact acceptance fee payment with order_id %(order_id)s' % info)
94
95return context.payments_view()
Note: See TracBrowser for help on using the repository browser.