Index: main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/browser.py
===================================================================
--- main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/browser.py	(revision 12478)
+++ main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/browser.py	(revision 12510)
@@ -29,5 +29,5 @@
 from kofacustom.wdu.interfaces import MessageFactory as _
 
-PRODUCT_ID = '6207'
+PRODUCT_ID = '5214'
 SITE_NAME = 'wdu.waeup.org'
 PROVIDER_ACCT = '0137712635'
@@ -38,13 +38,13 @@
 GATEWAY_AMT = 300.0
 
-POST_ACTION = 'https://stageserv.interswitchng.com/test_paydirect/pay'
-#POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
+#POST_ACTION = 'https://stageserv.interswitchng.com/test_paydirect/pay'
+POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
 
-#HOST = 'webpay.interswitchng.com'
-HOST = 'stageserv.interswitchng.com'
+HOST = 'webpay.interswitchng.com'
+#HOST = 'stageserv.interswitchng.com'
 HTTPS = True
 
-#URL = '/paydirect/services/TransactionQueryWs.asmx'
-URL = '/test_paydirect/services/TransactionQueryWS.asmx'
+URL = '/paydirect/services/TransactionQueryWs.asmx'
+#URL = '/test_paydirect/services/TransactionQueryWS.asmx'
 
 httplib.HTTPSConnection.debuglevel = 0
@@ -59,12 +59,8 @@
     currency = CURRENCY
     product_id = PRODUCT_ID
-    mac = 'CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3'
+    mac = '2EC91A15F6A0821A06DEC31CC4EF509FDB548A1ABF76BD6FCF620A4D3F1F80D06C362D26CA56D86DC91ADA85CD99B97A6E845B44C730D5749E2B9B339FDC7AF8'
 
     def update(self):
-        error = self.init_update()
-        if error:
-            self.flash(error, type='danger')
-            self.redirect(self.url(self.context, '@@index'))
-            return
+        super(CustomInterswitchPageStudent, self).update()
         student = self.student
         xmldict = self.xmldict
@@ -88,5 +84,5 @@
             institution_amt_2 = 150500.0 + 1000.0
         xmldict['provider_amt'] = 100 * provider_amt
-        xmldict['institution_item_name'] = self.category
+        xmldict['institution_item_name'] = self.context.category
         xmldict['institution_name'] = INSTITUTION_NAME
         xmldict['institution_amt_1'] = 100 * (
@@ -94,5 +90,4 @@
         xmldict['institution_amt_2'] = 100 * institution_amt_2
 
-        # Interswitch amount is not part of the xml data
         xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
@@ -100,4 +95,52 @@
 <item_detail item_id="2" item_name="other charges and tech fee" item_amt="%(institution_amt_2)d" bank_id="%(institution_bank_id_2)s" acct_num="%(institution_acct_2)s" />
 <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
+</item_details>
+</payment_item_detail>""" % xmldict
+        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
+        self.context.provider_amt = provider_amt
+        self.context.gateway_amt = GATEWAY_AMT
+
+        hashargs = (
+            self.context.p_id +
+            PRODUCT_ID +
+            self.pay_item_id +
+            str(int(self.amount_auth)) +
+            self.site_redirect_url +
+            self.mac)
+        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
+        return
+
+
+class CustomInterswitchPageApplicant(InterswitchPageApplicant):
+    """ View which sends a POST request to the Interswitch
+    CollegePAY payment gateway.
+    """
+    grok.context(ICustomApplicantOnlinePayment)
+    action = POST_ACTION
+    site_name = SITE_NAME
+    currency = CURRENCY
+    pay_item_id = '103'
+    product_id = PRODUCT_ID
+    mac = '2EC91A15F6A0821A06DEC31CC4EF509FDB548A1ABF76BD6FCF620A4D3F1F80D06C362D26CA56D86DC91ADA85CD99B97A6E845B44C730D5749E2B9B339FDC7AF8'
+
+    def update(self):
+        super(CustomInterswitchPageApplicant, self).update()
+        xmldict = {}
+        provider_amt = 500.0
+        xmldict['institution_acct'] = '0029688237'
+        xmldict['institution_bank_id'] = '11'
+        xmldict['detail_ref'] = self.context.p_id
+        xmldict['provider_amt'] = 100 * provider_amt
+        xmldict['provider_acct'] = PROVIDER_ACCT
+        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
+        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
+        xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)
+        xmldict['institution_item_name'] = self.context.category
+        xmldict['institution_name'] = INSTITUTION_NAME
+        # Interswitch amount is not part of the xml data
+        xmltext = """<payment_item_detail>
+<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
+<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
+<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
 </item_details>
 </payment_item_detail>""" % xmldict
