Changeset 14344 for main/kofacustom.coewarri/trunk/src/kofacustom
- Timestamp:
- 14 Dec 2016, 16:57:13 (8 years ago)
- Location:
- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/browser.py
r14342 r14344 38 38 CURRENCY = '566' 39 39 GATEWAY_AMT = 300.0 40 MAC = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94' 40 41 41 42 POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay' … … 58 59 currency = CURRENCY 59 60 product_id = PRODUCT_ID 60 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'61 mac = MAC 61 62 62 63 def update(self): … … 128 129 pay_item_id = '101' 129 130 product_id = PRODUCT_ID 130 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'131 mac = MAC 131 132 132 133 def update(self): … … 177 178 gateway_host = HOST 178 179 gateway_url = URL 179 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'180 mac = MAC 180 181 181 182 class CustomInterswitchPaymentVerifyWebservicePageStudent( … … 187 188 gateway_host = HOST 188 189 gateway_url = URL 189 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'190 mac = MAC 190 191 191 192 class CustomInterswitchPaymentRequestWebservicePageApplicant( … … 197 198 gateway_host = HOST 198 199 gateway_url = URL 199 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'200 mac = MAC 200 201 201 202 class CustomInterswitchPaymentVerifyWebservicePageApplicant( … … 207 208 gateway_host = HOST 208 209 gateway_url = URL 209 mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'210 mac = MAC -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/tests.py
r14336 r14344 81 81 self.browser.contents) 82 82 self.assertMatches( 83 '...item_name="School Fee " item_amt="7950000" bank_id="7" acct_num="1019684470"...',83 '...item_name="School Fee (total)" item_amt="7950000" bank_id="7" acct_num="1019684470"...', 84 84 self.browser.contents) 85 85 -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/payments.py
r14340 r14344 21 21 import grok 22 22 from zope.component.interfaces import IFactory 23 from zope.schema.interfaces import ConstraintNotSatisfied 23 24 from zope.interface import implementedBy 25 from hurry.workflow.interfaces import IWorkflowInfo 24 26 from waeup.kofa.students.interfaces import IStudentNavigation 27 from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID 25 28 from waeup.kofa.utils.helpers import attrs_to_fields 26 29 from kofacustom.nigeria.students.payments import ( … … 59 62 return error 60 63 self.ac = pin 61 elif self.p_category .startswith('schoolfee'):64 elif self.p_category in ('schoolfee', 'schoolfee_1') : 62 65 # Bypass activation code creation if next session 63 66 # can be started directly. -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_browser.py
r14035 r14344 42 42 layer = FunctionalLayer 43 43 44 def test_dummytest(self): 44 def test_for_instalment_payments(self): 45 46 #configuration_1 = createObject('waeup.SessionConfiguration') 47 #configuration_1.academic_session = 2015 48 #self.app['configuration'].addSessionConfiguration(configuration_1) 49 self.student['studycourse'].certificate.study_mode = 'ug_ft' 50 self.student.nationality = u'NG' 51 # Fresh student 52 IWorkflowState(self.student).setState('cleared') 53 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 54 self.browser.open(self.payments_path + '/addop') 55 self.browser.open(self.payments_path + '/addop') 56 # Add first instalment 57 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 58 self.browser.getControl("Create ticket").click() 59 self.assertTrue('ticket created' in self.browser.contents) 60 self.browser.open(self.payments_path) 61 ctrl = self.browser.getControl(name='val_id') 62 p_id = ctrl.options[0] 63 self.browser.open(self.payments_path + '/' + p_id + '/approve') 64 # Add the second instalment ... 65 self.browser.open(self.payments_path + '/addop') 66 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 67 self.browser.getControl("Create ticket").click() 68 self.assertTrue('ticket created' in self.browser.contents) 69 # ... approve the second instalment ... 70 ctrl = self.browser.getControl(name='val_id') 71 p_id = ctrl.options[1] 72 self.browser.open(self.payments_path + '/' + p_id + '/approve') 73 self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1') 74 self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2') 75 # 79200 / 2 + 300 76 self.assertEqual(self.student['payments'].values()[0].amount_auth, 39900.0) 77 self.assertEqual(self.student['payments'].values()[1].amount_auth, 39900.0) 78 # The two payments belong to the same session and level. 79 self.assertEqual(self.student['payments'].values()[0].p_session, 2004) 80 self.assertEqual(self.student['payments'].values()[0].p_level, 100) 81 self.assertEqual(self.student['payments'].values()[1].p_session, 2004) 82 self.assertEqual(self.student['payments'].values()[1].p_level, 100) 83 84 # Returning student 85 configuration_2 = createObject('waeup.SessionConfiguration') 86 configuration_2.academic_session = 2005 87 self.app['configuration'].addSessionConfiguration(configuration_2) 88 IWorkflowState(self.student).setState('returning') 89 self.browser.open(self.payments_path + '/addop') 90 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 91 self.browser.getControl("Create ticket").click() 92 self.browser.open(self.payments_path + '/addop') 93 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 94 self.browser.getControl("Create ticket").click() 95 self.browser.open(self.payments_path) 96 ctrl = self.browser.getControl(name='val_id') 97 # Nothing happens if we approve the 2nd instalment for session 2005 98 self.browser.open(self.payments_path + '/' + ctrl.options[3] + '/approve') 99 self.assertEqual(self.student.state, 'returning') 100 # Workflow transition is trigered if we approve the 1st indtalment 101 self.browser.open(self.payments_path + '/' + ctrl.options[2] + '/approve') 102 self.assertEqual(self.student.state, 'school fee paid') 103 self.assertEqual(self.student.current_level, 200) 104 self.assertEqual(self.student.current_session, 2005) 105 # 63100 / 2 + 300 106 self.assertEqual(self.student['payments'].values()[2].amount_auth, 31850.0) 107 self.assertEqual(self.student['payments'].values()[3].amount_auth, 31850.0) 108 # The last two payments belong to the same session and level. 109 self.assertEqual(self.student['payments'].values()[2].p_session, 2005) 110 self.assertEqual(self.student['payments'].values()[2].p_level, 200) 111 self.assertEqual(self.student['payments'].values()[3].p_session, 2005) 112 self.assertEqual(self.student['payments'].values()[3].p_level, 200) 45 113 return -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_utils.py
r14336 r14344 27 27 self.app['configuration']['2016'].clearance_fee = 10234.0 28 28 29 error, payment = utils.setPaymentDetails('schoolfee', self.student)30 self.assertEqual(payment, None)31 self.assertEqual(error, u'Amount could not be determined.')32 IWorkflowState(self.student).setState('cleared')33 29 error, payment = utils.setPaymentDetails('schoolfee',self.student) 34 30 self.assertEqual(payment.p_level, 100) 35 31 self.assertEqual(payment.p_session, 2016) 36 32 self.assertEqual(payment.amount_auth, 79500.0) 33 self.assertEqual(payment.p_item, u'CERT1') 34 self.assertEqual(error, None) 35 36 error, payment = utils.setPaymentDetails('schoolfee_1',self.student) 37 self.assertEqual(payment.p_level, 100) 38 self.assertEqual(payment.p_session, 2016) 39 self.assertEqual(payment.amount_auth, 39900.0) 40 self.assertEqual(payment.p_item, u'CERT1') 41 self.assertEqual(error, None) 42 43 error, payment = utils.setPaymentDetails('schoolfee_2',self.student) 44 self.assertEqual(payment.p_level, 100) 45 self.assertEqual(payment.p_session, 2016) 46 self.assertEqual(payment.amount_auth, 39900.0) 37 47 self.assertEqual(payment.p_item, u'CERT1') 38 48 self.assertEqual(error, None) -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py
r14336 r14344 75 75 return _(u'Session configuration object is not available.'), None 76 76 # Determine fee. 77 if category == 'schoolfee':77 if category.startswith('schoolfee'): 78 78 try: 79 79 certificate = student['studycourse'].certificate … … 88 88 return _(u'Session configuration object ' 89 89 'is not available.'), None 90 if student.state in (RETURNING, CLEARED): 91 if p_level in PAYMENT_LEVELS: 92 amount = SCHOOL_FEES.get_fee( 93 ( 94 local_nonlocal(student), 95 student.current_mode, 96 p_level) 97 ) 98 amount += GATEWAY_AMT 90 if p_level in PAYMENT_LEVELS: 91 amount = SCHOOL_FEES.get_fee( 92 ( 93 local_nonlocal(student), 94 student.current_mode, 95 p_level) 96 ) 97 if amount and category in ('schoolfee_1', 'schoolfee_2'): 98 amount /= 2 99 if amount: 100 amount += GATEWAY_AMT 99 101 elif category == 'clearance': 100 102 try: -
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/utils/utils.py
r14336 r14344 18 18 """Customize general helper utilities for Kofa. 19 19 """ 20 from copy import deepcopy 20 21 from kofacustom.nigeria.utils.utils import NigeriaKofaUtils 21 22 … … 43 44 'no': 'no application', 44 45 } 46 47 PAYMENT_CATEGORIES = { 48 'schoolfee': 'School Fee (total)', 49 'schoolfee_1': 'School Fee (1st instalment)', 50 'schoolfee_2': 'School Fee (2nd instalment)', 51 'clearance': 'Acceptance Fee', 52 #'bed_allocation': 'Bed Allocation Fee', 53 #'hostel_maintenance': 'Hostel Maintenance Fee', 54 #'transfer': 'Transfer Fee', 55 #'gown': 'Gown Hire Fee', 56 'application': 'Application Fee', 57 #'transcript': 'Transcript Fee', 58 #'late_registration': 'Late Course Registration Fee' 59 } 60 61 SELECTABLE_PAYMENT_CATEGORIES = deepcopy(PAYMENT_CATEGORIES)
Note: See TracChangeset for help on using the changeset viewer.