Ignore:
Timestamp:
7 Nov 2019, 17:45:43 (5 years ago)
Author:
Henrik Bettermann
Message:

Adjust to Nigeria package.

File:
1 edited

Legend:

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

    r15733 r15773  
    2222from kofacustom.nigeria.etranzact.studentsbrowser import (
    2323    EtranzactPageStudent, EtranzactReceiveResponseStudent,
    24     EtranzactRequestPaymentStatusPageStudent)
     24    EtranzactRequestPaymentStatusPageStudent, webconnect_module_activated)
    2525from kofacustom.nigeria.etranzact.payoutletbrowser import (
    26     EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant)
     26    EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant,
     27    EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant,
     28    payoutlet_module_activated)
     29from kofacustom.nigeria.etranzact.payoutletwebservice  import NigeriaPaymentDataWebservice
    2730
    2831# Temporarily we can use the test portal like in kofacustom.nigeria
     
    3538#SECRET_KEY =
    3639#TERMINAL_ID =
     40GATEWAY_AMT = 500.0
    3741LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
    3842
     
    4448    terminal_id = TERMINAL_ID
    4549    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
    4670
    4771class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant):
     
    6690    terminal_id = TERMINAL_ID
    6791    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
    68112
    69113class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent):
     
    81125    logo_url = LOGO_URL
    82126
     127# Payoutlet customizations
     128
     129class 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
     153class 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
    83175class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent):
    84176    """ Query history of Etranzact payments
     
    94186    host = HOST
    95187    https = HTTPS
     188
     189class 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.