## Script (Python) "getInterswitchParams"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=paytype,student,payment_id,order_id,student_record
##title=
##
# $Id: getInterswitchParams.py 3625 2008-08-17 07:47:00Z henrik $
	
	
test = ""
d = {}
d['payment_possible'] = True
d['pay_ship_to'] = "Federal University of Technology Minna"

d['site_id'] = '117'
d['site_name'] = "futminna.waeup.org"
d['currency_id'] = '566'
d['type'] = 'online'
d['status'] = 'started'
d['surcharge'] = 300
if test == 'simulate':
    d['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),payment_id) #do not use simulate_callback
elif test == 'test':
    d['action'] = "https://webpay.interswitchng.com/test_paydirect/webpay/pay.aspx"
else:
    d['action'] = "https://webpay.interswitchng.com/paydirect/webpay/pay.aspx"


if paytype in ('HOM','HOMH',):
    d['callback_function'] = 'interswitch_cb'
    d['pay_item_id'] = '11705'
    d['type_description'] = 'Hostel Maintenance Fee'
    d['pay_item_name'] = "FUT Minna %(type_description)s" % d
    if paytype == 'HOMH':
        d['fee'] = 15000
    elif student_record.level  in ('100','200','300','400','500') and student_record.faculty in ('EET','SET','AAT','ICT','EMT'):
        d['fee'] = 9000
    else:
        d['fee'] = 7000
    d['amount'] = d['fee'] + d['surcharge']
    d['category'] = 'hostel_maintenance'
    d['item'] = paytype
    
    #Adding xml split data
    d['payment_params'] = 'college_split'
    xmldict = {}
    xmldict['detail_ref'] = order_id
    xmldict['department'] = student_record.department
    xmldict['faculty'] = student_record.faculty
    xmldict['fut_amount'] = "%d" % int(100*d['fee'])
    
    xmltext = """<payment_item_detail>
    <item_details detail_ref="%(detail_ref)s" college="Federal University of Technology Minna" department="%(department)s" faculty="%(faculty)s">
    <item_detail item_id="1" item_name="Hostel Maintenance Fee" item_amt="%(fut_amount)s" bank_id="101" acct_num="0591301005175" />
    </item_details>
    </payment_item_detail>""" % xmldict
    
    d['xml_data'] = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    
return d