source: WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment.py @ 17669

Last change on this file since 17669 was 1653, checked in by uli, 18 years ago

Incorporated changeset 1593:1652 of trunk into uli-branch.

  • 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 1653 2007-03-28 02:35:25Z uli $
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.