Changeset 13403 for main


Ignore:
Timestamp:
7 Nov 2015, 06:16:00 (9 years ago)
Author:
Henrik Bettermann
Message:

Rename school function.

Rename payment categories.

Add test to produce payment pdf slip.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
4 edited

Legend:

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

    r13400 r13403  
    4949
    5050
    51 def school(student):
     51def contr_agreement(student):
    5252    if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
    53         return 'pt'
    54     return 'regular'
     53        return 'first'
     54    return 'second'
    5555
    5656class CustomInterswitchPageApplicant(InterswitchPageApplicant):
     
    141141            self.redirect(self.url(self.context, '@@index'))
    142142            return
    143         if school(student) == 'pt':
     143        if contr_agreement(student) == 'first':
    144144            self.product_id = PRODUCT_ID_PT
    145145        else:
     
    180180        # Schoolfee
    181181        if self.context.p_category.startswith('schoolfee'):
    182             if school(student) == 'pt':
    183                 # PT schoolfee settings
     182            if contr_agreement(student) == 'first':
     183                # First agreement
    184184                provider_amt = 1900.0
    185185                joint_venture_amt = 1100.0
     
    194194                    self.pay_item_id = '105'
    195195            else:
    196                 # REGULAR schoolfee settings
     196                # Second agreement
    197197                provider_amt = 1500.0
    198198                joint_venture_amt = 1000.0
     
    249249        # Clearance
    250250        elif self.context.p_category.startswith('clearance'):
    251             if school(student) == 'pt':
    252                 # PT clearance settings
     251            if contr_agreement(student) == 'first':
     252                # First agreement
    253253                if student.current_mode == 'found':
    254254                    self.pay_item_id = '102'
     
    258258                xmldict['institution_bank_id'] = '117'
    259259            else:
    260                 # REGULAR clearance settings
     260                # Second agreement
    261261                self.pay_item_id = '102'
    262262                xmldict['institution_acct'] = '1010827641'
    263263                xmldict['institution_bank_id'] = '117'
    264 
    265264
    266265            if self.context.p_category == 'clearance_incl':
     
    294293</payment_item_detail>""" % xmldict
    295294
    296         # Union Due
     295        # Union Dues
    297296        elif self.context.p_category == 'union':
    298297            self.pay_item_id = '103'
     
    307306</payment_item_detail>""" % xmldict
    308307
    309         # Lapel
     308        # Lapel/File
    310309        elif self.context.p_category == 'lapel':
    311310            self.pay_item_id = '104'
     
    320319</payment_item_detail>""" % xmldict
    321320
    322         # Welfare
     321        # Welfare Assurance
    323322        elif self.context.p_category == 'welfare':
    324323            self.pay_item_id = '105'
     
    359358</payment_item_detail>""" % xmldict
    360359
    361         # Medical
     360        # Medical Acceptance
    362361        elif self.context.p_category == 'medical':
    363362            self.pay_item_id = '108'
     
    423422    @property
    424423    def product_id(self):
    425         if school(self.context.student) == 'pt':
     424        if contr_agreement(self.context.student) == 'first':
    426425            return PRODUCT_ID_PT
    427426        return PRODUCT_ID_REGULAR
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r13402 r13403  
    139139            in self.browser.contents)
    140140        self.assertTrue(
    141             'item_name="School Fee plus Students\' Union and Welfare Assurance Fees" '
     141            'item_name="School Fee plus" '
    142142            'item_amt="4600000" bank_id="7" '
    143143            'acct_num="1014847058"' in self.browser.contents)
     
    213213            in self.browser.contents)
    214214        self.assertTrue(
    215             'item_name="Acceptance Fee plus Matric Gown and Lapel/File Fees" '
     215            'item_name="Acceptance Fee plus" '
    216216            'item_amt="4000000" bank_id="117" '
    217217            'acct_num="1014066976"' in self.browser.contents)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13374 r13403  
    296296
    297297    def test_student_payments(self):
     298        self.certificate.study_mode = 'ug_ft'
     299        self.student['studycourse'].entry_session = 2013
     300        self.student['studycourse'].certificate.school_fee_1 = 50250.0
     301        self.app['configuration']['2004'].union_fee = 1000.0
     302        self.app['configuration']['2004'].welfare_fee = 500.0
     303        self.student.nationality = u'NG'
    298304        # Login
    299         IWorkflowState(self.student).setState('returning')
     305        IWorkflowState(self.student).setState('cleared')
    300306        self.browser.open(self.login_path)
    301307        self.browser.getControl(name="form.login").value = self.student_id
     
    303309        self.browser.getControl("Login").click()
    304310        self.browser.open(self.student_path + '/payments')
    305         self.assertTrue(
    306           'Add current session payment ticket' in self.browser.contents)
    307         self.assertFalse(
    308           'Add previous session payment ticket' in self.browser.contents)
     311        self.browser.getLink("Add current session payment ticket").click()
     312        self.browser.getControl(name="form.p_category").value = ['schoolfee_incl']
     313        self.browser.getControl("Create ticket").click()
     314        self.assertTrue('ticket created' in self.browser.contents)
     315        ctrl = self.browser.getControl(name='val_id')
     316        value = ctrl.options[0]
     317        self.browser.getLink(value).click()
     318        self.assertTrue('Amount Authorized' in self.browser.contents)
     319        self.assertEqual(self.student['payments'][value].amount_auth, 51750.0)
     320        self.browser.open(self.browser.url + '/payment_slip.pdf')
     321        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     322        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     323        path = os.path.join(samples_dir(), 'payment_slip.pdf')
     324        open(path, 'wb').write(self.browser.contents)
     325        print "Sample PDF payment_slip.pdf written to %s" % path
    309326        return
    310327
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r13402 r13403  
    3131        'schoolfee_1': 'School Fee 1st instalment',
    3232        'schoolfee_2': 'School Fee 2nd instalment',
    33         'schoolfee_incl': 'School Fee plus Students\' Union and Welfare Assurance Fees',
     33        'schoolfee_incl': 'School Fee plus',
    3434        'clearance': 'Acceptance Fee',
    35         'clearance_incl': 'Acceptance Fee plus Matric Gown and Lapel/File Fees',
     35        'clearance_incl': 'Acceptance Fee plus',
    3636        'hostel_maintenance': 'Hostel Maintenance Fee',
    3737        'application': 'Application Fee',
     
    5050
    5151    SELECTABLE_PAYMENT_CATEGORIES = {
    52         'schoolfee': 'School Fee',
     52        'schoolfee': 'School Fee without additional fees',
    5353        #'schoolfee_1': 'School Fee 1st instalment',
    5454        #'schoolfee_2': 'School Fee 2nd instalment',
    55         'schoolfee_incl': 'School Fee plus Students\' Union and Welfare Assurance Fees',
    56         'clearance': 'Acceptance Fee',
    57         'clearance_incl': 'Acceptance Fee plus Matric Gown and Lapel/File Fees',
     55        'schoolfee_incl': 'School Fee plus Students\' Union and Welfare Assurance fees',
     56        'clearance': 'Acceptance Fee without additional fees',
     57        'clearance_incl': 'Acceptance Fee plus Matric Gown and Lapel/File fees',
    5858        'hostel_maintenance': 'Hostel Maintenance Fee',
    5959        'application': 'Application Fee',
Note: See TracChangeset for help on using the changeset viewer.