Changeset 11451


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
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r11439 r11451  
    441.0.1dev (unreleased)
    55=====================
     6
     7* Provide customizable method for disabling student payments.
    68
    79* After login and logout regular users (officers) are redirected
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r11450 r11451  
    143143        return dict(getUtility(IKofaUtils).EXAM_GRADES)[value]
    144144
     145class DisablePaymentGroupSource(ContextualDictSourceFactoryBase):
     146    """A source for filtering groups of students
     147    """
     148    #: name of dict to deliver from kofa utils.
     149    DICT_NAME = 'DISABLE_PAYMENT_GROUP_DICT'
     150
    145151# Define a validation method for email addresses
    146152class NotAnEmailAddress(schema.ValidationError):
     
    709715        )
    710716
     717    payment_disabled = schema.List(
     718        title = _(u'Payment disabled'),
     719        value_type = schema.Choice(
     720            source = DisablePaymentGroupSource(),
     721            ),
     722        required = False,
     723        default = [],
     724        )
     725
    711726    def getSessionString():
    712727        """Returns the session string from the vocabulary.
  • 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:]
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r10831 r11451  
    132132        }
    133133
     134    DISABLE_PAYMENT_GROUP_DICT = {
     135        'sf_all': 'School Fee - All Students',
     136        }
     137
    134138    APP_CATS_DICT = {
    135139        'basic': 'Basic Application',
Note: See TracChangeset for help on using the changeset viewer.