Ignore:
Timestamp:
13 Sep 2024, 10:45:39 (3 months ago)
Author:
Henrik Bettermann
Message:

Implement WebCheckout?.

Location:
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch
Files:
2 edited

Legend:

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

    r16820 r17927  
    2525    InterswitchPaymentVerifyWebservicePageStudent,
    2626    InterswitchPageStudent, InterswitchPageApplicant,
     27    module_activated,
     28    )
     29from kofacustom.nigeria.interswitch.webcheckoutbrowser import (
     30    webcheckout_module_activated,
     31    WebCheckoutPageStudent,
     32    WebCheckoutPageApplicant,
     33    WebCheckoutConfirmTransactionStudent,
     34    WebCheckoutConfirmTransactionApplicant,
    2735    )
    2836from kofacustom.edopoly.students.interfaces import ICustomStudentOnlinePayment
     
    6977
    7078    def update(self):
     79        if not module_activated(
     80            self.context.student.current_session, self.context):
     81            self.flash(_('Forbidden'), type='danger')
     82            self.redirect(self.url(self.context, '@@index'))
     83            return
    7184        error = self.init_update()
    7285        if error:
     
    152165
    153166    def update(self):
     167        if not module_activated(
     168            self.context.__parent__.__parent__.year, self.context):
     169            self.flash(_('Forbidden'), type='danger')
     170            self.redirect(self.url(self.context, '@@index'))
     171            return
    154172        error = self.init_update()
    155173        if error:
     
    251269    gateway_url = URL
    252270    mac = MAC
     271
     272# WebCheckout customizations
     273
     274MERCHANT_CODE = 'MX176634'
     275PAY_ITEM_ID = '102'
     276
     277class CustomWebCheckoutPageStudent(WebCheckoutPageStudent):
     278    """ View which sends a POST request to the Interswitch
     279    WebCheckout payment gateway.
     280    """
     281    #action = 'https://newwebpay.interswitchng.com/collections/w/pay'
     282    action = 'https://newwebpay.qa.interswitchng.com/collections/w/pay'
     283    currency = '566'
     284    pay_item_id = PAY_ITEM_ID
     285    merchant_code = MERCHANT_CODE
     286    gateway_amt = 0.0
     287    product_id = PRODUCT_ID
     288
     289class CustomWebCheckoutPageApplicant(WebCheckoutPageApplicant):
     290    """ View which sends a POST request to the Interswitch
     291    WebCheckout payment gateway.
     292    """
     293
     294    action = 'https://newwebpay.interswitchng.com/collections/w/pay'
     295    currency = '566'
     296    pay_item_id = PAY_ITEM_ID
     297    merchant_code = MERCHANT_CODE
     298
     299class CustomWebCheckoutConfirmTransactionStudent(WebCheckoutConfirmTransactionStudent):
     300    """ Request webservice view for the WebCheckout gateway
     301    """
     302    merchant_code = MERCHANT_CODE
     303    gateway_host = 'webpay.interswitchng.com'
     304    gateway_url = '/collections/api/v1/gettransaction.json'
     305    https = True
     306
     307class CustomWebCheckoutConfirmTransactionApplicant(WebCheckoutConfirmTransactionApplicant):
     308    """ Request webservice view for the WebCheckout gateway
     309    """
     310    merchant_code = MERCHANT_CODE
     311    gateway_host = 'webpay.interswitchng.com'
     312    gateway_url = '/collections/api/v1/gettransaction.json'
     313    https = True
     314
     315
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py

    r17703 r17927  
    5050    def setUp(self):
    5151        super(InterswitchTestsStudents, self).setUp()
     52        self.app['configuration']['2004'].interswitch_enabled = True
    5253
    5354    def test_interswitch_form(self):
Note: See TracChangeset for help on using the changeset viewer.