Changeset 12510
- Timestamp:
- 23 Jan 2015, 14:32:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/browser.py
r12478 r12510 29 29 from kofacustom.wdu.interfaces import MessageFactory as _ 30 30 31 PRODUCT_ID = ' 6207'31 PRODUCT_ID = '5214' 32 32 SITE_NAME = 'wdu.waeup.org' 33 33 PROVIDER_ACCT = '0137712635' … … 38 38 GATEWAY_AMT = 300.0 39 39 40 POST_ACTION = 'https://stageserv.interswitchng.com/test_paydirect/pay'41 #POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'40 #POST_ACTION = 'https://stageserv.interswitchng.com/test_paydirect/pay' 41 POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay' 42 42 43 #HOST = 'webpay.interswitchng.com'44 HOST = 'stageserv.interswitchng.com'43 HOST = 'webpay.interswitchng.com' 44 #HOST = 'stageserv.interswitchng.com' 45 45 HTTPS = True 46 46 47 #URL = '/paydirect/services/TransactionQueryWs.asmx'48 URL = '/test_paydirect/services/TransactionQueryWS.asmx'47 URL = '/paydirect/services/TransactionQueryWs.asmx' 48 #URL = '/test_paydirect/services/TransactionQueryWS.asmx' 49 49 50 50 httplib.HTTPSConnection.debuglevel = 0 … … 59 59 currency = CURRENCY 60 60 product_id = PRODUCT_ID 61 mac = ' CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3'61 mac = '2EC91A15F6A0821A06DEC31CC4EF509FDB548A1ABF76BD6FCF620A4D3F1F80D06C362D26CA56D86DC91ADA85CD99B97A6E845B44C730D5749E2B9B339FDC7AF8' 62 62 63 63 def update(self): 64 error = self.init_update() 65 if error: 66 self.flash(error, type='danger') 67 self.redirect(self.url(self.context, '@@index')) 68 return 64 super(CustomInterswitchPageStudent, self).update() 69 65 student = self.student 70 66 xmldict = self.xmldict … … 88 84 institution_amt_2 = 150500.0 + 1000.0 89 85 xmldict['provider_amt'] = 100 * provider_amt 90 xmldict['institution_item_name'] = self.c ategory86 xmldict['institution_item_name'] = self.context.category 91 87 xmldict['institution_name'] = INSTITUTION_NAME 92 88 xmldict['institution_amt_1'] = 100 * ( … … 94 90 xmldict['institution_amt_2'] = 100 * institution_amt_2 95 91 96 # Interswitch amount is not part of the xml data97 92 xmltext = """<payment_item_detail> 98 93 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> … … 100 95 <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" /> 101 96 <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" /> 97 </item_details> 98 </payment_item_detail>""" % xmldict 99 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 100 self.context.provider_amt = provider_amt 101 self.context.gateway_amt = GATEWAY_AMT 102 103 hashargs = ( 104 self.context.p_id + 105 PRODUCT_ID + 106 self.pay_item_id + 107 str(int(self.amount_auth)) + 108 self.site_redirect_url + 109 self.mac) 110 self.hashvalue = hashlib.sha512(hashargs).hexdigest() 111 return 112 113 114 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 115 """ View which sends a POST request to the Interswitch 116 CollegePAY payment gateway. 117 """ 118 grok.context(ICustomApplicantOnlinePayment) 119 action = POST_ACTION 120 site_name = SITE_NAME 121 currency = CURRENCY 122 pay_item_id = '103' 123 product_id = PRODUCT_ID 124 mac = '2EC91A15F6A0821A06DEC31CC4EF509FDB548A1ABF76BD6FCF620A4D3F1F80D06C362D26CA56D86DC91ADA85CD99B97A6E845B44C730D5749E2B9B339FDC7AF8' 125 126 def update(self): 127 super(CustomInterswitchPageApplicant, self).update() 128 xmldict = {} 129 provider_amt = 500.0 130 xmldict['institution_acct'] = '0029688237' 131 xmldict['institution_bank_id'] = '11' 132 xmldict['detail_ref'] = self.context.p_id 133 xmldict['provider_amt'] = 100 * provider_amt 134 xmldict['provider_acct'] = PROVIDER_ACCT 135 xmldict['provider_bank_id'] = PROVIDER_BANK_ID 136 xmldict['provider_item_name'] = PROVIDER_ITEM_NAME 137 xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT) 138 xmldict['institution_item_name'] = self.context.category 139 xmldict['institution_name'] = INSTITUTION_NAME 140 # Interswitch amount is not part of the xml data 141 xmltext = """<payment_item_detail> 142 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> 143 <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" /> 144 <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" /> 102 145 </item_details> 103 146 </payment_item_detail>""" % xmldict
Note: See TracChangeset for help on using the changeset viewer.