[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 1620 2007-03-22 20:52:27Z joachim $ |
---|
| 11 | """ |
---|
[1620] | 12 | requery online-payment |
---|
[1613] | 13 | """ |
---|
| 14 | from urllib import urlencode |
---|
| 15 | import logging |
---|
[1620] | 16 | logger = logging.getLogger('Skins.requery_payment') |
---|
[1613] | 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 | payment = context |
---|
| 48 | if payment.portal_type != 'Payment': |
---|
| 49 | return |
---|
| 50 | payment_doc = payment.getContent() |
---|
| 51 | #from Products.zdb import set_trace;set_trace() |
---|
[1620] | 52 | info['order_id'] = p_id = payment_doc.order_id |
---|
| 53 | info['callback_url'] = "%s/payments/%s/epayment_requery_cb" % (student.absolute_url(),p_id) |
---|
[1613] | 54 | info['type_description'] = payment_doc.type_description |
---|
| 55 | info['amount'] = payment_doc.amount |
---|
[1620] | 56 | info['student_id'] = student_id |
---|
[1613] | 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) |
---|