Usage Guide and Documentation

testConnection()

After pressing the test connection button on module's settings page, we process the data coming from the form on “controllers / test_connection.php” file and define them to setconfig() function.

If there is a method that validates the credentials on the API side, we test the accuracy of the entered information.

 public function testConnection($config=[]){
    $username   = $config["settings"]["username"];
    $password   = $config["settings"]["password"];
    $sandbox    = $config["settings"]["test-mode"];


    if(!$username || !$password){
       $this->error = $this->lang["error6"];
       return false;
    }
    $password  = Crypt::decode($password,Config::get("crypt/system"));

    $this->setConfig($username,$password,$sandbox);

    if(!$this->api->login()){
       $this->error = $this->api->error;
       return false;
    }
    return true;
 }