Changeset 13532
- Timestamp:
- 3 Dec 2015, 17:37:00 (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
r13527 r13532 45 45 HTTPS = True 46 46 47 URL = '/paydirect/services/TransactionQueryWs.asmx'48 47 httplib.HTTPSConnection.debuglevel = 0 49 48 … … 54 53 return 0.0 55 54 56 def contr_agreement(student): 55 def contr_agreement_applicant(applicant): 56 if applicant.__parent__.code[:2] in ('fp', 'pt'): 57 return 'first' 58 return 'second' 59 60 def contr_agreement_student(student): 57 61 if student.current_mode == 'found' or student.current_mode.endswith('_pt'): 58 62 return 'first' … … 69 73 site_name = SITE_NAME 70 74 currency = CURRENCY 71 pay_item_id = '101'72 product_id = PRODUCT_ID_PT73 75 mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' 74 76 … … 80 82 self.redirect(self.url(self.context, '@@index')) 81 83 return 84 if contr_agreement_applicant(self.context.__parent__) == 'first': 85 self.product_id = PRODUCT_ID_PT 86 self.pay_item_id = '101' 87 else: 88 self.product_id = PRODUCT_ID_REGULAR 89 self.pay_item_id = '109' 82 90 xmldict = {} 83 91 provider_amt = 1000.0 … … 91 99 xmldict['institution_amt'] = 100 * ( 92 100 self.context.amount_auth - provider_amt - GATEWAY_AMT) 93 xmldict['institution_item_name'] = self.c ontext.p_category101 xmldict['institution_item_name'] = self.category 94 102 xmldict['institution_name'] = INSTITUTION_NAME 95 103 # Interswitch amount is not part of the xml data … … 106 114 hashargs = ( 107 115 self.context.p_id + 108 PRODUCT_ID_PT+116 self.product_id + 109 117 self.pay_item_id + 110 118 str(int(self.amount_auth)) + … … 123 131 site_name = SITE_NAME 124 132 currency = CURRENCY 125 pay_item_id = '101'133 #pay_item_id = '101' 126 134 #mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' 127 135 mac = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023' … … 148 156 self.redirect(self.url(self.context, '@@index')) 149 157 return 150 if contr_agreement (student) == 'first':158 if contr_agreement_student(student) == 'first': 151 159 self.product_id = PRODUCT_ID_PT 152 160 else: … … 187 195 # Schoolfee 188 196 if self.context.p_category.startswith('schoolfee'): 189 if contr_agreement (student) == 'first':197 if contr_agreement_student(student) == 'first': 190 198 # First agreement 191 199 provider_amt = 1900.0 … … 262 270 # Clearance 263 271 elif self.context.p_category.startswith('clearance'): 264 if contr_agreement (student) == 'first':272 if contr_agreement_student(student) == 'first': 265 273 # First agreement 266 274 if student.current_mode == 'found': … … 408 416 """ 409 417 grok.context(ICustomApplicantOnlinePayment) 410 product_id = PRODUCT_ID_PT411 418 gateway_host = HOST 412 gateway_url = URL419 gateway_url = '/paydirect/api/v1/gettransaction.json' 413 420 https = HTTPS 421 mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' 422 423 @property 424 def product_id(self): 425 if contr_agreement_applicant(self.context.__parent__) == 'first': 426 return PRODUCT_ID_PT 427 return PRODUCT_ID_REGULAR 414 428 415 429 class CustomInterswitchPaymentRequestWebservicePageStudent( … … 425 439 @property 426 440 def product_id(self): 427 if contr_agreement (self.context.student) == 'first':441 if contr_agreement_student(self.context.student) == 'first': 428 442 return PRODUCT_ID_PT 429 443 return PRODUCT_ID_REGULAR -
main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
r13530 r13532 59 59 super(InterswitchTestsApplicants, self).fill_correct_values() 60 60 self.browser.getControl(name="form.programme_type").value = ['regular'] 61 self.applicantscontainer.application_fee = 1000 .061 self.applicantscontainer.application_fee = 10000.0 62 62 self.browser.getControl(name="form.nationality").value = ['NG'] 63 63 self.browser.getControl(name="transition").value = ['start'] 64 64 self.browser.getControl("Save").click() 65 66 def test_interswitch_form_regular(self): 65 67 self.browser.getControl("Add online").click() 66 68 self.assertTrue('ticket created' in self.browser.contents) 67 69 #self.browser.getLink(value).click() 68 70 self.assertTrue('Amount Authorized' in self.browser.contents) 69 self.assertTrue('<span>1000.0</span>' in self.browser.contents) 70 self.payment_url = self.browser.url 71 72 def test_interswitch_form(self): 73 # Manager can access InterswitchForm 74 self.browser.getLink("CollegePAY", index=0).click() 75 self.assertTrue('Total Amount Authorized:' in self.browser.contents) 76 self.assertTrue( 77 '<input type="hidden" name="amount" value="100000" />' 71 self.assertTrue('<span>10000.0</span>' in self.browser.contents) 72 self.payment_url = self.browser.url 73 # Manager can access InterswitchForm 74 self.browser.getLink("CollegePAY", index=0).click() 75 self.assertTrue('Total Amount Authorized:' in self.browser.contents) 76 self.assertTrue( 77 '<input type="hidden" name="amount" value="1000000" />' 78 in self.browser.contents) 79 self.assertTrue( 80 'item_name="BT Education" item_amt="100000"' 81 in self.browser.contents) 82 self.assertTrue( 83 'item_name="Application Fee" item_amt="875000" bank_id="117" acct_num="1010835352"' 84 in self.browser.contents) 85 self.assertTrue( 86 '<input type="hidden" name="product_id" value="5845" />' 78 87 in self.browser.contents) 79 88 delta = timedelta(days=8)
Note: See TracChangeset for help on using the changeset viewer.