Changeset 10832


Ignore:
Timestamp:
10 Dec 2013, 07:40:18 (11 years ago)
Author:
Henrik Bettermann
Message:

Reorganize setPaymentDetails. Add test.

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

Legend:

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

    r10831 r10832  
    758758            in logcontent)
    759759
    760     def test_pay_application_fee(self):
     760    def test_pay_portal_application_fee(self):
    761761        self.login()
    762762        self.browser.open(self.edit_path)
     
    869869        return
    870870
     871    def test_pay_container_application_fee(self):
     872        self.login()
     873        self.browser.open(self.edit_path)
     874        self.fill_correct_values()
     875        self.browser.getControl("Save").click()
     876        configuration = SessionConfiguration()
     877        configuration.academic_session = session_1
     878        self.applicantscontainer.application_fee = 120.0
     879        configuration.application_fee = 9999.9
     880        self.app['configuration'].addSessionConfiguration(configuration)
     881        self.browser.open(self.edit_path)
     882        self.browser.getControl("Add online payment ticket").click()
     883        self.assertMatches('...Payment ticket created...',
     884                           self.browser.contents)
     885        self.assertMatches('...Payment ticket created...',
     886                           self.browser.contents)
     887        self.assertFalse(
     888            '<span>9999.9</span>' in self.browser.contents)
     889        self.assertTrue(
     890            '<span>120.0</span>' in self.browser.contents)
     891        self.assertTrue(
     892            '<span>Application Fee</span>' in self.browser.contents)
     893        return
    871894
    872895    def test_pay_special_fee(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r10831 r10832  
    4747        """
    4848        timestamp = ("%d" % int(time()*10000))[1:]
    49         container_fee = container.application_fee
    50         if container_fee:
    51             payment.amount_auth = container_fee
    52         else:
    53             session = str(container.year)
    54             try:
    55                 session_config = grok.getSite()['configuration'][session]
    56             except KeyError:
    57                 return _(u'Session configuration object is not available.')
    58             payment.amount_auth = session_config.application_fee
    59             payment.p_category = 'application'
     49        session = str(container.year)
     50        try:
     51            session_config = grok.getSite()['configuration'][session]
     52        except KeyError:
     53            return _(u'Session configuration object is not available.')
     54        payment.p_id = "p%s" % timestamp
     55        payment.p_item = container.title
     56        payment.p_session = container.year
    6057        if container.prefix.startswith('special'):
    6158            fee_name = applicant.special_application + '_fee'
    6259            payment.amount_auth = getattr(session_config, fee_name, 0.0)
    6360            payment.p_category = applicant.special_application
    64         payment.p_id = "p%s" % timestamp
    65         payment.p_item = container.title
    66         payment.p_session = container.year
    67         return None
     61            return
     62        payment.p_category = 'application'
     63        container_fee = container.application_fee
     64        if container_fee:
     65            payment.amount_auth = container_fee
     66            return
     67        payment.amount_auth = session_config.application_fee
     68        return
    6869
    6970    def getApplicantsStatistics(self, container):
Note: See TracChangeset for help on using the changeset viewer.