TestConnection

Purpose

Tests the gateway availability with the specified plug-in configuration.

Mandatory

No.

Input Parameters

An associative array that contains the following values:

Param name Description Type
config The plug-in configuration values saved in the Billing database. array
environment

The Billing environment information (TestConnect receives the lang and system_host parameters only).

Environment

The example of input parameters is shown below as a JSON object:

Copy
{
    "config": {
        "auth_code": "421",
        "format": "json",
        "gateway_url": "https://plugin-gateway-url.com",
        "test_mode": "1"    },
    "environment": {
        "lang": "en",
        "system_host": "bss.int.zone"    }
}

Response

The associative array that contains the following keys:

Param name Description Type
STATUS The status of the method execution. Valid values are:
  • APPROVED: The test connection is successfully performed.
  • DECLINED: The test connection failed. The reason or error message can be sent in the TEXT parameter.
string
TEXT (Optional) The array that contains the following parameters:
  • customer_message: Contains text that will be displayed to a customer as a status message (String, optional),
  • vendor_message: Contains text that will be displayed to a vendor (String, optional).
array

Example

The TestConnection implementation below tries to connect to the gateway_url URL provided during the plug-in configuration. If there is no error (HTTP range < 400) calling HTTP GET on that URL, it returns STATUS = APPROVED to the Billing, which means that the configuration is correctly set. If it fails (for example, provided auth_code is not correct, so the gateway would probably return HTTP 403 Unauthorized Error in this case), it returns STATUS = DECLINED and an error message is returned in the TEXT field.

If test connection to the payment gateway succeeds, Billing displays the "Test connection succeeded." message:

See Also

CloudBlue, an Ingram Micro business, uses cookies to improve the usability of our site. By continuing to use this site and/or logging in you are accepting the use of these cookies. For more information, visit our Privacy Policy.