Changeset 8746 for main


Ignore:
Timestamp:
18 Jun 2012, 06:59:17 (12 years ago)
Author:
Henrik Bettermann
Message:

Merged with waeup.uniben 8740:HEAD.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue

  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py

    r8728 r8746  
    312312    """
    313313
    314     def loggerInfo(ob_class, comment):
     314    def writeLogMessage(view, comment):
    315315        """Adds an INFO message to the log file
    316316        """
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r8734 r8746  
    3333from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment
    3434
     35ACCEPTED_IP = None
     36
    3537# Kofa's webservice
    3638
     
    4143
    4244    def update(self, PAYEE_ID=None):
     45        # It seems eTranzact sends a POST request with an empty body but the URL
     46        # contains a query string. So it's actually a GET request pretended
     47        # to be a POST request. Although this does not comply with the
     48        # RFC 2616 HTTP guidelines we try to fetch the id from the QUERY_STRING
     49        # value of the request.
     50        real_ip = self.request.get('HTTP_X_FORWARDED_FOR', None)
     51        if real_ip  and ACCEPTED_IP:
     52            if real_ip != ACCEPTED_IP:
     53                self.output = '-4'
     54                return
     55        if PAYEE_ID is None:
     56            try:
     57                PAYEE_ID = self.request['QUERY_STRING'].split('=')[1]
     58            except:
     59                self.output = '-2'
     60                return
    4361        cat = getUtility(ICatalog, name='payments_catalog')
    4462        results = list(cat.searchResults(p_id=(PAYEE_ID, PAYEE_ID)))
    4563        if len(results) != 1:
    4664            self.output = '-1'
    47         else:
    48             try:
    49                 owner = IPaymentWebservice(results[0])
    50                 full_name = owner.display_fullname
    51                 matric_no = owner.id
    52                 faculty = owner.faculty
    53                 department = owner.department
    54             except (TypeError, AttributeError):
    55                 self.output = '-1'
    56                 return
    57             amount = results[0].amount_auth
    58             payment_type = results[0].category
    59             programme_type = results[0].p_item
    60             academic_session = academic_sessions_vocab.getTerm(
    61                 results[0].p_session).title
    62             status = results[0].p_state
    63             self.output = (
    64                 'FULL_NAME=%s&' +
    65                 'FACULTY=%s&' +
    66                 'DEPARTMENT=%s&' +
    67                 'RETURN_TYPE=%s&' +
    68                 'PROGRAMME_TYPE=%s&' +
    69                 'PAYMENT_TYPE=%s&' +
    70                 'ACADEMIC_SESSION=%s&' +
    71                 'MATRIC_NO=%s&' +
    72                 'FEE_AMOUNT=%s&' +
    73                 'TRANSACTION_STATUS=%s') % (full_name, faculty,
    74                 department, PAYEE_ID, programme_type, payment_type,
    75                 academic_session, matric_no, amount, status)
     65            return
     66        try:
     67            owner = IPaymentWebservice(results[0])
     68            full_name = owner.display_fullname
     69            matric_no = owner.id
     70            faculty = owner.faculty
     71            department = owner.department
     72        except (TypeError, AttributeError):
     73            self.output = '-3'
     74            return
     75        amount = results[0].amount_auth
     76        payment_type = results[0].category
     77        programme_type = results[0].p_item
     78        academic_session = academic_sessions_vocab.getTerm(
     79            results[0].p_session).title
     80        status = results[0].p_state
     81        self.output = (
     82            'FULL_NAME=%s&' +
     83            'FACULTY=%s&' +
     84            'DEPARTMENT=%s&' +
     85            'RETURN_TYPE=%s&' +
     86            'PROGRAMME_TYPE=%s&' +
     87            'PAYMENT_TYPE=%s&' +
     88            'ACADEMIC_SESSION=%s&' +
     89            'MATRIC_NO=%s&' +
     90            'FEE_AMOUNT=%s&' +
     91            'TRANSACTION_STATUS=%s') % (full_name, faculty,
     92            department, PAYEE_ID, programme_type, payment_type,
     93            academic_session, matric_no, amount, status)
    7694        return
    7795
  • main/waeup.aaue/trunk/src/waeup/aaue/students/payments.py

    r8712 r8746  
    4343        return
    4444
    45     def getStudent(self):
     45    @property
     46    def student(self):
    4647        return self.__parent__.__parent__
    4748
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studycourse.py

    r8482 r8746  
    3838    @property
    3939    def next_session_allowed(self):
    40         state = self.getStudent().state
     40        state = self.student.state
    4141        certificate = getattr(self, 'certificate', None)
    4242        if certificate == None:
Note: See TracChangeset for help on using the changeset viewer.