Ignore:
Timestamp:
28 Feb 2011, 10:53:12 (14 years ago)
Author:
Henrik Bettermann
Message:

Implement online maintenance fee payment at FUTMinna.

Enable random order booking at FCEOkene.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_epayment/interswitch_cb.py

    r3964 r5781  
    4646logger.info('%s, callback referer = %s, IP = %s' % (student_id,referer,real_ip))
    4747
    48 if not 'webpay.interswitchng.com' in referer and not 'waeup.org' in referer:
     48ontest = False
     49
     50if not ontest and not 'webpay.interswitchng.com' in referer and not 'waeup.org' in referer:
    4951    logger.info('%s, wrong callback referer %s, callback rejected, IP = %s' % (student_id,referer,real_ip))
    5052    return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
     
    6365    pd[pdk] = request.get(rc,'')
    6466
    65 ## for testing purposes
    66 #pd['resp_desc'] = 'Simulated Callback'
    67 #pd['resp_pay_reference'] = 'XXXX'
    68 #pd['resp_code'] = '00'
    69 #pd['resp_card_num'] = '0000'
    70 #pd['resp_approved_amount'] = '4680000'
     67if ontest:
     68    pd['resp_desc'] = 'Simulated Callback'
     69    pd['resp_pay_reference'] = 'XXXX'
     70    pd['resp_code'] = '00'
     71    pd['resp_card_num'] = '0000'
     72    pd['resp_approved_amount'] = '4680000'
    7173
    7274if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
     
    9294        resp_approved_amount = int(pd['resp_approved_amount'])
    9395        #set_trace()
    94         if amount + surcharge != resp_approved_amount:
     96        if not ontest and amount + surcharge != resp_approved_amount:
    9597            logger.info('Warning: %s, approved amount %s and authorized amount %s are different for payment %s of %s' % (member,resp_approved_amount,amount+surcharge,context.getId(),student_id))
    9698            pd['status'] = 'failed'
     
    140142
    141143    elif pay_doc.category == 'hostel_maintenance':
    142         acco_info = context.getAccommodationInfo()
    143         d = {}
    144         d['acco_maint_date'] = pay_doc.date
    145         d['acco_maint_fee'] = pay_doc.amount
    146         d['acco_maint_pay_id'] = context.getId()
    147         try:
    148             acco_info['acco_doc'].edit(mapping=d)
    149         except:
    150             logger.info('%s requeried payment though maintenance already paid' % student_id)
    151 
    152         try:
    153             wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
    154         except:
    155             logger.info('%s no workflow action pay_maintenance_fee' % student_id)
     144       
     145        ## callback function for accommodation_catalog method
     146        data={}
     147        data['acco_maint_date'] = pay_doc.date
     148        data['catkey'] =student_id + '|' + session
     149        data['acco_maint_fee'] = pay_doc.amount
     150        data['acco_maint_pay_id'] = context.getId()
     151        data['reservation_status'] = 'maintenance_fee_paid'
     152        context.accommodation_catalog.modifyRecord(**data)       
     153       
     154        ## callback function for accommodation object method (deactivated since March 2011)
     155        #acco_info = context.getAccommodationInfo()
     156        #d = {}
     157        #d['acco_maint_date'] = pay_doc.date
     158        #d['acco_maint_fee'] = pay_doc.amount
     159        #d['acco_maint_pay_id'] = context.getId()
     160        #try:
     161        #    acco_info['acco_doc'].edit(mapping=d)
     162        #except:
     163        #    logger.info('%s requeried payment though maintenance already paid' % student_id)
     164        #try:
     165        #    wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
     166        #except:
     167        #    logger.info('%s no workflow action pay_maintenance_fee' % student_id)
    156168           
    157169
Note: See TracChangeset for help on using the changeset viewer.