Changeset 1992


Ignore:
Timestamp:
5 Jul 2007, 20:50:28 (17 years ago)
Author:
Henrik Bettermann
Message:

enable online payment for previous sessions

Location:
WAeUP_SRP/trunk
Files:
2 added
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/LICENSE.txt

    r486 r1992  
    1  
    2   SACustom
    31  Copyright 2005 WAeUP Group
    42
  • WAeUP_SRP/trunk/skins/waeup_epayment/getSchoolFee.py

    r1247 r1992  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=faculty=None
     7##parameters=faculty=None, session=None
    88##title=
    99##
     
    1818        "EDU",
    1919        )
    20 fee_1_data = ("22200","School Fee for Session 2006/2007")
    21 fee_2_data = ("23700","School Fee for Session 2006/2007")
     20       
     21sessionstring = "School Fee for Session %s" % context.portal_vocabularies.sessions.get(session)
     22fee_1_data = ("22200",sessionstring)
     23fee_2_data = ("23700",sessionstring)
    2224
    2325if faculty in fee1:
  • WAeUP_SRP/trunk/skins/waeup_epayment/interswitch_cb.py

    r1973 r1992  
    5151for rc,pdk in resp_codes:
    5252    pd[pdk] = request.get(rc,'')
     53
     54# for testing purposes
     55#pd['resp_desc'] = 'Simulated Callback'
     56#pd['resp_pay_reference'] = 'XXXX'
     57#pd['resp_code'] = '00'
     58#pd['resp_card_num'] = '0000'
     59#pd['resp_approved_amount'] = '10000'
     60
    5361if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
    5462    pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2]
     
    6371context.getContent().edit(mapping = pd)
    6472resp = pd['resp_code']
     73
     74s_brain = context.students_catalog(id=student_id)[0]
     75session = s_brain.session
     76next_session, next_session_str = context.getNextSessionId(session)
     77
    6578if  resp == '00':
    6679    if context.getStudentReviewState() == "school_fee_paid":
    6780        logger.info('%s paid school_fee in state school_fee_paid' % (student_id))
    6881    else:
    69         wftool.doActionFor(student,'pay_school_fee')
     82        if next_session == context.getSessionId()[-2:]:
     83            wftool.doActionFor(student,'pay_school_fee')
     84        else:
     85            study_course = getattr(student,'study_course')
     86            try:
     87                wftool.doActionFor(study_course,'open')
     88            except:
     89                pass
     90            study_course_doc = study_course.getContent()
     91            next_level = "%s" % (int(s_brain.level) + 100)
     92            study_course_doc.edit(mapping= {'current_level': next_level,
     93                                            'current_session': next_session,})
    7094    logger.info('%s received valid callback' % student_id)
    7195    referer = request.get('HTTP_REFERER','none')
  • WAeUP_SRP/trunk/skins/waeup_epayment/pay_interswitch.py

    r1946 r1992  
    3434
    3535sbrain = context.students_catalog(id=student_id)[0]
    36 amount,description = context.getSchoolFee(sbrain.faculty)
     36amount,description = context.getSchoolFee(sbrain.faculty,sbrain.session)
    3737info = {}
    3838info['site_id'] = '61'
     
    111111uniben_amount = itotal - interswitch_amount
    112112xmldict = {}
    113 xmldict['detail_ref'] = args['txn_ref'] 
    114 xmldict['department'] = sbrain.department 
     113xmldict['detail_ref'] = args['txn_ref']
     114xmldict['department'] = sbrain.department
    115115xmldict['faculty'] = sbrain.faculty
    116116#xmldict['wema_amt'] = "%d" % wema_amount
    117 #xmldict['provider_amt'] = "%d" % provider_amount 
     117#xmldict['provider_amt'] = "%d" % provider_amount
    118118xmldict['uniben_amt'] = "%d" % uniben_amount
    119119##<item_detail item_id="2" item_name="WEMA" item_amt="%(wema_amt)s" bank_id="16" acct_num="48398023902" />
     
    121121xmltext = """
    122122<payment_item_detail>
    123 <item_details detail_ref="%(detail_ref)s" college="UNIBEN" department="%(department)s" 
     123<item_details detail_ref="%(detail_ref)s" college="UNIBEN" department="%(department)s"
    124124faculty="%(faculty)s">
    125 <item_detail item_id="1" item_name="UNIBEN" item_amt="%(uniben_amt)s" bank_id="16" acct_num="384950902390" /> 
     125<item_detail item_id="1" item_name="UNIBEN" item_amt="%(uniben_amt)s" bank_id="16" acct_num="384950902390" />
    126126</item_details>
    127127</payment_item_detail>
Note: See TracChangeset for help on using the changeset viewer.