Ignore:
Timestamp:
20 Mar 2012, 10:14:00 (13 years ago)
Author:
Henrik Bettermann
Message:

Avoid duplicate code.

File:
1 edited

Legend:

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

    r7920 r7926  
    2020import os
    2121from waeup.kofa.utils.utils import KofaUtils
     22from waeup.kofa.accesscodes import create_accesscode
     23from waeup.custom.interfaces import MessageFactory as _
     24
     25def actions_after_payment(student, payment, view):
     26    if payment.p_category == 'clearance':
     27        # Create CLR access code
     28        pin, error = create_accesscode('CLR',0,student.student_id)
     29        if error:
     30            view.flash(_('Valid callback received. ${a}',
     31                mapping = {'a':error}))
     32            return
     33        payment.ac = pin
     34    elif payment.p_category == 'schoolfee':
     35        # Create SFE access code
     36        pin, error = create_accesscode('SFE',0,student.student_id)
     37        if error:
     38            view.flash(_('Valid callback received. ${a}',
     39                mapping = {'a':error}))
     40            return
     41        payment.ac = pin
     42    elif payment.p_category == 'bed_allocation':
     43        # Create HOS access code
     44        pin, error = create_accesscode('HOS',0,student.student_id)
     45        if error:
     46            view.flash(_('Valid callback received. ${a}',
     47                mapping = {'a':error}))
     48            return
     49        payment.ac = pin
     50    view.flash(_('Valid callback received.'))
     51    return
    2252
    2353
Note: See TracChangeset for help on using the changeset viewer.