source: main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py @ 16814

Last change on this file since 16814 was 15759, checked in by Henrik Bettermann, 5 years ago

Remove and replace old Etranzact stuff.The module must be newly configured.

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1## $Id: browser.py 15759 2019-11-06 16:49:15Z henrik $
2##
3## Copyright (C) 2017 Uli Fouquet & Henrik Bettermann
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
19from kofacustom.nigeria.etranzact.applicantsbrowser import (
20    EtranzactPageApplicant, EtranzactReceiveResponseApplicant,
21    EtranzactRequestPaymentStatusPageApplicant)
22from kofacustom.nigeria.etranzact.studentsbrowser import (
23    EtranzactPageStudent, EtranzactReceiveResponseStudent,
24    EtranzactRequestPaymentStatusPageStudent)
25from kofacustom.nigeria.etranzact.payoutletbrowser import (
26    EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant,
27    EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant)
28from kofacustom.nigeria.etranzact.payoutletwebservice  import NigeriaPaymentDataWebservice
29
30# Temporarily we can use the test portal like in kofacustom.nigeria
31
32from kofacustom.nigeria.etranzact.tests import (
33    HOST, HTTPS, SECRET_KEY, TERMINAL_ID, GATEWAY_AMT)
34
35#HOST = 'www.etranzact.net'
36#HTTPS = True
37#SECRET_KEY =
38#TERMINAL_ID = 0570000070
39#GATEWAY_AMT =
40LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
41
42class CustomEtranzactPageApplicant(EtranzactPageApplicant):
43
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
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
66
67class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant):
68
69    secret_key = SECRET_KEY
70    terminal_id = TERMINAL_ID
71
72class CustomEtranzactRequestPaymentStatusPageApplicant(
73    EtranzactRequestPaymentStatusPageApplicant):
74
75    host = HOST
76    https = HTTPS
77    secret_key = SECRET_KEY
78    terminal_id = TERMINAL_ID
79    logo_url = LOGO_URL
80
81class CustomEtranzactPageStudent(EtranzactPageStudent):
82
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
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
105
106class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent):
107
108    secret_key = SECRET_KEY
109    terminal_id = TERMINAL_ID
110
111class CustomEtranzactRequestPaymentStatusPageStudent(
112    EtranzactRequestPaymentStatusPageStudent):
113
114    host = HOST
115    https = HTTPS
116    secret_key = SECRET_KEY
117    terminal_id = TERMINAL_ID
118    logo_url = LOGO_URL
119
120# Payoutlet customizations
121
122class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent):
123    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent`
124    """
125    gateway_amt = GATEWAY_AMT
126
127class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant):
128    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant`
129    """
130    gateway_amt = GATEWAY_AMT
131
132class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent):
133    """ Query history of Etranzact payments
134    """
135    terminal_id = TERMINAL_ID
136    host = HOST
137    https = HTTPS
138
139class CustomEtranzactQueryHistoryPageApplicant(EtranzactQueryHistoryPageApplicant):
140    """ Query history of Etranzact payments
141    """
142    terminal_id = TERMINAL_ID
143    host = HOST
144    https = HTTPS
145
146class 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
Note: See TracBrowser for help on using the repository browser.