Changeset 9392


Ignore:
Timestamp:
23 Oct 2012, 08:24:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Configure Interswitch module with hash value in form.

Location:
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py

    r9387 r9392  
    1919import httplib
    2020import urllib
     21import hashlib
    2122from xml.dom.minidom import parseString
    2223import grok
     
    4243#QUERY_URL = 'https://webpay.interswitchng.com/paydirect/services/TransactionQueryURL.aspx'
    4344#QUERY_URL = 'https://testwebpay.interswitchng.com/test_paydirect/services/TransactionQueryURL.aspx'
     45
    4446#POST_ACTION = 'https://webpay.interswitchng.com/paydirect/webpay/pay.aspx'
    4547POST_ACTION = 'https://testwebpay.interswitchng.com/test_paydirect/webpay/pay.aspx'
     
    4749#HOST = 'webpay.interswitchng.com'
    4850HOST = 'testwebpay.interswitchng.com'
     51
    4952#URL = '/paydirect/services/TransactionQueryWs.asmx'
    5053URL = '/test_paydirect/services/TransactionQueryWs.asmx'
     
    180183    pay_item_id = '101'
    181184    product_id = PRODUCT_ID
     185    mac = '737396C271FB8E2BA1A612A942267553E16373658A5F83D90DAFFBB806C16E9E6284006C06CEFFB55768004179D7BC01CD237CCE6314B938A5A5D9F49369DE5A'
    182186
    183187    def update(self):
     
    235239        xmldict['institution_item_name'] = self.context.p_category
    236240        xmldict['institution_name'] = INSTITUTION_NAME
     241
     242        hashargs = (
     243            self.context.p_id +
     244            PRODUCT_ID +
     245            self.pay_item_id +
     246            str(int(self.amount_auth)) +
     247            self.site_redirect_url +
     248            self.mac)
     249        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
     250
    237251        # Interswitch amount is not part of the xml data
    238252        xmltext = """<payment_item_detail>
     
    259273    site_name = SITE_NAME
    260274    currency = CURRENCY
    261     pay_item_id = '8303'
     275    pay_item_id = ''
    262276    product_id = PRODUCT_ID
    263277
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser_templates/student_goto_interswitch.pt

    r8441 r9392  
    5959  <input type="hidden" name="currency" tal:attributes="value view/currency" />
    6060  <input type="hidden" name="pay_item_id" tal:attributes="value view/pay_item_id" />
     61  <input type="hidden" name="hash" tal:attributes="value view/hashvalue" />
    6162  <input type="hidden" name="site_redirect_url" tal:attributes="value view/site_redirect_url" />
    6263  <input type="hidden" name="site_name" tal:attributes="value view/site_name" />
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r9387 r9392  
    6969        self.student['studycourse'].current_verdict = 'A'
    7070        self.student['studycourse'].current_level = 100
     71        # Set local lga
     72        self.student.lga = u'kwara_asa'
    7173        # Update the catalog
    7274        notify(grok.ObjectModifiedEvent(self.student))
     
    101103                           self.browser.contents)
    102104        self.assertMatches(
    103             '...<span>60980.0</span>...',
     105            '...<span>37100.0</span>...',
    104106            self.browser.contents)
    105107        self.payment_url = self.browser.url
     
    110112                           self.browser.contents)
    111113        self.assertMatches(
    112             '...<input type="hidden" name="amount" value="6098000.0" />...',
    113             self.browser.contents)
    114         self.assertMatches(
    115             '...item_name="schoolfee" item_amt="5768000" bank_id="120" acct_num="1771180233"...',
     114            '...<input type="hidden" name="amount" value="3710000.0" />...',
     115            self.browser.contents)
     116        self.assertMatches(
     117            '...item_name="schoolfee" item_amt="3380000" bank_id="120" acct_num="1771180233"...',
    116118            self.browser.contents)
    117119        self.assertMatches(
Note: See TracChangeset for help on using the changeset viewer.