## $Id: browser.py 15781 2019-11-08 08:16:26Z henrik $ ## ## Copyright (C) 2017 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## from kofacustom.nigeria.etranzact.applicantsbrowser import ( EtranzactPageApplicant, EtranzactReceiveResponseApplicant, EtranzactRequestPaymentStatusPageApplicant) from kofacustom.nigeria.etranzact.studentsbrowser import ( EtranzactPageStudent, EtranzactReceiveResponseStudent, EtranzactRequestPaymentStatusPageStudent, webconnect_module_activated) from kofacustom.nigeria.etranzact.payoutletbrowser import ( EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant, EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant, payoutlet_module_activated) from kofacustom.nigeria.etranzact.payoutletwebservice import NigeriaPaymentDataWebservice # Temporarily we can use the test portal like in kofacustom.nigeria from kofacustom.nigeria.etranzact.tests import ( HOST, HTTPS, SECRET_KEY, TERMINAL_ID) #HOST = #HTTPS = #SECRET_KEY = #TERMINAL_ID = GATEWAY_AMT = 500.0 LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png' class CustomEtranzactPageApplicant(EtranzactPageApplicant): host = HOST https = HTTPS secret_key = SECRET_KEY terminal_id = TERMINAL_ID logo_url = LOGO_URL gateway_amt = GATEWAY_AMT def update(self): # Already now it becomes an Etranzact payment. We set the net amount # and add the gateway amount. if not webconnect_module_activated( self.context.__parent__.__parent__.year, self.context): return _("Etranzact payments deactivated.") if not self.context.r_company: self.context.net_amt = self.context.amount_auth self.context.amount_auth += self.gateway_amt self.context.gateway_amt = self.gateway_amt self.context.r_company = u'etranzact' self.amount = "%.1f" % self.context.amount_auth error = self.init_update() if error: self.flash(error, type='danger') self.redirect(self.url(self.context, '@@index')) return return class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant): secret_key = SECRET_KEY terminal_id = TERMINAL_ID class CustomEtranzactRequestPaymentStatusPageApplicant( EtranzactRequestPaymentStatusPageApplicant): host = HOST https = HTTPS secret_key = SECRET_KEY terminal_id = TERMINAL_ID logo_url = LOGO_URL class CustomEtranzactPageStudent(EtranzactPageStudent): host = HOST https = HTTPS secret_key = SECRET_KEY terminal_id = TERMINAL_ID logo_url = LOGO_URL gateway_amt = GATEWAY_AMT def update(self): # Already now it becomes an Etranzact payment. We set the net amount # and add the gateway amount. if not webconnect_module_activated( self.context.student.current_session, self.context): return _("Etranzact payments deactivated.") if not self.context.r_company: self.context.net_amt = self.context.amount_auth self.context.amount_auth += self.gateway_amt self.context.gateway_amt = self.gateway_amt self.context.r_company = u'etranzact' self.amount = "%.1f" % self.context.amount_auth error = self.init_update() if error: self.flash(error, type='danger') self.redirect(self.url(self.context, '@@index')) return return class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent): secret_key = SECRET_KEY terminal_id = TERMINAL_ID class CustomEtranzactRequestPaymentStatusPageStudent( EtranzactRequestPaymentStatusPageStudent): host = HOST https = HTTPS secret_key = SECRET_KEY terminal_id = TERMINAL_ID logo_url = LOGO_URL # Payoutlet customizations class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent): """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent` """ gateway_amt = GATEWAY_AMT def update(self): if not payoutlet_module_activated( self.context.student.current_session, self.context): return super(EtranzactEnterPinPageStudent, self).update() # Already now it becomes an Etranzact payment. We set the net amount # and add the gateway amount. provider_amt = 0.0 if self.context.p_category == 'registration': provider_amt = 5000.0 if not self.context.r_company: self.context.net_amt = self.context.amount_auth self.context.amount_auth += self.gateway_amt self.context.amount_auth += provider_amt self.context.gateway_amt = self.gateway_amt self.context.provider_amt = provider_amt self.context.r_company = u'etranzact' return class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant): """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant` """ gateway_amt = GATEWAY_AMT def update(self): if not payoutlet_module_activated( self.context.__parent__.__parent__.year, self.context): return super(EtranzactEnterPinPageStudent, self).update() # Already now it becomes an Etranzact payment. We set the net amount # and add the gateway amount. provider_amt = 0.0 if not self.context.r_company: self.context.net_amt = self.context.amount_auth self.context.amount_auth += self.gateway_amt self.context.amount_auth += provider_amt self.context.gateway_amt = self.gateway_amt self.context.provider_amt = provider_amt self.context.r_company = u'etranzact' return class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent): """ Query history of Etranzact payments """ terminal_id = TERMINAL_ID host = HOST https = HTTPS class CustomEtranzactQueryHistoryPageApplicant(EtranzactQueryHistoryPageApplicant): """ Query history of Etranzact payments """ terminal_id = TERMINAL_ID host = HOST https = HTTPS class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice): """A simple webservice to publish payment and payer details on request from accepted IP addresses without authentication. """ #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184') ACCEPTED_IP = None CATEGORY_MAPPING = { 'IUO_SCHOOL_FEES_FULL_PAYMENT': ('schoolfee',), 'IUO_SCHOOL_FEES_FIRST_INSTALLMENT': ('schoolfee40',), 'IUO_SCHOOL_FEES_OTHER_INSTALLMENT': ('secondinstal',), 'IUO_TRANSCRIPT_FEE': ('transcript',), 'IUO_REGISTRATION_FEE': ('registration',), 'IUO_PARENTS_CONSULTATIVE_FORUM_FEE': ('parentsconsult',), 'IUO_BOOK_DEPOSIT_FEE': ('book',), 'IUO_SUNDRY_FEES': ('late_registration', 'science','clinical','develop','municipal', 'alumni','conv','matric','waecneco','jambver','pharmlab','lo_ident', 'change_course','make_up','iuits','fine','combi'), }