source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_epayment/requery_payment.py @ 17415

Last change on this file since 17415 was 1669, checked in by joachim, 18 years ago

merged up to 1664

  • Property svn:keywords set to Id
File size: 2.0 KB
RevLine 
[1613]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 1669 2007-04-04 06:31:52Z joachim $
11"""
[1620]12requery online-payment
[1613]13"""
14from urllib import urlencode
15import logging
[1620]16logger = logging.getLogger('Skins.requery_payment')
[1613]17import DateTime
18
19if context.portal_membership.isAnonymousUser():
20    return None
21
22request = context.REQUEST
23wftool = context.portal_workflow
24students = context.portal_url.getPortalObject().campus.students
25
26student_id = context.getStudentId()
27student = getattr(students,student_id)
28
29sbrain = context.students_catalog(id=student_id)[0]
30info = {}
31info['site_id'] = '300100100'
32info['currency_id'] = '566'
33
34#from Products.zdb import set_trace;set_trace()
35if student_id is None:
36    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
37
38if 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"
41else:
42    #pass
43    #return None
44    info['action'] = "%s/payments/%s/simulate_queryatransaction" % (student.absolute_url(),p_id)
45
46
47payment = context
48if payment.portal_type != 'Payment':
49    return
50payment_doc = payment.getContent()
51#from Products.zdb import set_trace;set_trace()
[1620]52info['order_id'] = p_id = payment_doc.order_id
53info['callback_url'] = "%s/payments/%s/epayment_requery_cb" % (student.absolute_url(),p_id)
[1613]54info['type_description'] = payment_doc.type_description
55info['amount'] = payment_doc.amount
[1620]56info['student_id'] = student_id
[1613]57logger.info('%(student_id)s requeried online school fee payment for order_id %(order_id)s' % info)
58payment_fields = (('x_SiteID','site_id'),
59                  ('x_OrderID','order_id'),
60                  ('x_Redirect_url','callback_url'),
61                  )
62args = {}
63for arg,field in payment_fields:
64    args[arg] = info[field]
65info['args'] = args
66return context.requery_payment_form(info=info)
Note: See TracBrowser for help on using the repository browser.