Ignore:
Timestamp:
27 Feb 2014, 09:46:40 (11 years ago)
Author:
Henrik Bettermann
Message:

Provide customizable method for disabling student payments.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r11440 r11451  
    10281028        self.assertEqual(ac.owner, self.student_id)
    10291029        self.assertEqual(ac.cost, 4567.0)
     1030        return
     1031
     1032    def test_payment_disabled(self):
     1033        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1034        self.browser.open(self.payments_path)
     1035        IWorkflowState(self.student).setState('cleared')
     1036        self.browser.getLink("Add current session payment ticket").click()
     1037        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1038        self.browser.getControl("Create ticket").click()
     1039        self.assertMatches('...ticket created...',
     1040                           self.browser.contents)
     1041        self.app['configuration']['2004'].payment_disabled = ['sf_all']
     1042        self.browser.getLink("Add current session payment ticket").click()
     1043        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1044        self.browser.getControl("Create ticket").click()
     1045        self.assertMatches('...Payment temporarily disabled...',
     1046                           self.browser.contents)
    10301047        return
    10311048
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r10803 r11451  
    335335        except KeyError:
    336336            return None
     337
     338    def _isPaymentDisabled(self, p_session, category, student):
     339        academic_session = self._getSessionConfiguration(p_session)
     340        if 'sf_all' in academic_session.payment_disabled:
     341            return True
     342        return False
    337343
    338344    def setPaymentDetails(self, category, student,
     
    442448               ticket.p_session == p_session:
    443449                  return _('This type of payment has already been made.'), None
     450        if self._isPaymentDisabled(p_session, category, student):
     451            return _('Payment temporarily disabled.'), None
    444452        payment = createObject(u'waeup.StudentOnlinePayment')
    445453        timestamp = ("%d" % int(time()*10000))[1:]
Note: See TracChangeset for help on using the changeset viewer.