Changeset 6876 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 12 Oct 2011, 19:30:01 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6870 r6876 43 43 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket 44 44 from waeup.sirp.students.vocabularies import StudyLevelSource 45 from waeup.sirp.students.utils import getPaymentDetails 45 46 from waeup.sirp.browser.resources import toggleall 46 47 from waeup.sirp.payments.interfaces import IOnlinePayment … … 865 866 @grok.action('Create ticket') 866 867 def createTicket(self, **data): 867 payment = createObject(u'waeup. OnlinePayment')868 payment = createObject(u'waeup.StudentOnlinePayment') 868 869 self.applyData(payment, **data) 869 870 timestamp = "%d" % int(time()*1000) 870 871 #order_id = "%s%s" % (student_id[1:],timestamp) 871 872 payment.p_id = "p%s" % timestamp 873 (payment.amount_auth, 874 payment.p_item, 875 payment.surcharge_1, 876 payment.surcharge_2, 877 payment.surcharge_3) = getPaymentDetails( 878 data['p_category'],self.context.__parent__) 879 if payment.amount_auth == 0: 880 self.flash('Payment amount could not be determined.') 881 self.redirect(self.url(self.context, u'@@manage')) 882 return 872 883 self.context[payment.p_id] = payment 873 884 self.flash('Payment ticket created.') -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6852 r6876 620 620 self.assertEqual(self.student.state, 'courses registered') 621 621 return 622 623 def test_manage_access(self): 624 # Managers can add online payment tickets 625 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 626 self.browser.open(self.payments_student_path) 627 self.browser.getLink("Manage").click() 628 self.browser.getControl("Add online payment ticket").click() -
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r6804 r6876 3 3 4 4 from random import SystemRandom as r 5 from waeup.sirp.students.vocabularies import academic_sessions_vocab 5 6 6 7 def generate_student_id(students,letter): … … 19 20 student['studycourse'].previous_verdict = verdict 20 21 return 22 23 def getPaymentDetails(category, student): 24 #import pdb; pdb.set_trace() 25 session_string = academic_sessions_vocab.by_value[ 26 student['studycourse'].current_session].title 27 surcharge_1 = surcharge_2 = surcharge_3 = 0 28 if category == 'transfer': 29 amount = 500 30 item = u'Session %s' % session_string 31 elif category == 'gown': 32 amount = 500 33 item = u'Session %s' % session_string 34 elif category == 'hostel_maintenance': 35 amount = 300 36 item = u'Session %s' % session_string 37 elif category == 'schoolfee': 38 surcharge_1 = 1500 # BT amount 39 surcharge_2 = 300 # Interswitch amount 40 amount = getSchoolFee(student, surcharge_1 + surcharge_2) 41 item = u'Session %s' % session_string 42 return amount, item, surcharge_1, surcharge_2, surcharge_3 43 44 # To be moved to the FUTMinna customization package 45 def getSchoolFee(student, surcharge): 46 study_mode = student['studycourse'].certificate.study_mode 47 entry_mode = student.entry_mode 48 state = student.state 49 #lga = student.lga 50 lga = 'nothing' 51 current_level = student['studycourse'].current_level 52 CLEARED = 'cleared' 53 54 if study_mode.endswith('_ft'): 55 # fresh remedial 56 if current_level == 0 and state == CLEARED: 57 if entry_mode == 'rmd_ft': 58 return 80200 - surcharge 59 else: 60 return 74200 - surcharge 61 # fresh 62 elif state == CLEARED: 63 if study_mode == 'jm_ft': 64 return 72700 - surcharge 65 elif lga == 'foreigner': 66 return 131500 - surcharge 67 else: 68 return 41500 - surcharge 69 # returning 70 elif state == 'returning': 71 if study_mode == 'jm_ft': 72 return 32500 - surcharge 73 elif lga == 'foreigner': 74 return 109500 - surcharge 75 else: 76 return 19500 - surcharge 77 else: 78 return 0 79 else: 80 return 0
Note: See TracChangeset for help on using the changeset viewer.