Index: /main/waeup.kwarapoly/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kwarapoly/trunk/CHANGES.txt	(revision 11768)
+++ /main/waeup.kwarapoly/trunk/CHANGES.txt	(revision 11769)
@@ -4,4 +4,6 @@
 1.2dev (unreleased)
 ===================
+
+* Use dictionary for special payment parameter configuration.
 
 * If the total amount (amount authorized) is less than 2000 Nairas
Index: /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py
===================================================================
--- /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py	(revision 11768)
+++ /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py	(revision 11769)
@@ -50,4 +50,38 @@
 #URL = '/test_paydirect/services/TransactionQueryWs.asmx'
 httplib.HTTPConnection.debuglevel = 0
+
+
+SPECIAL_PAYMENT_PARAMS = {
+    'certificate': ('111', 200.0, 300.0, '7000016724', '9'),
+    'state_result': ('112', 200.0, 300.0, '7000016724', '9'),
+    'transcript_local': ('113', 200.0, 300.0, '7000016724', '9'),
+    'transcript_foreign': ('114', 200.0, 300.0, '7000016724', '9'),
+    'ver_result': ('115', 200.0, 300.0, '7000016724', '9'),
+    'change_course': ('116', 200.0, 300.0, '7000016724', '9'),
+    'change_inst': ('117', 200.0, 300.0, '7000016724', '9'),
+    'jamb_reject': ('118', 200.0, 300.0, '7000016724', '9'),
+    'cert_of_cert': ('119', 200.0, 300.0, '7000016724', '9'),
+    'ref_let': ('120', 200.0, 300.0, '7000016724', '9'),
+    'proc_cert': ('121', 200.0, 300.0, '7000016724', '9'),
+    'loss_idcard': ('122', 6.0, 9.0, '7000016724', '9'),
+    'loss_examcard': ('123', 3.0, 4.5, '7000016724', '9'),
+    'loss_result': ('124', 200.0, 300.0, '7000016724', '9'),
+    'loss_receipt': ('125', 200.0, 300.0, '7000016724', '9'),
+    'loss_clearance': ('126', 200.0, 300.0, '7000016724', '9'),
+    'conv_brochure': ('127', 200.0, 300.0, '7000016724', '9'),
+    'hnd_certificate': ('128', 200.0, 300.0, '7000016724', '9'),
+    'hnd_state_result': ('129', 200.0, 300.0, '7000016724', '9'),
+    'hnd_transcript_local': ('130', 200.0, 300.0, '7000016724', '9'),
+    'hnd_transcript_foreign': ('131', 200.0, 300.0, '7000016724', '9'),
+    'staff_loss_idcard': ('132', 6.0, 9.0, '7000016724', '9'),
+    'hnd_conv_brochure': ('133', 200.0, 300.0, '7000016724', '9'),
+    'pgd_state_result': ('134', 200.0, 300.0, '7000016724', '9'),
+    'pgd_conv_brochure': ('135', 200.0, 300.0, '7000016724', '9'),
+    'pgd_certificate': ('136', 200.0, 300.0, '7000016724', '9'),
+    'log_book': ('137', 3.0, 4.5, '1010508401', '117'),
+    'pgd_transcript_foreign': ('138', 200.0, 300.0, '7000016724', '9'),
+    'pgd_transcript_local': ('139', 200.0, 300.0, '7000016724', '9'),
+    'jamb_regularization': ('140', 200.0, 300.0, '0838798020', '76'),
+    }
 
 class CustomInterswitchPageStudent(InterswitchPageStudent):
@@ -116,84 +150,12 @@
                 xmldict['institution_bank_id'] = '8'
                 self.pay_item_id = '108'
-        elif self.context.p_category == 'certificate':
-            self.pay_item_id = '111'
-        elif self.context.p_category == 'state_result':
-            self.pay_item_id = '112'
-        elif self.context.p_category == 'transcript_local':
-            self.pay_item_id = '113'
-        elif self.context.p_category == 'transcript_foreign':
-            self.pay_item_id = '114'
-        elif self.context.p_category == 'ver_result':
-            self.pay_item_id = '115'
-        elif self.context.p_category == 'change_course':
-            self.pay_item_id = '116'
-        elif self.context.p_category == 'change_inst':
-            self.pay_item_id = '117'
-        elif self.context.p_category == 'jamb_reject':
-            self.pay_item_id = '118'
-        elif self.context.p_category == 'cert_of_cert':
-            self.pay_item_id = '119'
-        elif self.context.p_category == 'ref_let':
-            self.pay_item_id = '120'
-        elif self.context.p_category == 'proc_cert':
-            self.pay_item_id = '121'
-        elif self.context.p_category == 'loss_idcard':
-            self.pay_item_id = '122'
-            dalash_amt = 6.0
-            provider_amt = 9.0
-            #gateway_amt = 15.0
-            gateway_amt = round(0.015 * self.context.amount_auth, 2)
-        elif self.context.p_category == 'loss_examcard':
-            self.pay_item_id = '123'
-            dalash_amt = 3.0
-            provider_amt = 4.5
-            #gateway_amt = 7.5
-            gateway_amt = round(0.015 * self.context.amount_auth, 2)
-        elif self.context.p_category == 'loss_result':
-            self.pay_item_id = '124'
-        elif self.context.p_category == 'loss_receipt':
-            self.pay_item_id = '125'
-        elif self.context.p_category == 'loss_clearance':
-            self.pay_item_id = '126'
-        elif self.context.p_category == 'conv_brochure':
-            self.pay_item_id = '127'
-        elif self.context.p_category == 'hnd_certificate':
-            self.pay_item_id = '128'
-        elif self.context.p_category == 'hnd_state_result':
-            self.pay_item_id = '129'
-        elif self.context.p_category == 'hnd_transcript_local':
-            self.pay_item_id = '130'
-        elif self.context.p_category == 'hnd_transcript_foreign':
-            self.pay_item_id = '131'
-        elif self.context.p_category == 'staff_loss_idcard':
-            self.pay_item_id = '132'
-            dalash_amt = 6.0
-            provider_amt = 9.0
-            #gateway_amt = 15.0
-            gateway_amt = round(0.015 * self.context.amount_auth, 2)
-        elif self.context.p_category == 'hnd_conv_brochure':
-            self.pay_item_id = '133'
-        elif self.context.p_category == 'pgd_state_result':
-            self.pay_item_id = '134'
-        elif self.context.p_category == 'pgd_conv_brochure':
-            self.pay_item_id = '135'
-        elif self.context.p_category == 'pgd_certificate':
-            self.pay_item_id = '136'
-        elif self.context.p_category == 'log_book':
-            self.pay_item_id = '137'
-            dalash_amt = 3.0
-            provider_amt = 4.5
-            #gateway_amt = 7.5
-            gateway_amt = round(0.015 * self.context.amount_auth, 2)
-            xmldict['institution_acct'] = "1010508401"
-            xmldict['institution_bank_id'] = '117'
-        elif self.context.p_category == 'pgd_transcript_foreign':
-            self.pay_item_id = '138'
-        elif self.context.p_category == 'pgd_transcript_local':
-            self.pay_item_id = '139'
-        elif self.context.p_category == 'jamb_regularization':
-            self.pay_item_id = '140'
-            xmldict['institution_acct'] = "0838798020"
-            xmldict['institution_bank_id'] = '76'
+        elif self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys():
+            self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0]
+            dalash_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1]
+            provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2]
+            xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3]
+            xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][4]
+            if self.context.amount_auth <= 2000.0:
+                gateway_amt = round(0.015 * self.context.amount_auth, 2)
         elif 'maintenance' in self.context.p_category:
             self.pay_item_id = '102'
@@ -267,4 +229,6 @@
         dalash_amt = 200.0
         gateway_amt = GATEWAY_AMT
+        xmldict['institution_acct'] = '00000000000'
+        xmldict['institution_bank_id'] = '00'
         if self.applicant.applicant_id.startswith('hnd'):
             xmldict['institution_acct'] = '1771440667'
@@ -291,92 +255,12 @@
             dalash_amt = 0.0
         elif self.applicant.applicant_id.startswith('special'):
-            xmldict['institution_acct'] = "7000016724"
-            xmldict['institution_bank_id'] = '9'
-            if self.applicant.special_application == 'certificate':
-                self.pay_item_id = '111'
-            elif self.applicant.special_application == 'state_result':
-                self.pay_item_id = '112'
-            elif self.applicant.special_application == 'transcript_local':
-                self.pay_item_id = '113'
-            elif self.applicant.special_application == 'transcript_foreign':
-                self.pay_item_id = '114'
-            elif self.applicant.special_application == 'ver_result':
-                self.pay_item_id = '115'
-            elif self.applicant.special_application == 'change_course':
-                self.pay_item_id = '116'
-            elif self.applicant.special_application == 'change_inst':
-                self.pay_item_id = '117'
-            elif self.applicant.special_application == 'jamb_reject':
-                self.pay_item_id = '118'
-            elif self.applicant.special_application == 'cert_of_cert':
-                self.pay_item_id = '119'
-            elif self.applicant.special_application == 'ref_let':
-                self.pay_item_id = '120'
-            elif self.applicant.special_application == 'proc_cert':
-                self.pay_item_id = '121'
-            elif self.applicant.special_application == 'loss_idcard':
-                self.pay_item_id = '122'
-                dalash_amt = 6.0
-                provider_amt = 9.0
-                #gateway_amt = 15.0
-                gateway_amt = round(0.015 * self.context.amount_auth, 2)
-            elif self.applicant.special_application == 'loss_examcard':
-                self.pay_item_id = '123'
-                dalash_amt = 3.0
-                provider_amt = 4.5
-                #gateway_amt = 7.5
-                gateway_amt = round(0.015 * self.context.amount_auth, 2)
-            elif self.applicant.special_application == 'loss_result':
-                self.pay_item_id = '124'
-            elif self.applicant.special_application == 'loss_receipt':
-                self.pay_item_id = '125'
-            elif self.applicant.special_application == 'loss_clearance':
-                self.pay_item_id = '126'
-            elif self.applicant.special_application == 'conv_brochure':
-                self.pay_item_id = '127'
-            elif self.applicant.special_application == 'hnd_certificate':
-                self.pay_item_id = '128'
-            elif self.applicant.special_application == 'hnd_state_result':
-                self.pay_item_id = '129'
-            elif self.applicant.special_application == 'hnd_transcript_local':
-                self.pay_item_id = '130'
-            elif self.applicant.special_application == 'hnd_transcript_foreign':
-                self.pay_item_id = '131'
-            elif self.applicant.special_application == 'staff_loss_idcard':
-                self.pay_item_id = '132'
-                dalash_amt = 6.0
-                provider_amt = 9.0
-                #gateway_amt = 15.0
-                gateway_amt = round(0.015 * self.context.amount_auth, 2)
-            elif self.context.p_category == 'hnd_conv_brochure':
-                self.pay_item_id = '133'
-            elif self.context.p_category == 'pgd_state_result':
-                self.pay_item_id = '134'
-            elif self.context.p_category == 'pgd_conv_brochure':
-                self.pay_item_id = '135'
-            elif self.context.p_category == 'pgd_certificate':
-                self.pay_item_id = '136'
-            elif self.context.p_category == 'log_book':
-                self.pay_item_id = '137'
-                dalash_amt = 3.0
-                provider_amt = 4.5
-                #gateway_amt = 7.5
-                gateway_amt = round(0.015 * self.context.amount_auth, 2)
-                xmldict['institution_acct'] = "1010508401"
-                xmldict['institution_bank_id'] = '117'
-            elif self.context.p_category == 'pgd_transcript_foreign':
-                self.pay_item_id = '138'
-            elif self.context.p_category == 'pgd_transcript_local':
-                self.pay_item_id = '139'
-            elif self.context.p_category == 'jamb_regularization':
-                self.pay_item_id = '140'
-                xmldict['institution_acct'] = "0838798020"
-                xmldict['institution_bank_id'] = '76'
-            else:
-                xmldict['institution_acct'] = '00000000000'
-                xmldict['institution_bank_id'] = '00'
-        else:
-            xmldict['institution_acct'] = '00000000000'
-            xmldict['institution_bank_id'] = '00'
+            if self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys():
+                self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0]
+                dalash_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1]
+                provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2]
+                xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3]
+                xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][4]
+                if self.context.amount_auth <= 2000.0:
+                    gateway_amt = round(0.015 * self.context.amount_auth, 2)
         xmldict['dalash_amt'] = 100 * dalash_amt
         xmldict['detail_ref'] = self.context.p_id
Index: /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py
===================================================================
--- /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py	(revision 11768)
+++ /main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py	(revision 11769)
@@ -628,4 +628,18 @@
             in self.browser.contents)
 
+        self.special_applicant.special_application = u'log_book'
+        self.configuration.log_book_fee = 570.5
+        self.browser.open(self.special_manage_path)
+        self.browser.getControl("Add online").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        self.browser.getLink("CollegePAY", index=0).click()
+        # The university gets 570.5 - (1.5% x 570.5) - 3 - 4.5
+        self.assertTrue(
+            '<item_detail item_id="1" item_name="Log Book Fees" '
+            'item_amt="55444" bank_id="117" acct_num="1010508401" />'
+            in self.browser.contents)
+
+
     @external_test
     def test_webservice(self):
