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: requery_payment.py 1613 2007-03-21 07:18:53Z joachim $ |
---|
11 | """ |
---|
12 | pay online |
---|
13 | """ |
---|
14 | from urllib import urlencode |
---|
15 | import logging |
---|
16 | logger = logging.getLogger('Skins.pay_online') |
---|
17 | import DateTime |
---|
18 | |
---|
19 | if context.portal_membership.isAnonymousUser(): |
---|
20 | return None |
---|
21 | |
---|
22 | request = context.REQUEST |
---|
23 | wftool = context.portal_workflow |
---|
24 | students = context.portal_url.getPortalObject().campus.students |
---|
25 | |
---|
26 | student_id = context.getStudentId() |
---|
27 | student = getattr(students,student_id) |
---|
28 | |
---|
29 | sbrain = context.students_catalog(id=student_id)[0] |
---|
30 | info = {} |
---|
31 | info['site_id'] = '300100100' |
---|
32 | info['currency_id'] = '566' |
---|
33 | |
---|
34 | #from Products.zdb import set_trace;set_trace() |
---|
35 | if student_id is None: |
---|
36 | return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) |
---|
37 | |
---|
38 | if context.portal_url().find('uniben-demo.waeup.org') >-1 or\ |
---|
39 | context.portal_url().find('uniben.waeup.org') >-1: |
---|
40 | info['action'] = "http://www.wemaonlinepayments.biz/querytransaction.aspx" |
---|
41 | else: |
---|
42 | #pass |
---|
43 | #return None |
---|
44 | info['action'] = "%s/payments/%s/simulate_queryatransaction" % (student.absolute_url(),p_id) |
---|
45 | |
---|
46 | |
---|
47 | info['callback_url'] = "%s/payments/%s/epayment_requery_cb" % (student.absolute_url(),p_id) |
---|
48 | payment = context |
---|
49 | if payment.portal_type != 'Payment': |
---|
50 | return |
---|
51 | payment_doc = payment.getContent() |
---|
52 | #from Products.zdb import set_trace;set_trace() |
---|
53 | info['order_id'] = payment_doc.order_id |
---|
54 | info['type_description'] = payment_doc.type_description |
---|
55 | info['pay_bill_to'] = payment_doc.pay_bill_to |
---|
56 | info['amount'] = payment_doc.amount |
---|
57 | logger.info('%(student_id)s requeried online school fee payment for order_id %(order_id)s' % info) |
---|
58 | payment_fields = (('x_SiteID','site_id'), |
---|
59 | ('x_OrderID','order_id'), |
---|
60 | ('x_Redirect_url','callback_url'), |
---|
61 | ) |
---|
62 | args = {} |
---|
63 | for arg,field in payment_fields: |
---|
64 | args[arg] = info[field] |
---|
65 | info['args'] = args |
---|
66 | return context.requery_payment_form(info=info) |
---|