Ignore:
Timestamp:
17 May 2018, 09:01:49 (6 years ago)
Author:
Henrik Bettermann
Message:

Configure payment categories.

Location:
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interfaces.py

    r15000 r15011  
    4949        )
    5050
    51     late_registration_fee = schema.Float(
    52         title = _(u'Late Course Reg. Fee'),
     51    # Additional fees in custom package add here
     52
     53    logbook_fee = schema.Float(
     54        title = _(u'Logbook Fee'),
    5355        default = 0.0,
    5456        required = False,
    5557        )
    5658
    57     transcript_fee = schema.Float(
    58         title = _(u'Transcript Fee'),
     59    ict_entre_fee = schema.Float(
     60        title = _(u'ICT & Entrepreneur Fee'),
    5961        default = 0.0,
    6062        required = False,
    6163        )
    62 
    63     transfer_fee = schema.Float(
    64         title = _(u'Transfer Fee'),
    65         default = 0.0,
    66         required = False,
    67         )
    68 
    69 
    70     # Additional fees in custom package add here
    71 
    7264
    7365    def getSessionString():
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py

    r15008 r15011  
    3838               (4.5, '2nd Class Upper'),
    3939               (5, '1st Class'))
     40
     41    def setPaymentDetails(self, category, student,
     42            previous_session, previous_level):
     43        """Create a payment ticket and set the payment data of a
     44        student for the payment category specified.
     45        """
     46        p_item = u''
     47        amount = 0.0
     48        if previous_session:
     49            if previous_session < student['studycourse'].entry_session:
     50                return _('The previous session must not fall below '
     51                         'your entry session.'), None
     52            if category == 'schoolfee':
     53                # School fee is always paid for the following session
     54                if previous_session > student['studycourse'].current_session:
     55                    return _('This is not a previous session.'), None
     56            else:
     57                if previous_session > student['studycourse'].current_session - 1:
     58                    return _('This is not a previous session.'), None
     59            p_session = previous_session
     60            p_level = previous_level
     61            p_current = False
     62        else:
     63            p_session = student['studycourse'].current_session
     64            p_level = student['studycourse'].current_level
     65            p_current = True
     66        academic_session = self._getSessionConfiguration(p_session)
     67        if academic_session == None:
     68            return _(u'Session configuration object is not available.'), None
     69        # Determine fee.
     70        if category == 'schoolfee':
     71            try:
     72                certificate = student['studycourse'].certificate
     73                p_item = certificate.code
     74            except (AttributeError, TypeError):
     75                return _('Study course data are incomplete.'), None
     76            if previous_session:
     77                # Students can pay for previous sessions in all
     78                # workflow states.  Fresh students are excluded by the
     79                # update method of the PreviousPaymentAddFormPage.
     80                if previous_level == 100:
     81                    amount = getattr(certificate, 'school_fee_1', 0.0)
     82                else:
     83                    amount = getattr(certificate, 'school_fee_2', 0.0)
     84            else:
     85                if student.state == CLEARED:
     86                    amount = getattr(certificate, 'school_fee_1', 0.0)
     87                elif student.state == RETURNING:
     88                    # In case of returning school fee payment the
     89                    # payment session and level contain the values of
     90                    # the session the student has paid for. Payment
     91                    # session is always next session.
     92                    p_session, p_level = self.getReturningData(student)
     93                    academic_session = self._getSessionConfiguration(p_session)
     94                    if academic_session == None:
     95                        return _(
     96                            u'Session configuration object is not available.'
     97                            ), None
     98                    amount = getattr(certificate, 'school_fee_2', 0.0)
     99                elif student.is_postgrad and student.state == PAID:
     100                    # Returning postgraduate students also pay for the
     101                    # next session but their level always remains the
     102                    # same.
     103                    p_session += 1
     104                    academic_session = self._getSessionConfiguration(p_session)
     105                    if academic_session == None:
     106                        return _(
     107                            u'Session configuration object is not available.'
     108                            ), None
     109                    amount = getattr(certificate, 'school_fee_2', 0.0)
     110        elif category == 'clearance':
     111            try:
     112                p_item = student['studycourse'].certificate.code
     113            except (AttributeError, TypeError):
     114                return _('Study course data are incomplete.'), None
     115            amount = academic_session.clearance_fee
     116        elif category == 'bed_allocation':
     117            p_item = self.getAccommodationDetails(student)['bt']
     118            amount = academic_session.booking_fee
     119        elif category == 'hostel_maintenance':
     120            amount = 0.0
     121            bedticket = student['accommodation'].get(
     122                str(student.current_session), None)
     123            if bedticket is not None and bedticket.bed is not None:
     124                p_item = bedticket.bed_coordinates
     125                if bedticket.bed.__parent__.maint_fee > 0:
     126                    amount = bedticket.bed.__parent__.maint_fee
     127                else:
     128                    # fallback
     129                    amount = academic_session.maint_fee
     130            else:
     131                return _(u'No bed allocated.'), None
     132        elif category == 'logbook':
     133            amount = academic_session.logbook_fee
     134        elif category == 'ict_entre':
     135            amount = academic_session.ict_entre_fee
     136        if amount in (0.0, None):
     137            return _('Amount could not be determined.'), None
     138        if self.samePaymentMade(student, category, p_item, p_session):
     139            return _('This type of payment has already been made.'), None
     140        if self._isPaymentDisabled(p_session, category, student):
     141            return _('This category of payments has been disabled.'), None
     142        payment = createObject(u'waeup.StudentOnlinePayment')
     143        timestamp = ("%d" % int(time()*10000))[1:]
     144        payment.p_id = "p%s" % timestamp
     145        payment.p_category = category
     146        payment.p_item = p_item
     147        payment.p_session = p_session
     148        payment.p_level = p_level
     149        payment.p_current = p_current
     150        payment.amount_auth = amount
     151        return None, payment
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/utils/utils.py

    r10765 r15011  
    1818"""Customize general helper utilities for Kofa.
    1919"""
     20from copy import deepcopy
    2021from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
    2122
     
    2425    """
    2526
     27    PAYMENT_CATEGORIES = {
     28        'schoolfee': 'School Fee',
     29        'clearance': 'Acceptance Fee',
     30        'bed_allocation': 'Accommodation Booking Fee',
     31        'hostel_maintenance': 'Hostel Maintenance Fee',
     32        'application': 'Application Fee',
     33        'ict_entre': 'ICT & Entrepreneur Fee',
     34        'logbook': 'Logbook Fee',
     35        }
     36
     37    SELECTABLE_PAYMENT_CATEGORIES = deepcopy(PAYMENT_CATEGORIES)
Note: See TracChangeset for help on using the changeset viewer.