Changeset 3228
- Timestamp:
- 25 Feb 2008, 22:53:10 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/Widgets.py
r3219 r3228 438 438 439 439 if not value: 440 v = value = ' '440 v = value = '100' 441 441 #import pdb;pdb.set_trace() 442 442 levels = self._getLevels() -
WAeUP_SRP/uniben/waeup_custom/getPaymentsFolderInfo.py
r3068 r3228 18 18 """ 19 19 20 from Products.AdvancedQuery import Eq, Between, Le,In 21 20 22 mtool = context.portal_membership 21 23 wftool = context.portal_workflow 22 24 member = mtool.getAuthenticatedMember() 25 payments_catalog = context.payments_catalog 26 aq_payments = payments_catalog.evalAdvancedQuery 23 27 if mtool.isAnonymousUser(): 24 28 return None … … 37 41 import DateTime 38 42 request = context.REQUEST 39 students = context.portal_url.getPortalObject().campus.students43 #students = context.portal_url.getPortalObject().campus.students 40 44 student_id = context.getStudentId() 41 45 if student_id is None: 42 46 return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 43 student = getattr(students,student_id)47 #student = getattr(students,student_id) 44 48 student_record = context.students_catalog.getRecordByKey(student_id) 45 #context['updatePayments']() 46 payments = [] 49 47 50 48 51 info = {} … … 55 58 fulltime = student_record.mode and student_record.mode.endswith('_ft') 56 59 57 #if review_state == 'cleared_and_validated' or (parttime and review_state == 'returning'):58 # online_payment = True59 #elif fulltime and review_state == 'returning':60 # sc_payment = True61 60 62 61 session = student_record.session … … 70 69 info['payment_method'] = "online_payment" 71 70 #elif review_state == 'cleared_and_validated' and session == '07': 72 # info['payment_method'] = "sc_payment" 71 # info['payment_method'] = "sc_payment" 73 72 elif review_state == 'returning' and info['next_session'] != session: 74 73 info['payment_method'] = "sc_payment" … … 76 75 77 76 info['student_name'] = student_record.name 78 info['is_so'] = is_so 79 80 for payment_id,payment in context.objectItems(): 77 payments_path = "%s/campus/students/%s/payments" % (context.portal_url(),student_id) 78 payments = [] 79 payment_records = aq_payments(Eq('student_id',student_id) & Eq('session_id',student_record.session)) 80 vocabularies = context.portal_vocabularies 81 paid_fees = [] 82 for payment in payment_records: 83 if payment.status == "paid": 84 paid_fees += "%s_%s" % (payment.type,payment.session_id), 85 for payment in payment_records: 81 86 row = {} 82 row['id'] = payment_id 83 row['title'] = payment.Title() 84 url = row['url'] = payment.absolute_url() 85 payment_doc = payment.getContent() 86 row['type'] = payment_doc.portal_type 87 review_state = row['review_state'] = wftool.getInfoFor(payment,'review_state',None) 88 if payment_doc.type_description.startswith('School Fee'): 89 row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated' 90 else: 91 row['is_approvable'] = is_so and (review_state == "opened") 92 row['is_requeryable'] = False 93 #set_trace() 94 row['resp_desc'] = getattr(payment_doc,'resp_desc','no response') 95 row['trans_ref'] = getattr(payment_doc,'order_id','') 96 if payment_doc.type_description.startswith('School Fee'): 97 if (review_state == 'opened' and info['review_state'] in ('cleared_and_validated',) and \ 98 hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin',): 99 row['is_requeryable'] = True 100 row['callback_url'] = "%(url)s/interswitch_cb" % row 101 href = '%(query_url)s' % info 102 href += '?transRef=%(trans_ref)s' % row 103 href += '&prodID=%(prod_id)s' % info 104 href += '&redirectURL=%(callback_url)s' % row 105 row['href'] = href 106 if (review_state == "closed") and payment_doc.resp_code in ('SC','00','AP','IP',): 87 row['id'] = payment.key 88 row['title'] = "%s for Session %s, Naira %s, %s" % (vocabularies.payment_categories.get(payment.category), 89 vocabularies.sessions.get(payment.session_id), 90 payment.amount, 91 payment.date.strftime("%d/%m/%y %H:%M:%S")) 92 url = row['url'] = "%s/p%s" % (payments_path,payment.order_id[6:]) 93 row['is_requeryable'] = "%s_%s" % (payment.type,payment.session_id) not in paid_fees or str(member) in ('admin',) 94 row['is_approvable'] = is_so and row['is_requeryable'] 95 row['resp_desc'] = payment.resp_desc or 'Payment Process Interrupted' 96 row['trans_ref'] = payment.order_id 97 if row['is_requeryable']: 98 row['callback_url'] = "%(url)s/interswitch_cb" % row 99 href = '%(query_url)s' % info 100 href += '?transRef=%(trans_ref)s' % row 101 href += '&prodID=%(prod_id)s' % info 102 href += '&redirectURL=%(callback_url)s' % row 103 row['href'] = href 104 if payment.status == 'paid': 107 105 row['confirmed'] = 'active' 108 106 else: … … 111 109 payments.append(row) 112 110 111 112 113 113 payments.sort(cmp_id) 114 114 info['payments'] = payments 115 116 115 117 return info 116 118
Note: See TracChangeset for help on using the changeset viewer.