Ignore:
Timestamp:
4 May 2020, 13:33:15 (5 years ago)
Author:
Henrik Bettermann
Message:

Configure Etranzact Webconnect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py

    r15999 r16084  
    3232
    3333from kofacustom.nigeria.etranzact.tests import (
    34     HOST, HTTPS, SECRET_KEY, TERMINAL_ID)
     34    HOST, HTTPS)
    3535
    3636HOST = 'www.etranzact.net'
    3737HTTPS = True
    38 #SECRET_KEY =
    39 TERMINAL_ID = '7007134590'
    4038GATEWAY_AMT = 500.0
    4139LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
    4240
     41WEBCONNECT_STUD_PARAMS = {
     42    'schoolfee': ('7007139588','QIgl9a35R30A1RGK'),
     43    'schoolfee40': ('7007139589','3coU0eolOEbEUeO3'),
     44    'secondinstal': ('7007139590','zGpEjy6CdPxCHqen'),
     45    'transcript_local': ('7007139592','ndgxUtzJgHRkvXlB'),
     46    'transcript_overseas': ('7007139592','ndgxUtzJgHRkvXlB'),
     47    'registration': ('7007139599','KGHjZ2hRbaDJGBX8'),
     48    'book': ('7007139600','rrKE2Ua7eu8TF0Is'),
     49    'parentsconsult': ('7007139598','HsqjOlAB5xfQNDyo'),
     50    'sundry': ('7007139591','0XkOFShPnWn8tY5O'),
     51    }
     52
     53def determine_appl_params(payment):
     54    terminal_id = ''
     55    secret_key = ''
     56    if payment.__parent__.__parent__.prefix.startswith('pg'):
     57        terminal_id = '7007139606'
     58        secret_key = 'E64s3IN9cXRJeltY'
     59    else:
     60        terminal_id = '7007139604'
     61        secret_key = 'vlEEJxvJBjC468g1'
     62    return terminal_id, secret_key
     63
     64def determine_stud_params(payment):
     65    terminal_id = ''
     66    secret_key = ''
     67    for key in WEBCONNECT_STUD_PARAMS.keys():
     68        if payment.p_category == key:
     69            terminal_id = WEBCONNECT_STUD_PARAMS[key][0]
     70            secret_key = WEBCONNECT_STUD_PARAMS[key][1]
     71    if not terminal_id:
     72        terminal_id = WEBCONNECT_STUD_PARAMS['sundry'][0]
     73        secret_key = WEBCONNECT_STUD_PARAMS['sundry'][1]
     74    return terminal_id, secret_key
     75
    4376class CustomEtranzactPageApplicant(EtranzactPageApplicant):
    4477
    4578    host = HOST
    4679    https = HTTPS
    47     secret_key = SECRET_KEY
    48     terminal_id = TERMINAL_ID
    49     logo_url = LOGO_URL
    50     gateway_amt = GATEWAY_AMT
     80    logo_url = LOGO_URL
     81    gateway_amt = GATEWAY_AMT
     82
     83    @property
     84    def terminal_id(self):
     85        return determine_appl_params(self.context)[0]
     86
     87    @property
     88    def secret_key(self):
     89        return determine_appl_params(self.context)[1]
    5190
    5291    def update(self):
     
    73112class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant):
    74113
    75     secret_key = SECRET_KEY
    76     terminal_id = TERMINAL_ID
     114    @property
     115    def terminal_id(self):
     116        return determine_appl_params(self.context)[0]
     117
     118    @property
     119    def secret_key(self):
     120        return determine_appl_params(self.context)[1]
    77121
    78122class CustomEtranzactRequestPaymentStatusPageApplicant(
     
    81125    host = HOST
    82126    https = HTTPS
    83     secret_key = SECRET_KEY
    84     terminal_id = TERMINAL_ID
    85     logo_url = LOGO_URL
     127    logo_url = LOGO_URL
     128
     129    @property
     130    def terminal_id(self):
     131        return determine_appl_params(self.context)[0]
     132
     133    @property
     134    def secret_key(self):
     135        return determine_appl_params(self.context)[1]
    86136
    87137class CustomEtranzactPageStudent(EtranzactPageStudent):
     
    89139    host = HOST
    90140    https = HTTPS
    91     secret_key = SECRET_KEY
    92     terminal_id = TERMINAL_ID
    93     logo_url = LOGO_URL
    94     gateway_amt = GATEWAY_AMT
     141    logo_url = LOGO_URL
     142    gateway_amt = GATEWAY_AMT
     143
     144    @property
     145    def terminal_id(self):
     146        return determine_stud_params(self.context)[0]
     147
     148    @property
     149    def secret_key(self):
     150        return determine_stud_params(self.context)[1]
    95151
    96152    def update(self):
     
    117173class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent):
    118174
    119     secret_key = SECRET_KEY
    120     terminal_id = TERMINAL_ID
     175    @property
     176    def terminal_id(self):
     177        return determine_stud_params(self.context)[0]
     178
     179    @property
     180    def secret_key(self):
     181        return determine_stud_params(self.context)[1]
    121182
    122183class CustomEtranzactRequestPaymentStatusPageStudent(
     
    125186    host = HOST
    126187    https = HTTPS
    127     secret_key = SECRET_KEY
    128     terminal_id = TERMINAL_ID
    129     logo_url = LOGO_URL
     188    logo_url = LOGO_URL
     189
     190    @property
     191    def terminal_id(self):
     192        return determine_stud_params(self.context)[0]
     193
     194    @property
     195    def secret_key(self):
     196        return determine_stud_params(self.context)[1]
     197
     198
     199
     200
    130201
    131202# Payoutlet customizations
     
    182253    """ Query history of Etranzact payments
    183254    """
    184     terminal_id = TERMINAL_ID
     255    terminal_id = '7007134590'
    185256    host = HOST
    186257    https = HTTPS
Note: See TracChangeset for help on using the changeset viewer.