- Timestamp:
- 7 Nov 2019, 17:45:43 (5 years ago)
- Location:
- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py
r15728 r15773 61 61 product_id = PRODUCT_ID 62 62 mac = MAC 63 gateway_amt = GATEWAY_AMT 63 64 64 65 def update(self): … … 68 69 self.redirect(self.url(self.context, '@@index')) 69 70 return 71 # Already now it becomes an Interswitch payment. We set the net amount 72 # and add the gateway amount. 73 if not self.context.r_company: 74 self.context.net_amt = self.context.amount_auth 75 self.context.amount_auth += self.gateway_amt 76 self.context.gateway_amt = self.gateway_amt 77 self.context.r_company = u'interswitch' 70 78 student = self.student 71 79 xmldict = self.xmldict … … 75 83 xmldict['provider_bank_id'] = PROVIDER_BANK_ID 76 84 xmldict['provider_item_name'] = PROVIDER_ITEM_NAME 77 provider_amt = 0.078 85 xmldict['institution_acct'] = '' 79 86 xmldict['institution_bank_id'] = '' 80 provider_amt = 5000.087 provider_amt = 0.0 81 88 self.pay_item_id = '' 82 89 # Institution data … … 103 110 xmldict['institution_item_name'] = self.context.category 104 111 xmldict['institution_name'] = INSTITUTION_NAME 105 xmldict['institution_amt'] = 100 * ( 106 self.context.amount_auth - provider_amt - GATEWAY_AMT) 107 # Interswitch amount is not part of the xml data 112 xmldict['institution_amt'] = 100 * self.context.net_amt 113 if not self.context.provider_amt: 114 self.context.provider_amt = provider_amt 115 self.context.amount_auth += provider_amt 108 116 if provider_amt == 0: 109 117 xmltext = """<payment_item_detail> … … 120 128 </payment_item_detail>""" % xmldict 121 129 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 122 self.context.provider_amt = provider_amt 123 self.context.gateway_amt = GATEWAY_AMT 124 130 self.amount_auth = int(100 * self.context.amount_auth) 125 131 hashargs = ( 126 132 self.context.p_id + … … 144 150 product_id = PRODUCT_ID 145 151 mac = MAC 152 gateway_amt = GATEWAY_AMT 146 153 147 154 def update(self): … … 151 158 self.redirect(self.url(self.context, '@@index')) 152 159 return 160 # Already now it becomes an Interswitch payment. We set the net amount 161 # and add the gateway amount. 162 if not self.context.r_company: 163 self.context.net_amt = self.context.amount_auth 164 self.context.amount_auth += self.gateway_amt 165 self.context.gateway_amt = self.gateway_amt 166 self.context.r_company = u'interswitch' 167 self.amount_auth = int(100 * self.context.amount_auth) 153 168 xmldict = {} 154 provider_amt = 400.0169 provider_amt = 0.0 155 170 xmldict['institution_acct'] = '0040484781' 156 171 xmldict['institution_bank_id'] = '31' … … 160 175 xmldict['provider_bank_id'] = PROVIDER_BANK_ID 161 176 xmldict['provider_item_name'] = PROVIDER_ITEM_NAME 162 xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)163 177 xmldict['institution_item_name'] = self.context.category 164 178 xmldict['institution_name'] = INSTITUTION_NAME 165 # Interswitch amount is not part of the xml data 179 xmldict['institution_amt'] = 100 * self.context.net_amt 180 if not self.context.provider_amt: 181 self.context.provider_amt = provider_amt 182 self.context.amount_auth += provider_amt 166 183 xmltext = """<payment_item_detail> 167 184 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> … … 171 188 </payment_item_detail>""" % xmldict 172 189 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 173 self.context.provider_amt = provider_amt 174 self.context.gateway_amt = GATEWAY_AMT 175 190 self.amount_auth = int(100 * self.context.amount_auth) 176 191 hashargs = ( 177 192 self.context.p_id + -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/tests.py
r15728 r15773 75 75 self.browser.contents) 76 76 self.assertEqual(self.student.current_mode, 'ug_ft') 77 self.assertTrue( 78 '<input type="hidden" name="amount" value="4000000" />' in 79 self.browser.contents) 80 self.assertTrue( 81 'item_name="Tuition Plus (total amount)" item_amt="3475000" bank_id="117" acct_num="1011005811"' in 77 # 250 gateway charge have been added 78 payment = self.student['payments'][self.value] 79 self.assertEqual(payment.amount_auth, 40250) 80 self.assertEqual(payment.net_amt, 40000) 81 self.assertTrue( 82 '<input type="hidden" name="amount" value="4025000" />' in 83 self.browser.contents) 84 self.assertTrue( 85 'item_name="Tuition Plus (total amount)" item_amt="4000000" bank_id="117" acct_num="1011005811"' in 82 86 self.browser.contents) 83 87 … … 86 90 acc_payment = createObject('waeup.StudentOnlinePayment') 87 91 acc_payment.p_state = 'unpaid' 88 acc_payment.p_category = ' clearance'92 acc_payment.p_category = 'registration' 89 93 acc_payment.p_id = 'xyz' 90 94 acc_payment.pay_item_id = '123' 91 acc_payment.amount_auth = 876.095 acc_payment.amount_auth = 1000.0 92 96 self.student['payments']['xyz'] = acc_payment 93 97 self.browser.open(self.payments_path + '/xyz') 94 98 self.browser.getLink("Pay via Interswitch", index=0).click() 95 self.assert Matches('...<input type="hidden" name="pay_item_id" value="102" />...',99 self.assertTrue('<input type="hidden" name="pay_item_id" value="102" />' in 96 100 self.browser.contents) 97 101 self.assertMatches('...Total Amount Authorized:...', 98 102 self.browser.contents) 99 103 self.assertEqual(self.student.current_mode, 'ug_ft') 100 self.assertMatches( 101 '...<input type="hidden" name="amount" value="87600" />...', 102 self.browser.contents) 104 # 5000 provider charge and 250 gateway charge have been added 105 self.assertTrue( 106 '<input type="hidden" name="amount" value="625000" />' in 107 self.browser.contents) 108 self.assertEqual(acc_payment.amount_auth, 6250) 109 self.assertEqual(acc_payment.net_amt, 1000) 103 110 delta = timedelta(days=8) 104 111 acc_payment.creation_date -= delta
Note: See TracChangeset for help on using the changeset viewer.