[1224] | 1 | ## Script (Python) "epayment_cb" |
---|
| 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: epayment_cb.py 1224 2007-01-07 15:20:56Z joachim $ |
---|
| 11 | """ |
---|
| 12 | payment callback |
---|
| 13 | """ |
---|
| 14 | import logging |
---|
| 15 | logger = logging.getLogger('EPayment.') |
---|
| 16 | import DateTime |
---|
| 17 | |
---|
| 18 | request = context.REQUEST |
---|
| 19 | students = context.portal_url.getPortalObject().campus.students |
---|
| 20 | |
---|
| 21 | student_id = context.getStudentId() |
---|
| 22 | if student_id is None: |
---|
| 23 | return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) |
---|
| 24 | |
---|
| 25 | student = getattr(students,student_id) |
---|
| 26 | sbrain = context.students_catalog(id=student_id)[0] |
---|
| 27 | res = context.portal_catalog(portal_type="Certificate", |
---|
| 28 | id = sbrain.course) |
---|
| 29 | if not res: |
---|
| 30 | return None |
---|
| 31 | |
---|
| 32 | resp_codes = (("x_RespDesc","resp_description"), |
---|
| 33 | ("x_RespPayRef","resp_pay_reference"), |
---|
| 34 | ("x_RespCode","resp_code"), |
---|
| 35 | ("x_CardNum","resp_card_num"), |
---|
| 36 | ("x_ApprAmt","resp_approved_amount"), |
---|
| 37 | ) |
---|
| 38 | pd = [] |
---|
| 39 | for rc,pdk in resp_codes: |
---|
| 40 | pd[pdk] = request.get(rc) |
---|
| 41 | context.getContent().edit(mapping=pdk) |
---|