Changeset 17754


Ignore:
Timestamp:
9 May 2024, 08:28:08 (8 months ago)
Author:
Henrik Bettermann
Message:

Show correct error message.

File:
1 edited

Legend:

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

    r17730 r17754  
    321321        jsonout = response.read()
    322322        parsed_json = json.loads(jsonout)
    323         return {'error': parsed_json['error']}
     323        errormsg = ''
     324        for value in parsed_json['error'].values():
     325            errormsg += "%s. " %(value)
     326        return {'error': errormsg}
    324327    if response.status!=200:
    325328        return {'error': 'Connection error (%s, %s)' % (response.status, response.reason)}
     
    345348def initiate_payment(payment, host, callbackUrl, public_api_key):
    346349    response = get_JSON_response_initialize(payment, host, callbackUrl, public_api_key)
     350    if response.get('error', None):
     351        return False, response['error']
    347352    if response['status'] == 200:
    348353        return True, response['data']['authorizationUrl']
Note: See TracChangeset for help on using the changeset viewer.