Changeset 17038


Ignore:
Timestamp:
27 Jul 2022, 13:08:44 (2 years ago)
Author:
Henrik Bettermann
Message:

Start customization of fee calculation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/applicants/utils.py

    r17030 r17038  
    5454        'tsc': ['Transcript', 'TRF'],
    5555        }
     56
     57    def setPaymentDetails(self, container, payment, applicant):
     58        """Set the payment data of an applicant.
     59        In contrast to its `StudentsUtils` counterpart, the payment ticket
     60        must exist and is an argument of this method.
     61        """
     62        timestamp = ("%d" % int(time()*10000))[1:]
     63        payment.p_id = "p%s" % timestamp
     64        payment.p_item = container.title
     65        if container.year:
     66            payment.p_session = container.year
     67        else:
     68            payment.p_session = datetime.now().year
     69        payment.amount_auth = 0.0
     70        if applicant.special:
     71            if applicant.special_application:
     72                try:
     73                    session_config = grok.getSite()['configuration'][
     74                        str(payment.p_session)]
     75                except KeyError:
     76                    return _(u'Session configuration object is not available.')   
     77                fee_name = applicant.special_application + '_fee'
     78                payment.amount_auth = getattr(session_config, fee_name, None)
     79                payment.p_category = applicant.special_application
     80            if payment.amount_auth in (0.0, None):
     81                return _('Amount could not be determined. Have you saved the form?')
     82            return
     83        payment.p_category = 'application'
     84        container_fee = container.application_fee
     85        if not container_fee:
     86            return _('Amount could not be determined.')
     87        payment.amount_auth = container_fee
     88        return       
Note: See TracChangeset for help on using the changeset viewer.