Changeset 13379 for main/waeup.aaue/trunk/src/waeup/aaue/interswitch
- Timestamp:
- 2 Nov 2015, 09:07:39 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py
r13378 r13379 31 31 from waeup.aaue.interfaces import MessageFactory as _ 32 32 33 PRODUCT_ID = '5040' 33 PRODUCT_ID_PT = '5040' 34 PRODUCT_ID_REGULAR = '5845' 34 35 SITE_NAME = 'aaue.waeup.org' 35 36 PROVIDER_ACCT = '1010764827' … … 47 48 httplib.HTTPSConnection.debuglevel = 0 48 49 50 51 def school(student): 52 if student.current_mode == 'found' or student.current_mode.endswith('_pt'): 53 return 'pt' 54 return 'regular' 55 49 56 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 50 57 """ View which sends a POST request to the Interswitch 51 58 CollegePAY payment gateway. 59 60 So far only PT application has been configured. 52 61 """ 53 62 grok.context(ICustomApplicantOnlinePayment) … … 56 65 currency = CURRENCY 57 66 pay_item_id = '101' 58 product_id = PRODUCT_ID 67 product_id = PRODUCT_ID_PT 59 68 mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' 60 69 … … 91 100 hashargs = ( 92 101 self.context.p_id + 93 PRODUCT_ID +102 PRODUCT_ID_PT + 94 103 self.pay_item_id + 95 104 str(int(self.amount_auth)) + … … 108 117 site_name = SITE_NAME 109 118 currency = CURRENCY 110 product_id = PRODUCT_ID111 119 pay_item_id = '101' 112 120 mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' … … 156 164 xmldict['institution_name'] = INSTITUTION_NAME 157 165 158 if self.context.p_category == 'schoolfee': 159 xmldict['institution_bank_id'] = '7' 160 xmldict['institution_acct'] = '1014847058' 161 if student.current_mode == 'found': 162 self.pay_item_id = '103' 163 else: 164 self.pay_item_id = '105' 165 provider_amt = 1900.0 166 joint_venture_amt = 1100.0 167 aaue_share_amt = 1000.0 168 student_union_due_amt = 1000.0 169 student_welfare_assurance_amt = 500.0 170 xmldict['provider_amt'] = 100 * provider_amt 171 xmldict['joint_venture_amt'] = 100 * joint_venture_amt 172 xmldict['aaue_share_amt'] = 100 * aaue_share_amt 173 xmldict['student_union_due_amt'] = 100 * student_union_due_amt 174 xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt 175 xmldict['institution_amt'] = 100 * ( 176 self.context.amount_auth 177 - provider_amt 178 - joint_venture_amt 179 - aaue_share_amt 180 - student_union_due_amt 181 - student_welfare_assurance_amt 182 - GATEWAY_AMT) 183 xmltext = """<payment_item_detail> 166 # PT 167 168 if school(student) == 'pt': 169 product_id = PRODUCT_ID_PT 170 if self.context.p_category == 'schoolfee': 171 xmldict['institution_bank_id'] = '7' 172 xmldict['institution_acct'] = '1014847058' 173 if student.current_mode == 'found': 174 self.pay_item_id = '103' 175 else: 176 self.pay_item_id = '105' 177 provider_amt = 1900.0 178 joint_venture_amt = 1100.0 179 aaue_share_amt = 1000.0 180 student_union_due_amt = 1000.0 181 student_welfare_assurance_amt = 500.0 182 xmldict['provider_amt'] = 100 * provider_amt 183 xmldict['joint_venture_amt'] = 100 * joint_venture_amt 184 xmldict['aaue_share_amt'] = 100 * aaue_share_amt 185 xmldict['student_union_due_amt'] = 100 * student_union_due_amt 186 xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt 187 xmldict['institution_amt'] = 100 * ( 188 self.context.amount_auth 189 - provider_amt 190 - joint_venture_amt 191 - aaue_share_amt 192 - student_union_due_amt 193 - student_welfare_assurance_amt 194 - GATEWAY_AMT) 195 xmltext = """<payment_item_detail> 184 196 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 185 197 <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" /> … … 191 203 </item_details> 192 204 </payment_item_detail>""" % xmldict 193 elif self.context.p_category == 'clearance':194 if student.current_mode == 'found':195 self.pay_item_id = '102'196 else:197 self.pay_item_id = '104'198 xmldict['institution_acct'] = '1014066976'199 xmldict['institution_bank_id'] = '117'200 provider_amt = 0.0201 gown_fee_amt = 2000.0202 aaue_fl_fee_amt = 800.0203 xmldict['gown_fee_amt'] = 100 * gown_fee_amt204 xmldict['aaue_fl_fee_amt'] = 100 * aaue_fl_fee_amt205 xmldict['institution_amt'] = 100 * (206 self.context.amount_auth207 - gown_fee_amt208 - aaue_fl_fee_amt209 - GATEWAY_AMT)210 xmltext = """<payment_item_detail>205 elif self.context.p_category == 'clearance': 206 if student.current_mode == 'found': 207 self.pay_item_id = '102' 208 else: 209 self.pay_item_id = '104' 210 xmldict['institution_acct'] = '1014066976' 211 xmldict['institution_bank_id'] = '117' 212 provider_amt = 0.0 213 gown_fee_amt = 2000.0 214 aaue_fl_fee_amt = 800.0 215 xmldict['gown_fee_amt'] = 100 * gown_fee_amt 216 xmldict['aaue_fl_fee_amt'] = 100 * aaue_fl_fee_amt 217 xmldict['institution_amt'] = 100 * ( 218 self.context.amount_auth 219 - gown_fee_amt 220 - aaue_fl_fee_amt 221 - GATEWAY_AMT) 222 xmltext = """<payment_item_detail> 211 223 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 212 224 <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" /> … … 216 228 </payment_item_detail>""" % xmldict 217 229 230 # REGULAR 231 232 else: 233 pass 234 218 235 219 236 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext … … 222 239 hashargs = ( 223 240 self.context.p_id + 224 PRODUCT_ID+241 product_id + 225 242 self.pay_item_id + 226 243 str(int(self.amount_auth)) + … … 234 251 InterswitchPaymentRequestWebservicePageApplicant): 235 252 """ Request webservice view for the CollegePAY gateway 253 254 So far only PT application has been configured. 236 255 """ 237 256 grok.context(ICustomApplicantOnlinePayment) 238 product_id = PRODUCT_ID 257 product_id = PRODUCT_ID_PT 239 258 gateway_host = HOST 240 259 gateway_url = URL … … 246 265 """ 247 266 grok.context(ICustomStudentOnlinePayment) 248 product_id = PRODUCT_ID249 267 gateway_host = HOST 250 268 gateway_url = URL 251 269 https = HTTPS 270 271 @property 272 def product_id(self): 273 if school(self.context.student) == 'pt': 274 return PRODUCT_ID_PT 275 return PRODUCT_ID_REGULAR -
main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
r13378 r13379 188 188 189 189 def test_interswitch_form_ticket_expired(self): 190 self.certificate.study_mode = 'ug_pt' 190 191 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 191 192 acc_payment = createObject('waeup.StudentOnlinePayment') … … 202 203 self.assertMatches('...Total Amount Authorized:...', 203 204 self.browser.contents) 204 self.assertEqual(self.student.current_mode, 'ug_ ft')205 self.assertEqual(self.student.current_mode, 'ug_pt') 205 206 self.assertMatches( 206 207 '...<input type="hidden" name="amount" value="87600" />...',
Note: See TracChangeset for help on using the changeset viewer.