##Script (Python) "pay_online" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # $Id: pay_etranzact_accept.py 8121 2012-04-12 09:01:44Z henrik $ """ pay online """ from urllib import urlencode import logging logger = logging.getLogger('Skins.pay_etranzact_accept') import DateTime if context.portal_membership.isAnonymousUser(): return None try: from Products.zdb import set_trace except: def set_trace(): pass request = context.REQUEST wftool = context.portal_workflow students = context.portal_url.getPortalObject().campus.students student_id = context.getStudentId() student = getattr(students,student_id) student_record = context.students_catalog.getRecordByKey(student_id) #amount,description = context.getSchoolFee(student_record.faculty,student_record.session,student_record.course) info = {} info['action'] = 'pay_etranzact_accept' info['student'] = student_record info['payment_possible'] = False info['amount'] = '0' info['bank'] = '' info['type_description'] = '' info['pay_bill_to'] = '' amount = info['amount'] = 34250 info['surcharge'] = '0' # Uniben doesn't show the surcharge on the slip info['payment_possible'] = True info['type_description'] = 'Acceptance Fee' info['pay_bill_to'] = student_record.name info['pay_ship_to'] = "University of Benin" info['student_id'] = student_id info['student_name'] = student_record.name info['student_email'] = student_record.email #info['session_id'] = student_record.session # this holds only for new students und must be replaced when also previous session students will pay online !!!!!! info['session_id'] = student_record.session info['type'] = 'etranzact' info['status'] = 'started' info['item'] = student_record.course info['category'] = 'acceptance' now = DateTime.DateTime() info['date'] = now timestamp = "%d" % int(now.timeTime()*1000) info['order_id'] = "%s%s" % (student_id[1:],timestamp) p_id = "p%s" % timestamp if student_id is None: return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 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') if request.has_key('epayment'): return context.etranzact_form(info=info) payments.invokeFactory('Payment', p_id) payment = getattr(payments,p_id) wftool.doActionFor(payment,'open') d = {} d.update(info) payment.getContent().edit(mapping=d) logger.info('%(student_id)s initiated eTranzact acceptance fee payment with order_id %(order_id)s' % info) return context.payments_view()