Changeset 3226 for WAeUP_SRP/fceokene
- Timestamp:
- 25 Feb 2008, 18:09:19 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/fceokene/waeup_custom/getPaymentsFolderInfo.py
r3069 r3226 12 12 Info for the PaymentsFolder 13 13 """ 14 from Products.AdvancedQuery import Eq, Between, Le,In 14 15 15 16 mtool = context.portal_membership 16 17 wftool = context.portal_workflow 17 18 member = mtool.getAuthenticatedMember() 19 payments_catalog = context.payments_catalog 20 aq_payments = payments_catalog.evalAdvancedQuery 18 21 if mtool.isAnonymousUser(): 19 22 return None … … 38 41 import DateTime 39 42 request = context.REQUEST 40 students = context.portal_url.getPortalObject().campus.students43 #students = context.portal_url.getPortalObject().campus.students 41 44 student_id = context.getStudentId() 42 45 if student_id is None: 43 46 return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 44 student = getattr(students,student_id)47 #student = getattr(students,student_id) 45 48 student_record = context.students_catalog.getRecordByKey(student_id) 46 49 #context['updatePayments']() 47 payments = []48 50 49 51 info = {} … … 75 77 76 78 info['student_name'] = student_record.name 77 78 for payment_id,payment in context.objectItems(): 79 payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id) 80 payments = [] 81 payment_records = aq_payments(Eq('student_id',student_id) & Eq('session_id',student_record.session)) 82 vocabularies = context.portal_vocabularies 83 paid_fees = [] 84 for payment in payment_records: 85 if payment.status == "paid": 86 paid_fees += "%s_%s" % (payment.type,payment.session_id), 87 for payment in payment_records: 79 88 row = {} 80 row['id'] = payment_id 81 row['title'] = payment.Title() 82 url = row['url'] = payment.absolute_url() 83 payment_doc = payment.getContent() 84 row['type'] = payment_doc.portal_type 85 review_state = row['review_state'] = wftool.getInfoFor(payment,'review_state',None) 86 if payment_doc.type_description.startswith('School Fee'): 87 row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated' 88 else: 89 row['is_approvable'] = is_so and (review_state == "opened") 90 row['is_requeryable'] = False 91 #set_trace() 92 row['resp_desc'] = getattr(payment_doc,'resp_desc','no response') 93 row['trans_ref'] = getattr(payment_doc,'order_id','') 94 if payment_doc.type_description.startswith('School Fee'): 95 if (review_state == 'opened' and info['review_state'] in ('cleared_and_validated',) and \ 96 hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin',): 97 row['is_requeryable'] = True 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 elif payment_doc.type_description.startswith('Hostel'): 105 if (review_state == 'opened' and \ 106 hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin','delejason','isouaba'): 107 row['is_requeryable'] = True 108 row['callback_url'] = "%(url)s/interswitch_acco_cb" % row 109 href = '%(query_url)s' % info 110 href += '?transRef=%(trans_ref)s' % row 111 href += '&prodID=%(prod_id)s' % info 112 href += '&redirectURL=%(callback_url)s' % row 113 row['href'] = href 114 if (review_state == "closed") and payment_doc.resp_code in ('SC','00','AP','IP',): 89 row['id'] = payment.key 90 row['title'] = "%s for Session %s, Naira %s, %s" % (vocabularies.payment_categories.get(payment.category), 91 vocabularies.sessions.get(payment.session_id), 92 payment.amount, 93 payment.date.strftime("%d/%m/%y %H:%M:%S")) 94 url = row['url'] = "%s/p%s" % (payments_path,payment.order_id[6:]) 95 row['is_requeryable'] = "%s_%s" % (payment.type,payment.session_id) not in paid_fees 96 row['is_approvable'] = is_so and row['is_requeryable'] 97 row['resp_desc'] = payment.resp_desc or payment.status 98 row['trans_ref'] = payment.order_id 99 if row['is_requeryable']: 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 payment.status == 'paid': 115 107 row['confirmed'] = 'active' 116 108 else: … … 118 110 row['is_editable'] = is_so and (row['confirmed'] == 'active') 119 111 payments.append(row) 112 # for payment_id,payment in context.objectItems(): 113 # row = {} 114 # row['id'] = payment_id 115 # row['title'] = payment.Title() 116 # url = row['url'] = payment.absolute_url() 117 # payment_doc = payment.getContent() 118 # row['type'] = payment_doc.portal_type 119 # review_state = row['review_state'] = wftool.getInfoFor(payment,'review_state',None) 120 # if payment_doc.type_description.startswith('School Fee'): 121 # row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated' 122 # else: 123 # row['is_approvable'] = is_so and (review_state == "opened") 124 # row['is_requeryable'] = False 125 # #set_trace() 126 # row['resp_desc'] = getattr(payment_doc,'resp_desc','no response') 127 # row['trans_ref'] = getattr(payment_doc,'order_id','') 128 # if payment_doc.type_description.startswith('School Fee'): 129 # if (review_state == 'opened' and info['review_state'] in ('cleared_and_validated',) and \ 130 # hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin',): 131 # row['is_requeryable'] = True 132 # row['callback_url'] = "%(url)s/interswitch_cb" % row 133 # href = '%(query_url)s' % info 134 # href += '?transRef=%(trans_ref)s' % row 135 # href += '&prodID=%(prod_id)s' % info 136 # href += '&redirectURL=%(callback_url)s' % row 137 # row['href'] = href 138 # elif payment_doc.type_description.startswith('Hostel'): 139 # if (review_state == 'opened' and \ 140 # hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin','delejason','isouaba'): 141 # row['is_requeryable'] = True 142 # row['callback_url'] = "%(url)s/interswitch_acco_cb" % row 143 # href = '%(query_url)s' % info 144 # href += '?transRef=%(trans_ref)s' % row 145 # href += '&prodID=%(prod_id)s' % info 146 # href += '&redirectURL=%(callback_url)s' % row 147 # row['href'] = href 148 # if (review_state == "closed") and payment_doc.resp_code in ('SC','00','AP','IP',): 149 # row['confirmed'] = 'active' 150 # else: 151 # row['confirmed'] = 'unsuccessful' 152 # row['is_editable'] = is_so and (row['confirmed'] == 'active') 153 # payments.append(row) 120 154 # payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id) 121 155 # sos = context.portal_catalog(container_path=payments_path)
Note: See TracChangeset for help on using the changeset viewer.