Changeset 11914


Ignore:
Timestamp:
30 Oct 2014, 16:43:11 (10 years ago)
Author:
Henrik Bettermann
Message:

Be prepared for https webservice requests.

Location:
main/kofacustom.nigeria/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/CHANGES.txt

    r11780 r11914  
    441.2 (unreleased)
    55================
     6
     7- Be prepared for https webservice requests.
    68
    79- Add more exam subjects.
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/helpers.py

    r10273 r11914  
    2525from kofacustom.nigeria.interfaces import MessageFactory as _
    2626
    27 def SOAP_post(soap_action, xml, host, url):
     27def SOAP_post(soap_action, xml, host, url, https):
    2828    """Handles making the SOAP request.
    2929
     
    3131    http://testwebpay.interswitchng.com/test_paydirect/services/TransactionQueryWs.asmx?op=getTransactionData
    3232    """
    33     h = httplib.HTTPConnection(host)
     33    if https:
     34        h = httplib.HTTPSConnection(host)
     35    else:
     36        h = httplib.HTTPConnection(host)
    3437    headers={
    3538        'Host':host,
     
    4245    return response
    4346
    44 def get_SOAP_response(product_id, transref, host, url):
     47def get_SOAP_response(product_id, transref, host, url, https):
    4548    xml="""\
    4649<?xml version="1.0" encoding="utf-8"?>
     
    5356  </soap:Body>
    5457</soap:Envelope>""" % (product_id, transref)
    55     response=SOAP_post("http://tempuri.org/getTransactionData",xml, host, url)
     58    response=SOAP_post("http://tempuri.org/getTransactionData",xml, host, url, https)
    5659    if response.status!=200:
    5760        return 'Connection error (%s, %s)' % (response.status, response.reason)
     
    6164    return response
    6265
    63 def query_interswitch(payment, product_id, host, url):
    64     sr = get_SOAP_response(product_id, payment.p_id, host, url)
     66def query_interswitch(payment, product_id, host, url, https=False):
     67    sr = get_SOAP_response(product_id, payment.p_id, host, url, https)
    6568    if sr.startswith('Connection error'):
    6669        msg = _('Connection error')
Note: See TracChangeset for help on using the changeset viewer.