Ignore:
Timestamp:
3 Dec 2016, 17:05:31 (8 years ago)
Author:
Henrik Bettermann
Message:

Take number of copies into consideration when calculating amount_auth.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/applicants
Files:
2 edited

Legend:

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

    r14304 r14307  
    2424from zope.component import createObject, getUtility
    2525from waeup.kofa.configuration import SessionConfiguration
     26from waeup.kofa.interfaces import IUserAccount
    2627from waeup.kofa.applicants.container import ApplicantsContainer
    2728from waeup.kofa.browser.tests.test_pdf import samples_dir
     
    199200        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    200201        self.assertTrue("3rd Higher Education Record" in self.browser.contents)
     202
     203    def test_transcript_payment(self):
     204        configuration = SessionConfiguration()
     205        configuration.academic_session = session_1
     206        self.app['configuration'].addSessionConfiguration(configuration)
     207        # Add special application container
     208        applicantscontainer = ApplicantsContainer()
     209        applicantscontainer.year = session_1
     210        applicantscontainer.application_fee = 200.0
     211        applicantscontainer.code = u'trans1234'
     212        applicantscontainer.prefix = 'trans'
     213        applicantscontainer.title = u'This is a trans container'
     214        applicantscontainer.application_category = 'no'
     215        applicantscontainer.mode = 'create'
     216        applicantscontainer.strict_deadline = True
     217        delta = datetime.timedelta(days=10)
     218        applicantscontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     219        applicantscontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     220        self.app['applicants']['trans1234'] = applicantscontainer
     221        # Add an applicant
     222        applicant = createObject('waeup.Applicant')
     223        # reg_number is the only field which has to be preset here
     224        # because managers are allowed to edit this required field
     225        applicant.reg_number = u'12345'
     226        self.app['applicants']['trans1234'].addApplicant(applicant)
     227        IUserAccount(
     228            self.app['applicants']['trans1234'][
     229            applicant.application_number]).setPassword('apwd')
     230        # Login
     231        self.browser.open(self.login_path)
     232        self.browser.getControl(
     233            name="form.login").value = applicant.applicant_id
     234        self.browser.getControl(name="form.password").value = 'apwd'
     235        self.browser.getControl("Login").click()
     236        self.browser.getLink("Edit").click()
     237        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
     238        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     239        self.browser.getControl(name="form.nationality").value = ['NG']
     240        #self.browser.getControl(name="form.sex").value = ['f']
     241        self.browser.getControl(name="form.firstname").value = 'Angela'
     242        self.browser.getControl(name="form.lastname").value = 'Merkel'
     243        self.browser.getControl(name="form.no_copies").value = ['3']
     244        self.browser.getControl("Save").click()
     245        self.browser.getControl("Add online payment ticket").click()
     246        self.assertTrue('Payment ticket created' in self.browser.contents)
     247        self.assertTrue('<span>600.0</span>' in self.browser.contents)
     248        self.assertEqual(applicant.values()[0].amount_auth, 600.0)
     249        return
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py

    r14304 r14307  
    8282            title = "NA / %s (%s)" % (value.title, value.code)
    8383        return title
     84
     85    def setPaymentDetails(self, container, payment, applicant):
     86        msg = super(ApplicantsUtils, self).setPaymentDetails(
     87            container, payment, applicant)
     88        if msg:
     89            return msg
     90        if applicant.container_code.startswith('trans') or \
     91            applicant.container_code.startswith('cert'):
     92            payment.amount_auth = applicant.no_copies * container.application_fee
     93        return
Note: See TracChangeset for help on using the changeset viewer.