Changeset 13816


Ignore:
Timestamp:
8 Apr 2016, 05:26:51 (9 years ago)
Author:
Henrik Bettermann
Message:

Determine total registration fee.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py

    r13814 r13816  
    3030from waeup.uniben.configuration import CustomSessionConfiguration
    3131from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup, PH_LEN
     32
     33session_1 = datetime.now().year - 2
     34SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    3235
    3336class CustomApplicantUITests(ApplicantsFullSetup):
     
    227230        print "Sample nils_application_slip.pdf written to %s" % path
    228231
    229     def test_ictwk_application_slip(self):
     232    def test_ictwk_application(self):
    230233
    231234        # Remove required FieldProperty attribute first ...
     
    243246        #self.browser.getControl(name="form.sex").value = ['m']
    244247        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     248        image = open(SAMPLE_IMAGE, 'rb')
     249        ctrl = self.browser.getControl(name='form.passport')
     250        file_ctrl = ctrl.mech_control
     251        file_ctrl.add_file(image, filename='myphoto.jpg')
    245252        self.browser.getControl("Save").click()
    246253        self.applicant.registration_cats = ['group', 'corporate']
     254        IWorkflowState(self.applicant).setState('started')
     255        configuration = CustomSessionConfiguration()
     256        configuration.academic_session = session_1
     257        configuration.application_fee = 0.0
     258        self.app['configuration'].addSessionConfiguration(configuration)
     259        self.browser.getControl("Add online payment ticket").click()
     260        self.assertMatches('...Payment ticket created...',
     261                           self.browser.contents)
     262        self.assertEqual(self.applicant.values()[0].amount_auth, 450000)
    247263        IWorkflowState(self.applicant).setState('submitted')
    248264        self.browser.open(self.view_path)
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py

    r13815 r13816  
    1919"""
    2020
     21import grok
     22from time import time
    2123from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils
    2224from waeup.kofa.applicants.workflow import (INITIALIZED,
    2325    STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED)
     26from waeup.uniben.applicants.interfaces import REGISTRATION_CATS
    2427from waeup.uniben.interfaces import MessageFactory as _
    25 
    26 
    2728
    2829class CustomApplicantsUtils(NigeriaApplicantsUtils):
     
    9091                fee_name = applicant.special_application + '_fee'
    9192                payment.amount_auth = getattr(session_config, fee_name, None)
    92                 if payment.amount_auth in (0.0, None):
    93                     return _('Amount could not be determined.')
    9493                payment.p_category = applicant.special_application
    9594            return
    96         payment.p_category = 'application'
    97         container_fee = container.application_fee
    98         if container_fee:
    99             payment.amount_auth = container_fee
    100             return
    101         payment.amount_auth = session_config.application_fee
     95        elif applicant.__parent__.prefix == 'ictwk':
     96            payment.p_category = 'registration'
     97            for cat in applicant.registration_cats:
     98                payment.amount_auth += REGISTRATION_CATS[cat][1]
     99        else:
     100            payment.p_category = 'application'
     101            container_fee = container.application_fee
     102            if container_fee:
     103                payment.amount_auth = container_fee
     104                return
     105            payment.amount_auth = session_config.application_fee
    102106        if payment.amount_auth in (0.0, None):
    103107            return _('Amount could not be determined.')
    104108        return
    105 
  • main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py

    r13785 r13816  
    8282        'admission_checking': 'Admission Checking Fee',
    8383        'jupeb': 'JUPEB Examination Fee',
     84        'registration': 'Registration Fee'
    8485        }
    8586
Note: See TracChangeset for help on using the changeset viewer.