- Timestamp:
- 7 Nov 2019, 17:45:43 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py
r15733 r15773 22 22 from kofacustom.nigeria.etranzact.studentsbrowser import ( 23 23 EtranzactPageStudent, EtranzactReceiveResponseStudent, 24 EtranzactRequestPaymentStatusPageStudent )24 EtranzactRequestPaymentStatusPageStudent, webconnect_module_activated) 25 25 from kofacustom.nigeria.etranzact.payoutletbrowser import ( 26 EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant) 26 EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant, 27 EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant, 28 payoutlet_module_activated) 29 from kofacustom.nigeria.etranzact.payoutletwebservice import NigeriaPaymentDataWebservice 27 30 28 31 # Temporarily we can use the test portal like in kofacustom.nigeria … … 35 38 #SECRET_KEY = 36 39 #TERMINAL_ID = 40 GATEWAY_AMT = 500.0 37 41 LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png' 38 42 … … 44 48 terminal_id = TERMINAL_ID 45 49 logo_url = LOGO_URL 50 gateway_amt = GATEWAY_AMT 51 52 def update(self): 53 # Already now it becomes an Etranzact payment. We set the net amount 54 # and add the gateway amount. 55 if not webconnect_module_activated( 56 self.context.__parent__.__parent__.year, self.context): 57 return _("Etranzact payments deactivated.") 58 if not self.context.r_company: 59 self.context.net_amt = self.context.amount_auth 60 self.context.amount_auth += self.gateway_amt 61 self.context.gateway_amt = self.gateway_amt 62 self.context.r_company = u'etranzact' 63 self.amount = "%.1f" % self.context.amount_auth 64 error = self.init_update() 65 if error: 66 self.flash(error, type='danger') 67 self.redirect(self.url(self.context, '@@index')) 68 return 69 return 46 70 47 71 class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant): … … 66 90 terminal_id = TERMINAL_ID 67 91 logo_url = LOGO_URL 92 gateway_amt = GATEWAY_AMT 93 94 def update(self): 95 # Already now it becomes an Etranzact payment. We set the net amount 96 # and add the gateway amount. 97 if not webconnect_module_activated( 98 self.context.student.current_session, self.context): 99 return _("Etranzact payments deactivated.") 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'etranzact' 105 self.amount = "%.1f" % self.context.amount_auth 106 error = self.init_update() 107 if error: 108 self.flash(error, type='danger') 109 self.redirect(self.url(self.context, '@@index')) 110 return 111 return 68 112 69 113 class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent): … … 81 125 logo_url = LOGO_URL 82 126 127 # Payoutlet customizations 128 129 class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent): 130 """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent` 131 """ 132 gateway_amt = GATEWAY_AMT 133 134 def update(self): 135 if not payoutlet_module_activated( 136 self.context.student.current_session, self.context): 137 return 138 super(EtranzactEnterPinPageStudent, self).update() 139 # Already now it becomes an Etranzact payment. We set the net amount 140 # and add the gateway amount. 141 provider_amt = 0.0 142 if self.context.p_category == 'registration': 143 provider_amt = 5000.0 144 if not self.context.r_company: 145 self.context.net_amt = self.context.amount_auth 146 self.context.amount_auth += self.gateway_amt 147 self.context.amount_auth += provider_amt 148 self.context.gateway_amt = self.gateway_amt 149 self.context.provider_amt = provider_amt 150 self.context.r_company = u'etranzact' 151 return 152 153 class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant): 154 """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant` 155 """ 156 gateway_amt = GATEWAY_AMT 157 158 def update(self): 159 if not payoutlet_module_activated( 160 self.context.__parent__.__parent__.year, self.context): 161 return 162 super(EtranzactEnterPinPageStudent, self).update() 163 # Already now it becomes an Etranzact payment. We set the net amount 164 # and add the gateway amount. 165 provider_amt = 0.0 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.amount_auth += provider_amt 170 self.context.gateway_amt = self.gateway_amt 171 self.context.provider_amt = provider_amt 172 self.context.r_company = u'etranzact' 173 return 174 83 175 class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent): 84 176 """ Query history of Etranzact payments … … 94 186 host = HOST 95 187 https = HTTPS 188 189 class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice): 190 """A simple webservice to publish payment and payer details on request from 191 accepted IP addresses without authentication. 192 """ 193 #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184') 194 ACCEPTED_IP = None 195 196 CATEGORY_MAPPING = { 197 'SCHOOLFEE': ('schoolfee',), 198 }
Note: See TracChangeset for help on using the changeset viewer.