Ignore:
Timestamp:
12 Dec 2016, 12:02:31 (8 years ago)
Author:
Henrik Bettermann
Message:

Configure schoolfee and clearance payments.

Location:
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri
Files:
1 added
5 edited

Legend:

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

    r14035 r14336  
    3939
    4040    clearance_fee = schema.Float(
    41         title = _(u'Clearance Fee (ignored)'),
     41        title = _(u'Acceptance Fee'),
    4242        default = 0.0,
    4343        required = False,
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/browser.py

    r14301 r14336  
    5858    currency = CURRENCY
    5959    product_id = PRODUCT_ID
    60     mac = ''
     60    mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'
    6161
    6262    def update(self):
     
    7474        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    7575        # Institution data
    76         xmldict['institution_acct'] = '00000000'
    77         xmldict['institution_bank_id'] = '00'
    78         xmldict['institution_amt'] = '0.0'
    79         provider_amt = 0.0
     76        xmldict['institution_acct'] = '1019684470'
     77        xmldict['institution_bank_id'] = '7'
     78        provider_amt = 500.0
    8079        self.pay_item_id = '0000'
    8180        xmldict['provider_amt'] = 100 * provider_amt
     
    8483        xmldict['institution_amt'] = 100 * (
    8584            self.context.amount_auth - provider_amt - GATEWAY_AMT)
     85        if self.context.p_category == 'clearance':
     86            self.pay_item_id = '102'
     87        elif self.context.p_category == 'schoolfee':
     88            self.pay_item_id = '103'
    8689        # Interswitch amount is not part of the xml data
    8790        if provider_amt == 0:
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/tests.py

    r14035 r14336  
    6868                           self.browser.contents)
    6969        self.assertMatches(
    70             '...<span>40000.0</span>...',
     70            '...<span>79500.0</span>...',
    7171            self.browser.contents)
    7272        self.payment_url = self.browser.url
    7373        self.browser.getLink("CollegePAY", index=0).click()
    74         self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
     74        self.assertMatches('...<input type="hidden" name="pay_item_id" value="103" />...',
    7575                           self.browser.contents)
    7676        self.assertMatches('...Total Amount Authorized:...',
     
    7878        self.assertEqual(self.student.current_mode, 'ug_ft')
    7979        self.assertMatches(
    80             '...<input type="hidden" name="amount" value="4000000" />...',
    81             self.browser.contents)
    82         self.assertMatches(
    83             '...item_name="School Fee" item_amt="4000000" bank_id="00" acct_num="00000000"...',
     80            '...<input type="hidden" name="amount" value="7950000" />...',
     81            self.browser.contents)
     82        self.assertMatches(
     83            '...item_name="School Fee" item_amt="7950000" bank_id="7" acct_num="1019684470"...',
    8484            self.browser.contents)
    8585
     
    9595        self.browser.open(self.payments_path + '/xyz')
    9696        self.browser.getLink("CollegePAY", index=0).click()
    97         self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
     97        self.assertMatches('...<input type="hidden" name="pay_item_id" value="102" />...',
    9898                           self.browser.contents)
    9999        self.assertMatches('...Total Amount Authorized:...',
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py

    r14333 r14336  
    1818from time import time
    1919from zope.component import createObject, getUtility
     20from waeup.kofa.fees import FeeTable
    2021from waeup.kofa.interfaces import (IKofaUtils,
    2122    ADMITTED, CLEARED, RETURNING, PAID, REGISTERED, VALIDATED)
    2223from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
    2324from kofacustom.coewarri.interfaces import MessageFactory as _
     25from kofacustom.coewarri.interswitch.browser import GATEWAY_AMT
    2426
    2527
     
    3133        return 'non-local'
    3234
     35PAYMENT_LEVELS = (100, 110, 200, 210, 300, 310, 400, 410, 500, 999)
     36
     37FEES_PARAMS = (
     38        ('local', 'non-local'),
     39        ('nce_ft', 'nce_pt', 'ug_ft'),
     40        PAYMENT_LEVELS
     41    )
     42
     43FEES_VALUES = (
     44      ( # 100      110      200      210      300      310      400      410     500  999
     45        (42000.0, 42000.0, 20600.0, 20600.0, 18100.0, 18100.0,     0.0,     0.0, 0.0, 0.0), # nce_ft
     46        (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt
     47        (69200.0, 69200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft
     48      ), # local
     49      ( #
     50        (54600.0, 54600.0, 22600.0, 22600.0, 20100.0, 20100.0,     0.0,     0.0, 0.0, 0.0), # nce_ft
     51        (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt
     52        (79200.0, 79200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft
     53      ), # non-local
     54    )
     55
     56SCHOOL_FEES = FeeTable(FEES_PARAMS, FEES_VALUES)
     57
    3358class CustomStudentsUtils(NigeriaStudentsUtils):
    3459    """A collection of customized methods.
     
    3762
    3863    def setPaymentDetails(self, category, student,
    39             previous_session, previous_level):
     64            previous_session=None, previous_level=None):
    4065        """Create a payment ticket and set the payment data of a
    4166        student for the payment category specified.
     
    4368        p_item = u''
    4469        amount = 0.0
    45         if previous_session:
    46             if previous_session < student['studycourse'].entry_session:
    47                 return _('The previous session must not fall below '
    48                          'your entry session.'), None
    49             if category == 'schoolfee':
    50                 # School fee is always paid for the following session
    51                 if previous_session > student['studycourse'].current_session:
    52                     return _('This is not a previous session.'), None
    53             else:
    54                 if previous_session > student['studycourse'].current_session - 1:
    55                     return _('This is not a previous session.'), None
    56             p_session = previous_session
    57             p_level = previous_level
    58             p_current = False
    59         else:
    60             p_session = student['studycourse'].current_session
    61             p_level = student['studycourse'].current_level
    62             p_current = True
     70        p_session = student['studycourse'].current_session
     71        p_level = student['studycourse'].current_level
     72        p_current = True
    6373        academic_session = self._getSessionConfiguration(p_session)
    6474        if academic_session == None:
     
    7181            except (AttributeError, TypeError):
    7282                return _('Study course data are incomplete.'), None
    73             if previous_session:
    74                 # Students can pay for previous sessions in all
    75                 # workflow states.  Fresh students are excluded by the
    76                 # update method of the PreviousPaymentAddFormPage.
    77                 if previous_level == 100:
    78                     amount = getattr(certificate, 'school_fee_1', 0.0)
    79                 else:
    80                     amount = getattr(certificate, 'school_fee_2', 0.0)
    81             else:
    82                 if student.state == CLEARED:
    83                     amount = getattr(certificate, 'school_fee_1', 0.0)
    84                 elif student.state == RETURNING:
    85                     # In case of returning school fee payment the
    86                     # payment session and level contain the values of
    87                     # the session the student has paid for. Payment
    88                     # session is always next session.
    89                     p_session, p_level = self.getReturningData(student)
    90                     academic_session = self._getSessionConfiguration(p_session)
    91                     if academic_session == None:
    92                         return _(
    93                             u'Session configuration object is not available.'
    94                             ), None
    95                     amount = getattr(certificate, 'school_fee_2', 0.0)
    96                 elif student.is_postgrad and student.state == PAID:
    97                     # Returning postgraduate students also pay for the
    98                     # next session but their level always remains the
    99                     # same.
    100                     p_session += 1
    101                     academic_session = self._getSessionConfiguration(p_session)
    102                     if academic_session == None:
    103                         return _(
    104                             u'Session configuration object is not available.'
    105                             ), None
    106                     amount = getattr(certificate, 'school_fee_2', 0.0)
     83            if student.state == RETURNING:
     84                # Override p_session and p_level
     85                p_session, p_level = self.getReturningData(student)
     86                academic_session = self._getSessionConfiguration(p_session)
     87                if academic_session == None:
     88                    return _(u'Session configuration object '
     89                              'is not available.'), None
     90            if student.state in (RETURNING, CLEARED):
     91                if p_level in PAYMENT_LEVELS:
     92                    amount = SCHOOL_FEES.get_fee(
     93                        (
     94                         local_nonlocal(student),
     95                         student.current_mode,
     96                         p_level)
     97                        )
     98                    amount += GATEWAY_AMT
    10799        elif category == 'clearance':
    108100            try:
     
    111103                return _('Study course data are incomplete.'), None
    112104            amount = academic_session.clearance_fee
     105            if local_nonlocal(student) == 'non-local':
     106                amount += 5000.0
    113107        elif category == 'bed_allocation':
    114108            p_item = self.getAccommodationDetails(student)['bt']
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/utils/utils.py

    r14333 r14336  
    3434
    3535    STUDY_MODES_DICT = {
    36         'ume_ft': 'UME Full Time',
    3736        'ug_ft': 'Undergraduate Full Time',
    38         'ug_pt': 'Undergraduate Part Time',
    39         'dp_pt': 'Diploma Part Time',
    40         'ct_ft': 'Certificate Full Time',
    41         'dp_ft': 'Diploma Full Time',
    42         'de_ft': 'Direct Entry Full Time',
    43         'de_pt': 'Direct Entry Part Time',
    44         'nd_ft': 'National Diploma Full Time',
    45         'nd_pt': 'National Diploma Part Time',
    46         'hnd_ft': 'Higher National Diploma Full Time',
    47         'hnd_pt': 'Higher National Diploma Part Time',
    4837        'pg_ft': 'Postgraduate Full Time',
    4938        'pg_pt': 'Postgraduate Part Time',
    50         'pgd_ft': 'Postgraduate Diploma Full Time',
    51         'pgd_pt': 'Postgraduate Diploma Part Time',
    52         'special_pg_pt': 'Special Postgraduate Part Time',
    5339        'nce_ft': 'NCE Full Time',
    5440        'nce_pt': 'NCE Part Time',
    55         'ug_sw': 'Undergraduate Sandwich',
    5641        'nce_sw': 'NCE Sandwich',
    57         'jm_ft': 'Joint Matriculation Full Time',
    58         'ph_ft': 'Post Higher Education Full Time',
    59         'transfer_pt': 'Transfer Part Time',
    60         'transfer_ft': 'Transfer Full Time',
    61         'ct_pt': 'Certificate Part Time',
    62         'rmd_ft': 'Remedial with deficiencies',
    63         'rm_ft': 'Remedial',
    64         'transfer': 'Transfer',
    6542        'prence': 'Pre-NCE',
    66         'prend': 'Pre-ND',
    67         'pce': 'PCE',
    68         'pd_ft': 'Professional Diploma in Education',
    69         'found': 'Foundation',
    7043        'no': 'no application',
    7144        }
Note: See TracChangeset for help on using the changeset viewer.