27 if (is_string($engineCode) && is_array($setup) && is_array($config))
29 $meta = BusinessSuite\ServiceMetaData::create()
31 ->setEngineCode($engineCode)
32 ->setType($service::getTypeByEngine($engineCode));
36 $response = AjaxJson::createSuccess([
37 'authUrl' => $serviceContainer->getAuthAdapter($meta->getType())
38 ->setConfig($config = Facebook\Config::loadFromArray($config))
43 $response = ($setup->save()? $response : AjaxJson::createError(
null,[]));
48 $handler = BusinessSuite\Exception\ConfigExceptionHandler::handle($exception);
49 $response = AjaxJson::createError($handler->getErrorCollection(),$handler->getCustomData());
51 catch (\Throwable $exception)
53 $response = AjaxJson::createError();