Changeset 15756 for main/kofacustom.skeleton
- Timestamp:
- 6 Nov 2019, 07:25:16 (5 years ago)
- Location:
- main/kofacustom.skeleton/trunk/src/kofacustom/skeleton
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/etranzact/browser.py
r15615 r15756 23 23 EtranzactPageStudent, EtranzactReceiveResponseStudent, 24 24 EtranzactRequestPaymentStatusPageStudent) 25 from kofacustom.nigeria.etranzact.payoutletbrowser import ( 26 EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant, 27 EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant) 28 from kofacustom.nigeria.etranzact.payoutletwebservice import NigeriaPaymentDataWebservice 25 29 26 30 # Temporarily we can use the test portal like in kofacustom.nigeria 27 31 28 32 from kofacustom.nigeria.etranzact.tests import ( 29 HOST, HTTPS, SECRET_KEY, TERMINAL_ID )33 HOST, HTTPS, SECRET_KEY, TERMINAL_ID, GATEWAY_AMT) 30 34 31 35 #HOST = … … 33 37 #SECRET_KEY = 34 38 #TERMINAL_ID = 39 #GATEWAY_AMT = 35 40 LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png' 36 41 … … 42 47 terminal_id = TERMINAL_ID 43 48 logo_url = LOGO_URL 49 gateway_amt = GATEWAY_AMT 50 51 def update(self): 52 # Already now it becomes an Etranzact payment. We set the net amount 53 # and add the gateway amount. 54 if not self.context.r_company: 55 self.context.net_amt = self.context.amount_auth 56 self.context.amount_auth += self.gateway_amt 57 self.context.gateway_amt = self.gateway_amt 58 self.context.r_company = u'etranzact' 59 self.amount = "%.1f" % self.context.amount_auth 60 error = self.init_update() 61 if error: 62 self.flash(error, type='danger') 63 self.redirect(self.url(self.context, '@@index')) 64 return 65 return 44 66 45 67 class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant): … … 64 86 terminal_id = TERMINAL_ID 65 87 logo_url = LOGO_URL 88 gateway_amt = GATEWAY_AMT 89 90 def update(self): 91 # Already now it becomes an Etranzact payment. We set the net amount 92 # and add the gateway amount. 93 if not self.context.r_company: 94 self.context.net_amt = self.context.amount_auth 95 self.context.amount_auth += self.gateway_amt 96 self.context.gateway_amt = self.gateway_amt 97 self.context.r_company = u'etranzact' 98 self.amount = "%.1f" % self.context.amount_auth 99 error = self.init_update() 100 if error: 101 self.flash(error, type='danger') 102 self.redirect(self.url(self.context, '@@index')) 103 return 104 return 66 105 67 106 class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent): … … 79 118 logo_url = LOGO_URL 80 119 120 # Payoutlet customizations 81 121 122 class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent): 123 """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent` 124 """ 125 gateway_amt = GATEWAY_AMT 82 126 127 class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant): 128 """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant` 129 """ 130 gateway_amt = GATEWAY_AMT 131 132 class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent): 133 """ Query history of Etranzact payments 134 """ 135 terminal_id = TERMINAL_ID 136 host = HOST 137 https = HTTPS 138 139 class CustomEtranzactQueryHistoryPageApplicant(EtranzactQueryHistoryPageApplicant): 140 """ Query history of Etranzact payments 141 """ 142 terminal_id = TERMINAL_ID 143 host = HOST 144 https = HTTPS 145 146 class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice): 147 """A simple webservice to publish payment and payer details on request from 148 accepted IP addresses without authentication. 149 """ 150 #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184') 151 ACCEPTED_IP = None 152 153 CATEGORY_MAPPING = { 154 'SCHOOLFEE': ('schoolfee',), 155 } 156 -
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...', -
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/remita/browser.py
r15614 r15756 91 91 return 92 92 self.orderId = self.context.p_id 93 self.amount = str(self.context.amount_auth)94 93 error = self.init_update() 95 94 if error: … … 97 96 self.redirect(self.url(self.context, '@@index')) 98 97 return 98 # Already now it becomes a Remita payment. We set the net amount 99 # and add the gateway amount. 100 if not self.context.r_company: 101 self.context.net_amt = self.context.amount_auth 102 self.context.amount_auth += self.gateway_amt 103 self.context.gateway_amt = self.gateway_amt 104 self.context.r_company = u'remita' 105 self.amount_auth = int(100 * self.context.amount_auth) 99 106 return 100 107 … … 150 157 return 151 158 self.orderId = self.context.p_id 152 self.amount = str(self.context.amount_auth)153 159 error = self.init_update() 154 160 if error: … … 156 162 self.redirect(self.url(self.context, '@@index')) 157 163 return 164 # Already now it becomes a Remita payment. We set the net amount 165 # and add the gateway amount. 166 if not self.context.r_company: 167 self.context.net_amt = self.context.amount_auth 168 self.context.amount_auth += self.gateway_amt 169 self.context.gateway_amt = self.gateway_amt 170 self.context.r_company = u'remita' 171 self.amount_auth = int(100 * self.context.amount_auth) 158 172 return -
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/students/tests/test_export.py
r15673 r15756 103 103 result = open(self.outfile, 'rb').read() 104 104 self.assertMatches( 105 'ac,amount_auth,creation_date,gateway_amt,p_category,p_combi,p_current,' 105 'ac,amount_auth,creation_date,gateway_amt,net_amt,' 106 'p_category,p_combi,p_current,' 106 107 'p_id,p_item,p_level,p_session,p_state,payment_date,provider_amt,' 107 108 'r_amount_approved,r_card_num,r_code,r_company,r_desc,' 108 109 'r_pay_reference,thirdparty_amt,student_id,state,' 109 110 'current_session\r\n' 110 '666,12.12,%s-04-01 13:12:01#,, schoolfee,[],1,my-id,p-item,'111 '666,12.12,%s-04-01 13:12:01#,,,schoolfee,[],1,my-id,p-item,' 111 112 '100,%s,paid,%s-04-01 14:12:01#,,12.12,' 112 113 '789,r-code,interswatch,,,,A111111,created,2012\r\n'
Note: See TracChangeset for help on using the changeset viewer.