- Timestamp:
- 27 Apr 2015, 08:14:31 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r12873 r12889 4 4 1.3.2.dev0 (unreleased) 5 5 ======================= 6 7 * Bypass school fee payment activation code creation if student is allowed 8 to proceed to next session. 6 9 7 10 * Convert level into a schema field to be consistent with the documentation. -
main/waeup.kofa/trunk/docs/source/userdocs/datacenter/import_stages.rst
r12883 r12889 53 53 (**import step 3**) by selecting the appropriate processor and an 54 54 import mode. In import mode ``create`` new objects are added to the 55 database, `in`update`` mode existing objects are modified and in55 database, in ``update`` mode existing objects are modified and in 56 56 ``remove`` mode deleted. 57 57 -
main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py
r11583 r12889 22 22 from zope.component.interfaces import IFactory 23 23 from zope.interface import implementedBy 24 from zope.schema.interfaces import ConstraintNotSatisfied 25 from hurry.workflow.interfaces import IWorkflowInfo 24 26 from waeup.kofa.interfaces import MessageFactory as _ 25 27 from waeup.kofa.students.interfaces import ( 26 28 IStudentPaymentsContainer, IStudentNavigation, IStudentOnlinePayment) 29 from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID 27 30 from waeup.kofa.payments import PaymentsContainer, OnlinePayment 28 31 from waeup.kofa.payments.interfaces import IPayer … … 69 72 return self.__parent__.__parent__.writeLogMessage(view, message) 70 73 71 def _ createActivationCodes(self):74 def _redeemTicket(self): 72 75 student = self.student 73 76 if self.p_category == 'clearance': … … 79 82 self.ac = pin 80 83 elif self.p_category in ('schoolfee', 'schoolfee_1'): 84 # Bypass activation code creation if next session 85 # can be started directly. 86 if student['studycourse'].next_session_allowed: 87 try: 88 if student.state == CLEARED: 89 IWorkflowInfo(student).fireTransition( 90 'pay_first_school_fee') 91 return None 92 elif student.state == RETURNING: 93 IWorkflowInfo(student).fireTransition( 94 'pay_school_fee') 95 return None 96 elif student.state == PAID: 97 IWorkflowInfo(student).fireTransition( 98 'pay_pg_fee') 99 return None 100 except ConstraintNotSatisfied: 101 pass 81 102 # Create SFE access code 82 103 pin, error = create_accesscode( … … 105 126 """ 106 127 if self.p_current: 107 error = self._ createActivationCodes()128 error = self._redeemTicket() 108 129 if error is not None: 109 130 return 'danger', error, error … … 117 138 """ 118 139 if self.p_current: 119 error = self._ createActivationCodes()140 error = self._redeemTicket() 120 141 if error is not None: 121 142 return 'danger', error, error -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r12854 r12889 929 929 cat = queryUtility(ICatalog, name='payments_catalog') 930 930 results = list(cat.searchResults(p_state=('unpaid', 'unpaid'))) 931 self.assert True(len(results), 1)931 self.assertEqual(len(results), 2) 932 932 self.assertTrue(results[0] is self.student['payments'][value]) 933 934 933 # Managers can approve the payment 934 # If, by some reason, the state has already changed, 935 # an access code is created after approval. 936 IWorkflowState(self.student).setState('school fee paid') 935 937 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 936 938 self.browser.open(payment_url) … … 951 953 '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,\n' % value 952 954 in logcontent) 953 954 # The authorized amount has been stored in the access code 955 # The authorized amount has been stored in the new access code 955 956 self.assertEqual( 956 957 self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0) … … 969 970 970 971 # Now the first ticket is paid and no more ticket of same type 971 # (with same p_item, p_session and p_category) can be added 972 # (with same p_item, p_session and p_category) can be added. 973 # First we have to reset the workflow state. 974 IWorkflowState(self.student).setState('cleared') 972 975 self.browser.open(self.payments_path) 973 976 self.browser.getLink("Add current session payment ticket").click() … … 1047 1050 self.assertEqual(ac.owner, self.student_id) 1048 1051 self.assertEqual(ac.cost, 4567.0) 1052 return 1053 1054 def test_manage_payments_bypass_ac_creation(self): 1055 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1056 self.browser.open(self.payments_path) 1057 IWorkflowState(self.student).setState('cleared') 1058 self.browser.getLink("Add current session payment ticket").click() 1059 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 1060 self.browser.getControl("Create ticket").click() 1061 ctrl = self.browser.getControl(name='val_id') 1062 value = ctrl.options[0] 1063 self.browser.getLink(value).click() 1064 payment_url = self.browser.url 1065 logfile = os.path.join( 1066 self.app['datacenter'].storage, 'logs', 'students.log') 1067 # The ticket can be found in the payments_catalog 1068 cat = queryUtility(ICatalog, name='payments_catalog') 1069 results = list(cat.searchResults(p_state=('unpaid', 'unpaid'))) 1070 self.assertTrue(len(results), 1) 1071 self.assertTrue(results[0] is self.student['payments'][value]) 1072 # Managers can approve the payment 1073 self.browser.open(payment_url) 1074 self.browser.getLink("Approve payment").click() 1075 self.assertMatches('...Payment approved...', 1076 self.browser.contents) 1077 # Approval is logged in students.log ... 1078 logcontent = open(logfile).read() 1079 self.assertTrue( 1080 'zope.mgr - students.browser.OnlinePaymentApprovePage ' 1081 '- K1000000 - schoolfee payment approved' 1082 in logcontent) 1083 # ... and in payments.log 1084 logfile = os.path.join( 1085 self.app['datacenter'].storage, 'logs', 'payments.log') 1086 logcontent = open(logfile).read() 1087 self.assertTrue( 1088 '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,\n' % value 1089 in logcontent) 1090 # Student is in state school fee paid, no activation 1091 # code was necessary. 1092 self.assertEqual(self.student.state, 'school fee paid') 1093 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 1049 1094 return 1050 1095 … … 2702 2747 self.browser.contents) 2703 2748 2704 # The new SFE-0 pin can be used for starting new session 2705 self.browser.open(self.studycourse_path) 2706 self.browser.getLink('Start new session').click() 2707 pin = self.app['accesscodes']['SFE-0'].keys()[0] 2708 parts = pin.split('-')[1:] 2709 sfeseries, sfenumber = parts 2710 self.browser.getControl(name="ac_series").value = sfeseries 2711 self.browser.getControl(name="ac_number").value = sfenumber 2712 self.browser.getControl("Start now").click() 2713 self.assertMatches('...Session started...', 2714 self.browser.contents) 2749 ## The new SFE-0 pin can be used for starting new session 2750 #self.browser.open(self.studycourse_path) 2751 #self.browser.getLink('Start new session').click() 2752 #pin = self.app['accesscodes']['SFE-0'].keys()[0] 2753 #parts = pin.split('-')[1:] 2754 #sfeseries, sfenumber = parts 2755 #self.browser.getControl(name="ac_series").value = sfeseries 2756 #self.browser.getControl(name="ac_number").value = sfenumber 2757 #self.browser.getControl("Start now").click() 2758 #self.assertMatches('...Session started...', 2759 # self.browser.contents) 2760 2715 2761 self.assertTrue(self.student.state == 'school fee paid') 2716 2762 return … … 2874 2920 self.browser.contents) 2875 2921 2876 # The new SFE-0 pin can be used for starting session 2877 self.browser.open(self.studycourse_path) 2878 self.browser.getLink('Start new session').click() 2879 pin = self.app['accesscodes']['SFE-0'].keys()[0] 2880 parts = pin.split('-')[1:] 2881 sfeseries, sfenumber = parts 2882 self.browser.getControl(name="ac_series").value = sfeseries 2883 self.browser.getControl(name="ac_number").value = sfenumber 2884 self.browser.getControl("Start now").click() 2885 self.assertMatches('...Session started...', 2886 self.browser.contents) 2922 ## The new SFE-0 pin can be used for starting session 2923 #self.browser.open(self.studycourse_path) 2924 #self.browser.getLink('Start new session').click() 2925 #pin = self.app['accesscodes']['SFE-0'].keys()[0] 2926 #parts = pin.split('-')[1:] 2927 #sfeseries, sfenumber = parts 2928 #self.browser.getControl(name="ac_series").value = sfeseries 2929 #self.browser.getControl(name="ac_number").value = sfenumber 2930 #self.browser.getControl("Start now").click() 2931 #self.assertMatches('...Session started...', 2932 # self.browser.contents) 2933 2887 2934 self.assertTrue(self.student.state == 'school fee paid') 2888 2935
Note: See TracChangeset for help on using the changeset viewer.