Ignore:
Timestamp:
27 Feb 2014, 10:57:32 (11 years ago)
Author:
Henrik Bettermann
Message:

Method for disabling student payments customized. We can now
disable school fee payment for non-pg students.

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

Legend:

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

    r11065 r11453  
    110110
    111111        # In KwaraPoly only returning students can create school fee payment
    112         # without haveing paid accommodation fee
     112        # without having paid accommodation fee
    113113        IWorkflowState(self.student).setState('returning')
    114114        configuration = createObject('waeup.SessionConfiguration')
     
    464464
    465465        return
     466
     467    def test_payment_disabled(self):
     468        IWorkflowState(self.student).setState('returning')
     469        configuration = createObject('waeup.SessionConfiguration')
     470        configuration.academic_session = 2005
     471        self.app['configuration'].addSessionConfiguration(configuration)
     472        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     473        self.browser.open(self.payments_path)
     474        self.browser.getLink("Add current session payment ticket").click()
     475        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     476        self.browser.getControl("Create ticket").click()
     477        self.assertMatches('...ticket created...',
     478                           self.browser.contents)
     479        self.app['configuration']['2005'].payment_disabled = ['sf_all']
     480        self.browser.getLink("Add current session payment ticket").click()
     481        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     482        self.browser.getControl("Create ticket").click()
     483        self.assertMatches('...Payment temporarily disabled...',
     484                           self.browser.contents)
     485        self.app['configuration']['2005'].payment_disabled = ['sf_non_pg']
     486        # Non-PG students can't pay ...
     487        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     488        self.browser.getControl("Create ticket").click()
     489        self.assertMatches('...Payment temporarily disabled...',
     490                           self.browser.contents)
     491        # ... but PG can pay.
     492        self.certificate.study_mode = 'pg_ft'
     493        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     494        self.browser.getControl("Create ticket").click()
     495        self.assertMatches('...ticket created...',
     496                           self.browser.contents)
     497        return
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py

    r11065 r11453  
    152152            # Bed has not yet been booked but beds are available.
    153153            return True
     154        return False
     155
     156    def _isPaymentDisabled(self, p_session, category, student):
     157        academic_session = self._getSessionConfiguration(p_session)
     158        if category == 'schoolfee':
     159            if 'sf_all' in academic_session.payment_disabled:
     160                return True
     161            if 'sf_non_pg' in academic_session.payment_disabled and \
     162                not student.is_postgrad:
     163                return True
    154164        return False
    155165
     
    258268        elif category == 'schoolfee':
    259269            amount += academic_session.penalty_ug
     270        if self._isPaymentDisabled(p_session, category, student):
     271            return _('Payment temporarily disabled.'), None
    260272        payment = createObject(u'waeup.StudentOnlinePayment')
    261273        timestamp = ("%d" % int(time()*10000))[1:]
Note: See TracChangeset for help on using the changeset viewer.