[7929] | 1 | ## $Id: browser.py 15759 2019-11-06 16:49:15Z henrik $ |
---|
| 2 | ## |
---|
[15759] | 3 | ## Copyright (C) 2017 Uli Fouquet & Henrik Bettermann |
---|
[7929] | 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | |
---|
[15759] | 19 | from kofacustom.nigeria.etranzact.applicantsbrowser import ( |
---|
| 20 | EtranzactPageApplicant, EtranzactReceiveResponseApplicant, |
---|
| 21 | EtranzactRequestPaymentStatusPageApplicant) |
---|
| 22 | from kofacustom.nigeria.etranzact.studentsbrowser import ( |
---|
| 23 | EtranzactPageStudent, EtranzactReceiveResponseStudent, |
---|
| 24 | EtranzactRequestPaymentStatusPageStudent) |
---|
| 25 | from kofacustom.nigeria.etranzact.payoutletbrowser import ( |
---|
| 26 | EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant, |
---|
| 27 | EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant) |
---|
| 28 | from kofacustom.nigeria.etranzact.payoutletwebservice import NigeriaPaymentDataWebservice |
---|
[10978] | 29 | |
---|
[15759] | 30 | # Temporarily we can use the test portal like in kofacustom.nigeria |
---|
[8746] | 31 | |
---|
[15759] | 32 | from kofacustom.nigeria.etranzact.tests import ( |
---|
| 33 | HOST, HTTPS, SECRET_KEY, TERMINAL_ID, GATEWAY_AMT) |
---|
[8769] | 34 | |
---|
[15759] | 35 | #HOST = 'www.etranzact.net' |
---|
| 36 | #HTTPS = True |
---|
| 37 | #SECRET_KEY = |
---|
| 38 | #TERMINAL_ID = 0570000070 |
---|
| 39 | #GATEWAY_AMT = |
---|
| 40 | LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png' |
---|
[8698] | 41 | |
---|
[15759] | 42 | class CustomEtranzactPageApplicant(EtranzactPageApplicant): |
---|
[15346] | 43 | |
---|
[15759] | 44 | host = HOST |
---|
| 45 | https = HTTPS |
---|
| 46 | secret_key = SECRET_KEY |
---|
| 47 | terminal_id = TERMINAL_ID |
---|
| 48 | logo_url = LOGO_URL |
---|
| 49 | gateway_amt = GATEWAY_AMT |
---|
[15346] | 50 | |
---|
[15759] | 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')) |
---|
[9508] | 64 | return |
---|
[15759] | 65 | return |
---|
[14083] | 66 | |
---|
[15759] | 67 | class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant): |
---|
[14085] | 68 | |
---|
[15759] | 69 | secret_key = SECRET_KEY |
---|
| 70 | terminal_id = TERMINAL_ID |
---|
[14085] | 71 | |
---|
[15759] | 72 | class CustomEtranzactRequestPaymentStatusPageApplicant( |
---|
| 73 | EtranzactRequestPaymentStatusPageApplicant): |
---|
[14085] | 74 | |
---|
[15759] | 75 | host = HOST |
---|
| 76 | https = HTTPS |
---|
| 77 | secret_key = SECRET_KEY |
---|
| 78 | terminal_id = TERMINAL_ID |
---|
| 79 | logo_url = LOGO_URL |
---|
[14085] | 80 | |
---|
[15759] | 81 | class CustomEtranzactPageStudent(EtranzactPageStudent): |
---|
[14234] | 82 | |
---|
[15759] | 83 | host = HOST |
---|
| 84 | https = HTTPS |
---|
| 85 | secret_key = SECRET_KEY |
---|
| 86 | terminal_id = TERMINAL_ID |
---|
| 87 | logo_url = LOGO_URL |
---|
| 88 | gateway_amt = GATEWAY_AMT |
---|
[14085] | 89 | |
---|
[15759] | 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')) |
---|
[10937] | 103 | return |
---|
[8698] | 104 | return |
---|
| 105 | |
---|
[15759] | 106 | class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent): |
---|
[8698] | 107 | |
---|
[15759] | 108 | secret_key = SECRET_KEY |
---|
| 109 | terminal_id = TERMINAL_ID |
---|
[8698] | 110 | |
---|
[15759] | 111 | class CustomEtranzactRequestPaymentStatusPageStudent( |
---|
| 112 | EtranzactRequestPaymentStatusPageStudent): |
---|
[8259] | 113 | |
---|
[15759] | 114 | host = HOST |
---|
| 115 | https = HTTPS |
---|
| 116 | secret_key = SECRET_KEY |
---|
| 117 | terminal_id = TERMINAL_ID |
---|
| 118 | logo_url = LOGO_URL |
---|
[8680] | 119 | |
---|
[15759] | 120 | # Payoutlet customizations |
---|
[8247] | 121 | |
---|
[15759] | 122 | class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent): |
---|
| 123 | """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent` |
---|
| 124 | """ |
---|
| 125 | gateway_amt = GATEWAY_AMT |
---|
[7929] | 126 | |
---|
[15759] | 127 | class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant): |
---|
| 128 | """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant` |
---|
[7976] | 129 | """ |
---|
[15759] | 130 | gateway_amt = GATEWAY_AMT |
---|
[7929] | 131 | |
---|
[15759] | 132 | class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent): |
---|
| 133 | """ Query history of Etranzact payments |
---|
[8247] | 134 | """ |
---|
[15759] | 135 | terminal_id = TERMINAL_ID |
---|
| 136 | host = HOST |
---|
| 137 | https = HTTPS |
---|
[8247] | 138 | |
---|
[15759] | 139 | class CustomEtranzactQueryHistoryPageApplicant(EtranzactQueryHistoryPageApplicant): |
---|
| 140 | """ Query history of Etranzact payments |
---|
[7929] | 141 | """ |
---|
[15759] | 142 | terminal_id = TERMINAL_ID |
---|
| 143 | host = HOST |
---|
| 144 | https = HTTPS |
---|
[7929] | 145 | |
---|
[15759] | 146 | class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice): |
---|
| 147 | """A simple webservice to publish payment and payer details on request from |
---|
| 148 | accepted IP addresses without authentication. |
---|
[8247] | 149 | """ |
---|
[15759] | 150 | #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184') |
---|
| 151 | ACCEPTED_IP = None |
---|
[8247] | 152 | |
---|
[15759] | 153 | CATEGORY_MAPPING = { |
---|
| 154 | 'SCHOOLFEE': ('schoolfee',), |
---|
| 155 | } |
---|
[7929] | 156 | |
---|