Ignore:
Timestamp:
8 Apr 2016, 04:31:35 (9 years ago)
Author:
Henrik Bettermann
Message:

Start customizing setPaymentDetails.

File:
1 edited

Legend:

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

    r13796 r13815  
    6969                fac_stats[faculty.__name__] += 1
    7070        return state_stats, fac_stats
     71
     72
     73    def setPaymentDetails(self, container, payment, applicant):
     74        """Set the payment data of an applicant.
     75        In contrast to its `StudentsUtils` counterpart, the payment ticket
     76        must exist and is an argument of this method.
     77        """
     78        timestamp = ("%d" % int(time()*10000))[1:]
     79        session = str(container.year)
     80        try:
     81            session_config = grok.getSite()['configuration'][session]
     82        except KeyError:
     83            return _(u'Session configuration object is not available.')
     84        payment.p_id = "p%s" % timestamp
     85        payment.p_item = container.title
     86        payment.p_session = container.year
     87        payment.amount_auth = 0.0
     88        if applicant.special:
     89            if applicant.special_application:
     90                fee_name = applicant.special_application + '_fee'
     91                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.')
     94                payment.p_category = applicant.special_application
     95            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
     102        if payment.amount_auth in (0.0, None):
     103            return _('Amount could not be determined.')
     104        return
     105
Note: See TracChangeset for help on using the changeset viewer.