- Timestamp:
- 6 Nov 2019, 07:25:16 (5 years ago)
- Location:
- main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/browser.py
r15614 r15756 59 59 currency = CURRENCY 60 60 product_id = PRODUCT_ID 61 mac = MAC 61 mac = MAC 62 gateway_amt = GATEWAY_AMT 62 63 63 64 def update(self): … … 67 68 self.redirect(self.url(self.context, '@@index')) 68 69 return 70 # Already now it becomes an Interswitch payment. We set the net amount 71 # and add the gateway amount. 72 if not self.context.r_company: 73 self.context.net_amt = self.context.amount_auth 74 self.context.amount_auth += self.gateway_amt 75 self.context.gateway_amt = self.gateway_amt 76 self.context.r_company = u'interswitch' 69 77 student = self.student 70 78 xmldict = self.xmldict … … 77 85 xmldict['institution_acct'] = '00000000' 78 86 xmldict['institution_bank_id'] = '00' 79 xmldict['institution_amt'] = '0.0'80 87 provider_amt = 0.0 81 88 self.pay_item_id = '0000' # must be provided by Interswitch … … 83 90 xmldict['institution_item_name'] = self.context.category 84 91 xmldict['institution_name'] = INSTITUTION_NAME 85 xmldict['institution_amt'] = 100 * ( 86 self.context.amount_auth - provider_amt - GATEWAY_AMT) 87 # Interswitch amount is not part of the xml data 92 xmldict['institution_amt'] = 100 * self.context.net_amt 93 if not self.context.provider_amt: 94 self.context.provider_amt = provider_amt 95 self.context.amount_auth += provider_amt 88 96 if provider_amt == 0: 89 97 xmltext = """<payment_item_detail> … … 101 109 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 102 110 self.context.provider_amt = provider_amt 103 self.context.gateway_amt = GATEWAY_AMT 104 111 self.amount_auth = int(100 * self.context.amount_auth) 105 112 hashargs = ( 106 113 self.context.p_id + … … 124 131 product_id = PRODUCT_ID 125 132 mac = MAC 133 gateway_amt = GATEWAY_AMT 126 134 127 135 def update(self): … … 131 139 self.redirect(self.url(self.context, '@@index')) 132 140 return 141 # Already now it becomes an Interswitch payment. We set the net amount 142 # and add the gateway amount. 143 if not self.context.r_company: 144 self.context.net_amt = self.context.amount_auth 145 self.context.amount_auth += self.gateway_amt 146 self.context.gateway_amt = self.gateway_amt 147 self.context.r_company = u'interswitch' 133 148 xmldict = {} 134 149 provider_amt = 400.0 … … 140 155 xmldict['provider_bank_id'] = PROVIDER_BANK_ID 141 156 xmldict['provider_item_name'] = PROVIDER_ITEM_NAME 142 xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)143 157 xmldict['institution_item_name'] = self.context.category 144 158 xmldict['institution_name'] = INSTITUTION_NAME 145 # Interswitch amount is not part of the xml data 159 xmldict['institution_amt'] = 100 * self.context.net_amt 160 if not self.context.provider_amt: 161 self.context.provider_amt = provider_amt 162 self.context.amount_auth += provider_amt 146 163 xmltext = """<payment_item_detail> 147 164 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> … … 151 168 </payment_item_detail>""" % xmldict 152 169 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 153 self.context.provider_amt = provider_amt 154 self.context.gateway_amt = GATEWAY_AMT 155 170 self.amount_auth = int(100 * self.context.amount_auth) 156 171 hashargs = ( 157 172 self.context.p_id + -
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/tests.py
r15614 r15756 70 70 '<span>40000.0</span>' in self.browser.contents) 71 71 self.payment_url = self.browser.url 72 self.browser.getLink(" CollegePAY", index=0).click()72 self.browser.getLink("Pay via Interswitch", index=0).click() 73 73 self.assertTrue('<input type="hidden" name="pay_item_id" value="0000" />' in 74 74 self.browser.contents) 75 75 self.assertEqual(self.student.current_mode, 'ug_ft') 76 76 self.assertTrue( 77 '<input type="hidden" name="amount" value="40 00000" />' in78 self.browser.contents) 79 self.assertTrue( 80 'item_name="School Fee" item_amt=" 3985000" bank_id="00" acct_num="00000000"' in77 '<input type="hidden" name="amount" value="4015000" />' in 78 self.browser.contents) 79 self.assertTrue( 80 'item_name="School Fee" item_amt="4000000" bank_id="00" acct_num="00000000"' in 81 81 self.browser.contents) 82 82 … … 88 88 acc_payment.p_id = 'xyz' 89 89 acc_payment.pay_item_id = '123' 90 acc_payment.amount_auth = 876.090 acc_payment.amount_auth = 1000.0 91 91 self.student['payments']['xyz'] = acc_payment 92 92 self.browser.open(self.payments_path + '/xyz') 93 self.browser.getLink(" CollegePAY", index=0).click()93 self.browser.getLink("Pay via Interswitch", index=0).click() 94 94 self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...', 95 95 self.browser.contents) … … 98 98 self.assertEqual(self.student.current_mode, 'ug_ft') 99 99 self.assertMatches( 100 '...<input type="hidden" name="amount" value=" 87600" />...',100 '...<input type="hidden" name="amount" value="115000" />...', 101 101 self.browser.contents) 102 102 delta = timedelta(days=8) 103 103 acc_payment.creation_date -= delta 104 104 self.browser.open(self.payments_path + '/xyz') 105 self.browser.getLink(" CollegePAY", index=0).click()105 self.browser.getLink("Pay via Interswitch", index=0).click() 106 106 self.assertMatches( 107 107 '...This payment ticket is too old. Please create a new ticket...', … … 110 110 acc_payment.creation_date += delta 111 111 self.browser.open(self.payments_path + '/xyz') 112 self.browser.getLink(" CollegePAY", index=0).click()112 self.browser.getLink("Pay via Interswitch", index=0).click() 113 113 self.assertMatches('...Total Amount Authorized:...', 114 114 self.browser.contents) … … 229 229 def test_interswitch_form(self): 230 230 # Manager can access InterswitchForm 231 self.browser.getLink(" CollegePAY", index=0).click()231 self.browser.getLink("Pay via Interswitch", index=0).click() 232 232 self.assertMatches('...Total Amount Authorized:...', 233 233 self.browser.contents) … … 238 238 self.applicant.values()[0].creation_date -= delta 239 239 self.browser.open(self.payment_url) 240 self.browser.getLink(" CollegePAY", index=0).click()240 self.browser.getLink("Pay via Interswitch", index=0).click() 241 241 self.assertMatches( 242 242 '...This payment ticket is too old. Please create a new ticket...',
Note: See TracChangeset for help on using the changeset viewer.