Changeset 9737


Ignore:
Timestamp:
28 Nov 2012, 17:00:43 (12 years ago)
Author:
Henrik Bettermann
Message:

Use carryover categories only for calculation of fee, then change to schoolfee.

Configure SELECTABLE_PAYMENT_CATEGORIES.

Add and adjust tests.

Location:
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py

    r9725 r9737  
    241241        xmldict['dalash_amt'] = 0
    242242        self.pay_item_id = '000'
    243         if self.context.p_category in ('schoolfee', 'co1', 'co2', 'co3'):
     243        if self.context.p_category == 'schoolfee':
    244244            self.pay_item_id = '101'
    245245            # Dalash data
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r9725 r9737  
    7979        IWorkflowState(self.student).setState('cleared')
    8080        self.browser.open(self.payments_path + '/addop')
     81        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    8182        self.browser.getControl("Create ticket").click()
    8283        self.assertMatches('...ticket created...',
     
    154155        self.assertMatches('...Amount Authorized...',
    155156                           self.browser.contents)
    156 
    157157        # Maint fee is taken from the session configuration object
    158158        self.assertMatches(
     
    174174        self.assertMatches(
    175175            '...item_name="Hostel Maintenance Fee" item_amt="68700" bank_id="31" acct_num="0039050937"...',
     176            self.browser.contents)
     177
     178        # Create carryover ticket
     179        self.browser.open(self.payments_path + '/addop')
     180        self.browser.getControl(name="form.p_category").value = ['carryover1']
     181        self.browser.getControl("Create ticket").click()
     182        ctrl = self.browser.getControl(name='val_id')
     183        value = ctrl.options[2]
     184        self.browser.getLink(value).click()
     185        self.assertMatches(
     186            '...<span>6000.0</span>...',
     187            self.browser.contents)
     188        # Manager can access InterswitchForm
     189        self.browser.getLink("CollegePAY", index=0).click()
     190        self.assertMatches('...<input type="hidden" name="pay_item_id" value="101" />...',
     191                           self.browser.contents)
     192        self.assertMatches('...Total Amount Authorized:...',
     193                           self.browser.contents)
     194        self.assertMatches(
     195            '...<input type="hidden" name="amount" value="600000.0" />...',
     196            self.browser.contents)
     197        self.assertMatches(
     198            '...item_name="School Fee" item_amt="270000" bank_id="120" acct_num="1771180233"...',
     199            self.browser.contents)
     200        self.assertMatches(
     201            '...item_name="Dalash" item_amt="180000" bank_id="117" acct_num="1013196791"...',
     202            self.browser.contents)
     203        self.assertMatches(
     204            '...item_name="BT Education" item_amt="120000" bank_id="117" acct_num="1010764827"...',
    176205            self.browser.contents)
    177206
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/tests/test_browser.py

    r9724 r9737  
    9696        self.browser.open(self.payments_path)
    9797        self.browser.getLink("Add current session payment ticket").click()
     98        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    9899        self.browser.getControl("Create ticket").click()
    99100        self.assertMatches('...Amount could not be determined...',
     
    101102        IWorkflowState(self.student).setState('cleared')
    102103        self.browser.open(self.payments_path + '/addop')
     104        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    103105        self.browser.getControl("Create ticket").click()
    104106        self.assertMatches('...ticket created...',
     
    117119        ticket.p_state = 'paid'
    118120        self.browser.open(self.payments_path + '/addop')
     121        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    119122        self.browser.getControl("Create ticket").click()
    120123        self.assertMatches('...This type of payment has already been made...',
     
    125128            del self.student['payments'][payment]
    126129        self.browser.open(self.payments_path + '/addop')
    127         self.browser.getControl("Create ticket").click()
    128         self.assertMatches('...ticket created...',
    129                            self.browser.contents)
    130         self.browser.open(self.payments_path + '/addop')
    131         self.browser.getControl(name="form.p_category").value = ['co1']
    132         self.browser.getControl("Create ticket").click()
    133         self.assertMatches('...ticket created...',
    134                            self.browser.contents)
    135         self.browser.open(self.payments_path + '/addop')
    136         self.browser.getControl(name="form.p_category").value = ['co2']
    137         self.browser.getControl("Create ticket").click()
    138         self.assertMatches('...ticket created...',
    139                            self.browser.contents)
    140         self.browser.open(self.payments_path + '/addop')
    141         self.browser.getControl(name="form.p_category").value = ['co3']
    142         self.browser.getControl("Create ticket").click()
    143         self.assertMatches('...ticket created...',
    144                            self.browser.contents)
    145         self.browser.open(self.payments_path + '/addop')
    146         self.browser.getControl(
    147             name="form.p_category").value = ['bed_allocation']
     130        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     131        self.browser.getControl("Create ticket").click()
     132        self.assertMatches('...ticket created...',
     133                           self.browser.contents)
     134        self.browser.open(self.payments_path + '/addop')
     135        self.browser.getControl(name="form.p_category").value = ['carryover1']
     136        self.browser.getControl("Create ticket").click()
     137        self.assertMatches('...ticket created...',
     138                           self.browser.contents)
     139        self.browser.open(self.payments_path + '/addop')
     140        self.browser.getControl(name="form.p_category").value = ['carryover2']
     141        self.browser.getControl("Create ticket").click()
     142        self.assertMatches('...ticket created...',
     143                           self.browser.contents)
     144        self.browser.open(self.payments_path + '/addop')
     145        self.browser.getControl(name="form.p_category").value = ['carryover3']
    148146        self.browser.getControl("Create ticket").click()
    149147        self.assertMatches('...ticket created...',
     
    152150        self.browser.getControl(
    153151            name="form.p_category").value = ['hostel_maintenance']
    154         self.browser.getControl("Create ticket").click()
    155         self.assertMatches('...ticket created...',
    156                            self.browser.contents)
    157         self.browser.open(self.payments_path + '/addop')
    158         self.browser.getControl(name="form.p_category").value = ['clearance']
    159152        self.browser.getControl("Create ticket").click()
    160153        self.assertMatches('...ticket created...',
     
    256249        self.assertEqual(error, None)
    257250
    258         error, payment = utils.setPaymentDetails('co1',self.student)
     251        error, payment = utils.setPaymentDetails('carryover1',self.student)
    259252        self.assertEqual(payment.p_level, 100)
    260253        self.assertEqual(payment.p_session, 2004)
    261254        self.assertEqual(payment.amount_auth, 6000.0)
    262         self.assertEqual(payment.p_item, u'')
    263         self.assertEqual(error, None)
    264 
    265         error, payment = utils.setPaymentDetails('co2',self.student)
     255        self.assertEqual(payment.p_item, u'1 CarryOver')
     256        self.assertEqual(payment.p_category, 'schoolfee')
     257        self.assertEqual(error, None)
     258
     259        error, payment = utils.setPaymentDetails('carryover2',self.student)
    266260        self.assertEqual(payment.p_level, 100)
    267261        self.assertEqual(payment.p_session, 2004)
    268262        self.assertEqual(payment.amount_auth, 7000.0)
    269         self.assertEqual(payment.p_item, u'')
    270         self.assertEqual(error, None)
    271 
    272         error, payment = utils.setPaymentDetails('co3',self.student)
     263        self.assertEqual(payment.p_item, u'2 CarryOvers')
     264        self.assertEqual(payment.p_category, 'schoolfee')
     265        self.assertEqual(error, None)
     266
     267        error, payment = utils.setPaymentDetails('carryover3',self.student)
    273268        self.assertEqual(payment.p_level, 100)
    274269        self.assertEqual(payment.p_session, 2004)
    275270        self.assertEqual(payment.amount_auth, 8000.0)
    276         self.assertEqual(payment.p_item, u'')
     271        self.assertEqual(payment.p_item, u'3 CarryOvers')
     272        self.assertEqual(payment.p_category, 'schoolfee')
    277273        self.assertEqual(error, None)
    278274
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py

    r9724 r9737  
    1919import random
    2020from time import time
    21 from zope.component import createObject
     21from zope.component import createObject, getUtility
    2222from waeup.kofa.interfaces import CLEARED, RETURNING, PAID
    2323from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
    2424from waeup.kofa.accesscodes import create_accesscode
    25 from waeup.kofa.interfaces import CLEARED, RETURNING
     25from waeup.kofa.interfaces import CLEARED, RETURNING, IKofaUtils
    2626from waeup.kofa.fees import FeeTable
    2727from waeup.kwarapoly.interfaces import MessageFactory as _
     
    164164                         p_level)
    165165                        )
    166         elif category == 'co1':
     166        elif category == 'carryover1':
    167167            amount = 6000.0
    168         elif category == 'co2':
     168        elif category == 'carryover2':
    169169            amount = 7000.0
    170         elif category == 'co3':
     170        elif category == 'carryover3':
    171171            amount = 8000.0
    172172        if amount in (0.0, None):
     
    179179               ticket.p_session == p_session:
    180180                  return _('This type of payment has already been made.'), None
     181        if category.startswith('carryover'):
     182            p_item = getUtility(IKofaUtils).PAYMENT_CATEGORIES[category]
     183            p_item = unicode(p_item)
     184            # Now we change the category to reduce the number of categories.
     185            category = 'schoolfee'
    181186        payment = createObject(u'waeup.StudentOnlinePayment')
    182187        timestamp = ("%d" % int(time()*10000))[1:]
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/utils/utils.py

    r9724 r9737  
    4343    PAYMENT_CATEGORIES = {
    4444        'schoolfee': 'School Fee',
    45         'co1': '1 Carry-Over',
    46         'co2': '2 Carry-Overs',
    47         'co3': '3 Carry-Overs',
     45        'carryover1': '1 CarryOver',
     46        'carryover2': '2 CarryOvers',
     47        'carryover3': '3 CarryOvers',
    4848        'clearance': 'Acceptance Fee',
    4949        'bed_allocation': 'Bed Allocation Fee',
     
    5151        'application': 'Application Fee'
    5252        }
     53
     54    SELECTABLE_PAYMENT_CATEGORIES = {
     55        'schoolfee': 'School Fee',
     56        'carryover1': 'One CarryOver',
     57        'carryover2': 'Two CarryOvers',
     58        'carryover3': 'Three CarryOvers',
     59        'hostel_maintenance': 'Hostel Maintenance Fee',
     60        }
Note: See TracChangeset for help on using the changeset viewer.