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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py

    r15727 r15755  
    3434from kofacustom.nigeria.interfaces import MessageFactory as _
    3535
     36GATEWAY_AMT = 300.0
     37
    3638# Buttons
    3739
     
    306308    xml_data = None
    307309    hashvalue = None
     310    gateway_amt = GATEWAY_AMT
    308311
    309312    def init_update(self):
     
    317320        if time_delta.days > 7:
    318321            return _("This payment ticket is too old. Please create a new ticket.")
     322        if self.context.r_company and self.context.r_company != 'interswitch':
     323            return _("Payment ticket has been used for another payment gateway.")
    319324        student = self.context.student
    320325        certificate = getattr(student['studycourse'],'certificate',None)
     
    326331            self.context.p_item, self.context.p_session):
    327332            return _("This type of payment has already been made.")
    328         self.amount_auth = int(100 * self.context.amount_auth)
    329333        xmldict = {}
    330334        if certificate is not None:
     
    341345        self.student = student
    342346        self.xmldict = xmldict
    343         self.context.r_company = u'interswitch'
    344347        return
    345348
     
    351354            self.flash(error, type='danger')
    352355            self.redirect(self.url(self.context, '@@index'))
     356        # Already now it becomes an Interswitch payment. We set the net amount
     357        # and add the gateway amount.
     358        if not self.context.r_company:
     359            self.context.net_amt = self.context.amount_auth
     360            self.context.amount_auth += self.gateway_amt
     361            self.context.gateway_amt = self.gateway_amt
     362            self.context.r_company = u'interswitch'
     363        self.amount_auth = int(100 * self.context.amount_auth)
    353364        return
    354365
     
    363374    label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')
    364375    submit_button = _('Submit')
    365     hashvalue = None
    366376
    367377    action = None
     
    371381    product_id = None
    372382    xml_data = None
     383    hashvalue = None
     384    gateway_amt = GATEWAY_AMT
    373385
    374386    def init_update(self):
     
    379391            return _("Payment ticket can't be send to CollegePAY. "
    380392                     "Application period has expired.")
     393        if self.context.r_company and self.context.r_company != 'interswitch':
     394            return _("Payment ticket has been used for another payment gateway.")
    381395        tz = getUtility(IKofaUtils).tzinfo
    382396        time_delta = datetime.utcnow() - self.context.creation_date
     
    384398            return _("This payment ticket is too old. Please create a new ticket.")
    385399        self.applicant = self.context.__parent__
    386         self.amount_auth = int(100 * self.context.amount_auth)
    387400        self.category = self.context.category
    388401        tz = getUtility(IKofaUtils).tzinfo
     
    390403            self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    391404        self.site_redirect_url = self.url(self.context, 'request_webservice')
    392         self.context.r_company = u'interswitch'
    393405        return
    394406
     
    400412            self.flash(error, type='danger')
    401413            self.redirect(self.url(self.context, '@@index'))
    402         return
     414        # Already now it becomes an Interswitch payment. We set the net amount
     415        # and add the gateway amount.
     416        if not self.context.r_company:
     417            self.context.net_amt = self.context.amount_auth
     418            self.context.amount_auth += self.gateway_amt
     419            self.context.gateway_amt = self.gateway_amt
     420            self.context.r_company = u'interswitch'
     421        self.amount_auth = int(100 * self.context.amount_auth)
     422        return
Note: See TracChangeset for help on using the changeset viewer.