Ignore:
Timestamp:
5 Nov 2019, 23:19:58 (5 years ago)
Author:
Henrik Bettermann
Message:

Prepare all payment gateway modules for net amount fee configuration. In the future, provider and gateway surcharges will be determined and added just before the data are being send to the gateways for the first time.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/applicantsbrowser.py

    r15702 r15755  
    3333
    3434from kofacustom.nigeria.etranzact.tests import (
    35     TERMINAL_ID, HOST, HTTPS, SECRET_KEY, LOGO_URL)
     35    TERMINAL_ID, HOST, HTTPS, SECRET_KEY, LOGO_URL, GATEWAY_AMT)
    3636
    3737grok.templatedir('browser_templates')
     
    9393    terminal_id = TERMINAL_ID
    9494    logo_url = LOGO_URL
     95    gateway_amt = GATEWAY_AMT
    9596
    9697    @property
     
    101102
    102103    def init_update(self):
     104        if not module_activated(self.context.__parent__.__parent__.year):
     105            return _("Etranzact payments deactivated.")
    103106        if self.context.p_state == 'paid':
    104107            return _("Payment ticket can't be re-sent to Etranzact.")
     
    116119        # which authenticates the response.
    117120        self.responseurl = self.url(self.context, 'receive_etranzact')
    118         # Already now it becomes a Etranzact payment
    119         self.context.r_company = u'etranzact'
    120         hashargs =      self.amount + self.terminal_id+self.transaction_id \
     121        self.transaction_id = self.context.p_id
     122        hashargs =      self.amount + self.terminal_id + self.transaction_id \
    121123            + self.responseurl + self.secret_key
    122124        self.hashvalue = hashlib.md5(hashargs).hexdigest()
     
    125127
    126128    def update(self):
    127         if not module_activated(self.context.__parent__.__parent__.year):
    128             return
    129         self.transaction_id = self.context.p_id
     129        # Already now it becomes an Etranzact payment. We set the net amount
     130        # and add the gateway amount.
     131        if not self.context.r_company:
     132            self.context.net_amt = self.context.amount_auth
     133            self.context.amount_auth += self.gateway_amt
     134            self.context.gateway_amt = self.gateway_amt
     135            self.context.r_company = u'etranzact'
    130136        self.amount = "%.1f" % self.context.amount_auth
    131137        error = self.init_update()
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py

    r15734 r15755  
    181181    payment.r_card_num = "%s %s" % (form.get('CARD_TYPE', None),
    182182                                    form.get('CARD_NO', None))
    183     payment.r_company = u'etranzact'
    184183    if payment.r_code != '0':
    185184        msg = _('Unsuccessful response: ${a}', mapping = {'a': payment.r_desc})
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/payoutletbrowser.py

    r15730 r15755  
    3939from kofacustom.nigeria.students.interfaces import INigeriaStudentOnlinePayment
    4040from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment
    41 from kofacustom.nigeria.etranzact.tests import HOST, TERMINAL_ID, HTTPS
     41from kofacustom.nigeria.etranzact.tests import HOST, TERMINAL_ID, HTTPS, GATEWAY_AMT
    4242from kofacustom.nigeria.etranzact.helpers import query_payoutlet
    4343
     
    8484
    8585class EtranzactEnterPinPageStudent(KofaPage):
    86     """
     86    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent`
    8787    """
    8888    grok.context(INigeriaStudentOnlinePayment)
     
    9595    action = 'query_payoutlet_history'
    9696    placeholder = _('Confirmation Number (PIN)')
     97    gateway_amt = GATEWAY_AMT
    9798
    9899    def update(self):
    99100        if not module_activated(self.context.student.current_session):
    100101            return
     102        if self.context.r_company and self.context.r_company != 'etranzact':
     103            return _("Payment ticket has been used for another payment gateway.")
    101104        super(EtranzactEnterPinPageStudent, self).update()
     105        # Already now it becomes an Etranzact payment. We set the net amount
     106        # and add the gateway amount.
     107        if not self.context.r_company:
     108            self.context.net_amt = self.context.amount_auth
     109            self.context.amount_auth += self.gateway_amt
     110            self.context.gateway_amt = self.gateway_amt
     111            self.context.r_company = u'etranzact'
    102112        return
    103113
    104114class EtranzactEnterPinPageApplicant(EtranzactEnterPinPageStudent):
    105     """
     115    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant`
    106116    """
    107117    grok.require('waeup.payApplicant')
     
    155165        if not module_activated(self.context.__parent__.__parent__.year):
    156166            return
    157         ob_class = self.__implemented__.__name__
    158167        if self.context.p_state == 'paid':
    159168            self.flash(_('This ticket has already been paid.'))
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/studentsbrowser.py

    r15702 r15755  
    3333
    3434from kofacustom.nigeria.etranzact.tests import (
    35     TERMINAL_ID, HOST, HTTPS, SECRET_KEY, LOGO_URL)
     35    TERMINAL_ID, HOST, HTTPS, SECRET_KEY, LOGO_URL, GATEWAY_AMT)
    3636
    3737grok.templatedir('browser_templates')
     
    9393    terminal_id = TERMINAL_ID
    9494    logo_url = LOGO_URL
     95    gateway_amt = GATEWAY_AMT
    9596
    9697    @property
     
    101102
    102103    def init_update(self):
     104        if not module_activated(self.context.student.current_session):
     105            return _("Etranzact payments deactivated.")
    103106        if self.context.p_state == 'paid':
    104107            return _("Payment ticket can't be re-sent to Etranzact.")
     
    116119        # which authenticates the response.
    117120        self.responseurl = self.url(self.context, 'receive_etranzact')
    118         # Already now it becomes a Etranzact payment
    119         self.context.r_company = u'etranzact'
    120         hashargs =      self.amount + self.terminal_id+self.transaction_id \
     121        self.transaction_id = self.context.p_id
     122        hashargs =      self.amount + self.terminal_id + self.transaction_id \
    121123            + self.responseurl + self.secret_key
    122124        self.hashvalue = hashlib.md5(hashargs).hexdigest()
     
    125127
    126128    def update(self):
    127         if not module_activated(self.context.student.current_session):
    128             return
    129         self.transaction_id = self.context.p_id
     129        # Already now it becomes an Etranzact payment. We set the net amount
     130        # and add the gateway amount.
     131        if not self.context.r_company:
     132            self.context.net_amt = self.context.amount_auth
     133            self.context.amount_auth += self.gateway_amt
     134            self.context.gateway_amt = self.gateway_amt
     135            self.context.r_company = u'etranzact'
    130136        self.amount = "%.1f" % self.context.amount_auth
    131137        error = self.init_update()
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r15734 r15755  
    4141#   do exist really and are not bothered by being spammed by a test programme.
    4242
    43 EXTERNAL_TESTS = True
     43EXTERNAL_TESTS = False
    4444
    4545TERMINAL_ID = '5003021194'
     
    4848SECRET_KEY = 'DEMO_KEY'
    4949LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
     50GATEWAY_AMT = 500.0
    5051
    5152# Valid transaction id in Etranzact system
Note: See TracChangeset for help on using the changeset viewer.