| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* ZohoAnalytics Integration |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace BitCode\BitForm\Core\Integration\ZohoAnalytics; |
| 9 |
|
| 10 |
use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 11 |
use BitCode\BitForm\Core\Util\ApiResponse as UtilApiResponse; |
| 12 |
use BitCode\BitForm\Core\Util\HttpHelper; |
| 13 |
use BitCode\BitForm\Core\Util\IpTool; |
| 14 |
use WP_Error; |
| 15 |
|
| 16 |
/** |
| 17 |
* Provide functionality for ZohoCrm integration |
| 18 |
*/ |
| 19 |
class ZohoAnalyticsHandler |
| 20 |
{ |
| 21 |
private $_formID; |
| 22 |
private $_integrationID; |
| 23 |
|
| 24 |
private $_logResponse; |
| 25 |
|
| 26 |
public function __construct($integrationID, $fromID) |
| 27 |
{ |
| 28 |
$this->_formID = $fromID; |
| 29 |
$this->_integrationID = $integrationID; |
| 30 |
$this->_logResponse = new UtilApiResponse(); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Helps to register ajax function's with wp |
| 35 |
* |
| 36 |
* @return null |
| 37 |
*/ |
| 38 |
public static function registerAjax() |
| 39 |
{ |
| 40 |
add_action('wp_ajax_bitforms_zanalytics_generate_token', [__CLASS__, 'generateTokens']); |
| 41 |
add_action('wp_ajax_bitforms_zanalytics_refresh_workspaces', [__CLASS__, 'refreshWorkspacesAjaxHelper']); |
| 42 |
add_action('wp_ajax_bitforms_zanalytics_refresh_users', [__CLASS__, 'refreshUsersAjaxHelper']); |
| 43 |
add_action('wp_ajax_bitforms_zanalytics_refresh_tables', [__CLASS__, 'refreshTablesAjaxHelper']); |
| 44 |
add_action('wp_ajax_bitforms_zanalytics_refresh_table_headers', [__CLASS__, 'refreshTableHeadersAjaxHelper']); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Process ajax request for generate_token |
| 49 |
* |
| 50 |
* @return JSON zoho crm api response and status |
| 51 |
*/ |
| 52 |
public static function generateTokens() |
| 53 |
{ |
| 54 |
if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { |
| 55 |
$inputJSON = file_get_contents('php://input'); |
| 56 |
$requestsParams = json_decode($inputJSON); |
| 57 |
if ( |
| 58 |
empty($requestsParams->{'accounts-server'}) |
| 59 |
|| empty($requestsParams->dataCenter) |
| 60 |
|| empty($requestsParams->clientId) |
| 61 |
|| empty($requestsParams->clientSecret) |
| 62 |
|| empty($requestsParams->redirectURI) |
| 63 |
|| empty($requestsParams->code) |
| 64 |
) { |
| 65 |
wp_send_json_error( |
| 66 |
__( |
| 67 |
'Requested parameter is empty', |
| 68 |
'bit-form' |
| 69 |
), |
| 70 |
400 |
| 71 |
); |
| 72 |
} |
| 73 |
|
| 74 |
$apiEndpoint = \urldecode($requestsParams->{'accounts-server'}) . '/oauth/v2/token'; |
| 75 |
$requestParams = [ |
| 76 |
'grant_type' => 'authorization_code', |
| 77 |
'client_id' => $requestsParams->clientId, |
| 78 |
'client_secret' => $requestsParams->clientSecret, |
| 79 |
'redirect_uri' => \urldecode($requestsParams->redirectURI), |
| 80 |
'code' => $requestsParams->code |
| 81 |
]; |
| 82 |
$apiResponse = HttpHelper::post($apiEndpoint, $requestParams); |
| 83 |
|
| 84 |
if (is_wp_error($apiResponse) || !empty($apiResponse->error)) { |
| 85 |
wp_send_json_error( |
| 86 |
empty($apiResponse->error) ? 'Unknown' : $apiResponse->error, |
| 87 |
400 |
| 88 |
); |
| 89 |
} |
| 90 |
$apiResponse->generates_on = \time(); |
| 91 |
wp_send_json_success($apiResponse, 200); |
| 92 |
} else { |
| 93 |
wp_send_json_error( |
| 94 |
__( |
| 95 |
'Token expired', |
| 96 |
'bit-form' |
| 97 |
), |
| 98 |
401 |
| 99 |
); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Process ajax request for refresh crm modules |
| 105 |
* |
| 106 |
* @return JSON crm module data |
| 107 |
*/ |
| 108 |
public static function refreshWorkspacesAjaxHelper() |
| 109 |
{ |
| 110 |
if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { |
| 111 |
$authorizationHeader = null; |
| 112 |
$inputJSON = file_get_contents('php://input'); |
| 113 |
$queryParams = json_decode($inputJSON); |
| 114 |
if ( |
| 115 |
empty($queryParams->tokenDetails) |
| 116 |
|| empty($queryParams->dataCenter) |
| 117 |
|| empty($queryParams->clientId) |
| 118 |
|| empty($queryParams->clientSecret) |
| 119 |
|| empty($queryParams->ownerEmail) |
| 120 |
) { |
| 121 |
wp_send_json_error( |
| 122 |
__( |
| 123 |
'Requested parameter is empty', |
| 124 |
'bit-form' |
| 125 |
), |
| 126 |
400 |
| 127 |
); |
| 128 |
} |
| 129 |
$response = []; |
| 130 |
if ((intval($queryParams->tokenDetails->generates_on) + (55 * 60)) < time()) { |
| 131 |
$response['tokenDetails'] = ZohoAnalyticsHandler::_refreshAccessToken($queryParams); |
| 132 |
} |
| 133 |
|
| 134 |
$workspacesMetaApiEndpoint = "https://analyticsapi.zoho.{$queryParams->dataCenter}/api/{$queryParams->ownerEmail}?ZOHO_ACTION=MYWORKSPACELIST&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=JSON&ZOHO_API_VERSION=1.0"; |
| 135 |
|
| 136 |
$authorizationHeader['Authorization'] = "Zoho-oauthtoken {$queryParams->tokenDetails->access_token}"; |
| 137 |
$workspacesMetaResponse = HttpHelper::get($workspacesMetaApiEndpoint, null, $authorizationHeader); |
| 138 |
|
| 139 |
$allWorkspaces = []; |
| 140 |
if (!is_wp_error($workspacesMetaResponse) && empty($workspacesMetaResponse->response->error)) { |
| 141 |
$workspaces = $workspacesMetaResponse->response->result; |
| 142 |
foreach ($workspaces as $workspace) { |
| 143 |
$allWorkspaces[] = $workspace->workspaceName; |
| 144 |
} |
| 145 |
usort($allWorkspaces, 'strnatcasecmp'); |
| 146 |
$response['workspaces'] = $allWorkspaces; |
| 147 |
} else { |
| 148 |
wp_send_json_error( |
| 149 |
$workspacesMetaResponse->response->error->message, |
| 150 |
400 |
| 151 |
); |
| 152 |
} |
| 153 |
if (!empty($response['tokenDetails']) && !empty($queryParams->id)) { |
| 154 |
ZohoAnalyticsHandler::_saveRefreshedToken($queryParams->formID, $queryParams->id, $response['tokenDetails'], $response['workspaces']); |
| 155 |
} |
| 156 |
wp_send_json_success($response, 200); |
| 157 |
} else { |
| 158 |
wp_send_json_error( |
| 159 |
__( |
| 160 |
'Token expired', |
| 161 |
'bit-form' |
| 162 |
), |
| 163 |
401 |
| 164 |
); |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
public static function refreshUsersAjaxHelper() |
| 169 |
{ |
| 170 |
if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { |
| 171 |
$authorizationHeader = null; |
| 172 |
$inputJSON = file_get_contents('php://input'); |
| 173 |
$queryParams = json_decode($inputJSON); |
| 174 |
if ( |
| 175 |
empty($queryParams->tokenDetails) |
| 176 |
|| empty($queryParams->dataCenter) |
| 177 |
|| empty($queryParams->clientId) |
| 178 |
|| empty($queryParams->clientSecret) |
| 179 |
|| empty($queryParams->ownerEmail) |
| 180 |
) { |
| 181 |
wp_send_json_error( |
| 182 |
__( |
| 183 |
'Requested parameter is empty', |
| 184 |
'bit-form' |
| 185 |
), |
| 186 |
400 |
| 187 |
); |
| 188 |
} |
| 189 |
$response = []; |
| 190 |
if ((intval($queryParams->tokenDetails->generates_on) + (55 * 60)) < time()) { |
| 191 |
$response['tokenDetails'] = ZohoAnalyticsHandler::_refreshAccessToken($queryParams); |
| 192 |
} |
| 193 |
|
| 194 |
$usersMetaApiEndpoint = "https://analyticsapi.zoho.{$queryParams->dataCenter}/api/{$queryParams->ownerEmail}?ZOHO_ACTION=GETUSERS&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=JSON&ZOHO_API_VERSION=1.0"; |
| 195 |
|
| 196 |
$authorizationHeader['Authorization'] = "Zoho-oauthtoken {$queryParams->tokenDetails->access_token}"; |
| 197 |
$usersMetaResponse = HttpHelper::get($usersMetaApiEndpoint, null, $authorizationHeader); |
| 198 |
|
| 199 |
$allusers = []; |
| 200 |
if (!is_wp_error($usersMetaResponse) && empty($usersMetaResponse->response->error)) { |
| 201 |
$users = $usersMetaResponse->response->result; |
| 202 |
foreach ($users as $user) { |
| 203 |
$allusers[] = $user->emailId; |
| 204 |
} |
| 205 |
usort($allusers, 'strnatcasecmp'); |
| 206 |
$response['users'] = $allusers; |
| 207 |
} else { |
| 208 |
wp_send_json_error( |
| 209 |
$usersMetaResponse->response->error->message, |
| 210 |
400 |
| 211 |
); |
| 212 |
} |
| 213 |
if (!empty($response['tokenDetails']) && !empty($queryParams->id)) { |
| 214 |
ZohoAnalyticsHandler::_saveRefreshedToken($queryParams->formID, $queryParams->id, $response['tokenDetails'], $response['users']); |
| 215 |
} |
| 216 |
wp_send_json_success($response, 200); |
| 217 |
} else { |
| 218 |
wp_send_json_error( |
| 219 |
__( |
| 220 |
'Token expired', |
| 221 |
'bit-form' |
| 222 |
), |
| 223 |
401 |
| 224 |
); |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
/** |
| 229 |
* Process ajax request for refesh crm layouts |
| 230 |
* |
| 231 |
* @return JSON crm layout data |
| 232 |
*/ |
| 233 |
public static function refreshTablesAjaxHelper() |
| 234 |
{ |
| 235 |
if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { |
| 236 |
$authorizationHeader = null; |
| 237 |
$inputJSON = file_get_contents('php://input'); |
| 238 |
$queryParams = json_decode($inputJSON); |
| 239 |
if ( |
| 240 |
empty($queryParams->workspace) |
| 241 |
|| empty($queryParams->tokenDetails) |
| 242 |
|| empty($queryParams->dataCenter) |
| 243 |
|| empty($queryParams->clientId) |
| 244 |
|| empty($queryParams->clientSecret) |
| 245 |
) { |
| 246 |
wp_send_json_error( |
| 247 |
__( |
| 248 |
'Requested parameter is empty', |
| 249 |
'bit-form' |
| 250 |
), |
| 251 |
400 |
| 252 |
); |
| 253 |
} |
| 254 |
$response = []; |
| 255 |
if ((intval($queryParams->tokenDetails->generates_on) + (55 * 60)) < time()) { |
| 256 |
$response['tokenDetails'] = ZohoAnalyticsHandler::_refreshAccessToken($queryParams); |
| 257 |
} |
| 258 |
|
| 259 |
$tablesMetaApiEndpoint = "https://analyticsapi.zoho.{$queryParams->dataCenter}/api/{$queryParams->ownerEmail}/{$queryParams->workspace}?ZOHO_ACTION=VIEWLIST&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=JSON&ZOHO_API_VERSION=1.0"; |
| 260 |
|
| 261 |
$authorizationHeader['Authorization'] = "Zoho-oauthtoken {$queryParams->tokenDetails->access_token}"; |
| 262 |
$tablesMetaResponse = HttpHelper::get($tablesMetaApiEndpoint, null, $authorizationHeader); |
| 263 |
|
| 264 |
$allTables = []; |
| 265 |
if (!is_wp_error($tablesMetaResponse)) { |
| 266 |
$tables = $tablesMetaResponse->response->result; |
| 267 |
foreach ($tables as $table) { |
| 268 |
if ('Table' === $table->viewType) { |
| 269 |
$allTables[] = $table->viewName; |
| 270 |
} |
| 271 |
} |
| 272 |
usort($allTables, 'strnatcasecmp'); |
| 273 |
$response['tables'] = $allTables; |
| 274 |
} else { |
| 275 |
wp_send_json_error( |
| 276 |
'error' === $fieldsMetaResponse->status ? $fieldsMetaResponse->message : 'Unknown', |
| 277 |
400 |
| 278 |
); |
| 279 |
} |
| 280 |
if (!empty($response['tokenDetails']) && $response['tokenDetails'] && !empty($queryParams->id)) { |
| 281 |
$response['queryWorkspace'] = $queryParams->workspace; |
| 282 |
ZohoAnalyticsHandler::_saveRefreshedToken($queryParams->formID, $queryParams->id, $response['tokenDetails'], $response); |
| 283 |
} |
| 284 |
wp_send_json_success($response, 200); |
| 285 |
} else { |
| 286 |
wp_send_json_error( |
| 287 |
__( |
| 288 |
'Token expired', |
| 289 |
'bit-form' |
| 290 |
), |
| 291 |
401 |
| 292 |
); |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
/** |
| 297 |
* Process ajax request for refesh crm layouts |
| 298 |
* |
| 299 |
* @return JSON crm layout data |
| 300 |
*/ |
| 301 |
public static function refreshTableHeadersAjaxHelper() |
| 302 |
{ |
| 303 |
if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { |
| 304 |
$authorizationHeader = null; |
| 305 |
$inputJSON = file_get_contents('php://input'); |
| 306 |
$queryParams = json_decode($inputJSON); |
| 307 |
if ( |
| 308 |
empty($queryParams->workspace) |
| 309 |
|| empty($queryParams->table) |
| 310 |
|| empty($queryParams->tokenDetails) |
| 311 |
|| empty($queryParams->dataCenter) |
| 312 |
|| empty($queryParams->clientId) |
| 313 |
|| empty($queryParams->clientSecret) |
| 314 |
) { |
| 315 |
wp_send_json_error( |
| 316 |
__( |
| 317 |
'Requested parameter is empty', |
| 318 |
'bit-form' |
| 319 |
), |
| 320 |
400 |
| 321 |
); |
| 322 |
} |
| 323 |
$response = []; |
| 324 |
if ((intval($queryParams->tokenDetails->generates_on) + (55 * 60)) < time()) { |
| 325 |
$response['tokenDetails'] = ZohoAnalyticsHandler::_refreshAccessToken($queryParams); |
| 326 |
} |
| 327 |
|
| 328 |
$tableHeadersMetaApiEndpoint = "https://analyticsapi.zoho.{$queryParams->dataCenter}/api/{$queryParams->ownerEmail}/{$queryParams->workspace}/{$queryParams->table}?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=JSON&ZOHO_API_VERSION=1.0"; |
| 329 |
|
| 330 |
$authorizationHeader['Authorization'] = "Zoho-oauthtoken {$queryParams->tokenDetails->access_token}"; |
| 331 |
$tableHeadersMetaResponse = HttpHelper::get($tableHeadersMetaApiEndpoint, null, $authorizationHeader); |
| 332 |
|
| 333 |
if ('string' === gettype($tableHeadersMetaResponse)) { |
| 334 |
$tableHeadersMetaResponse = json_decode(preg_replace("/\\\'/", "'", $tableHeadersMetaResponse)); |
| 335 |
} |
| 336 |
|
| 337 |
if (!is_wp_error($tableHeadersMetaResponse)) { |
| 338 |
$allHeaders = array_diff($tableHeadersMetaResponse->response->result->column_order, ['Auto Number']); |
| 339 |
usort($allHeaders, 'strnatcasecmp'); |
| 340 |
$response['table_headers'] = $allHeaders; |
| 341 |
} else { |
| 342 |
wp_send_json_error( |
| 343 |
'error' === $tableHeadersMetaResponse->status ? $tableHeadersMetaResponse->message : 'Unknown', |
| 344 |
400 |
| 345 |
); |
| 346 |
} |
| 347 |
if (!empty($response['tokenDetails']) && $response['tokenDetails'] && !empty($queryParams->id)) { |
| 348 |
$response['queryModule'] = $queryParams->module; |
| 349 |
ZohoAnalyticsHandler::_saveRefreshedToken($queryParams->formID, $queryParams->id, $response['tokenDetails'], $response); |
| 350 |
} |
| 351 |
wp_send_json_success($response, 200); |
| 352 |
} else { |
| 353 |
wp_send_json_error( |
| 354 |
__( |
| 355 |
'Token expired', |
| 356 |
'bit-form' |
| 357 |
), |
| 358 |
401 |
| 359 |
); |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
/** |
| 364 |
* Helps to refresh zoho crm access_token |
| 365 |
* |
| 366 |
* @param Array $apiData Contains required data for refresh access token |
| 367 |
* @return JSON $tokenDetails API token details |
| 368 |
*/ |
| 369 |
protected static function _refreshAccessToken($apiData) |
| 370 |
{ |
| 371 |
if ( |
| 372 |
empty($apiData->dataCenter) |
| 373 |
|| empty($apiData->clientId) |
| 374 |
|| empty($apiData->clientSecret) |
| 375 |
|| empty($apiData->tokenDetails) |
| 376 |
) { |
| 377 |
return false; |
| 378 |
} |
| 379 |
$tokenDetails = $apiData->tokenDetails; |
| 380 |
|
| 381 |
$dataCenter = $apiData->dataCenter; |
| 382 |
$apiEndpoint = "https://accounts.zoho.{$dataCenter}/oauth/v2/token"; |
| 383 |
$requestParams = [ |
| 384 |
'grant_type' => 'refresh_token', |
| 385 |
'client_id' => $apiData->clientId, |
| 386 |
'client_secret' => $apiData->clientSecret, |
| 387 |
'refresh_token' => $tokenDetails->refresh_token, |
| 388 |
]; |
| 389 |
|
| 390 |
$apiResponse = HttpHelper::post($apiEndpoint, $requestParams); |
| 391 |
if (is_wp_error($apiResponse) || !empty($apiResponse->error)) { |
| 392 |
return false; |
| 393 |
} |
| 394 |
$tokenDetails->generates_on = \time(); |
| 395 |
$tokenDetails->access_token = $apiResponse->access_token; |
| 396 |
return $tokenDetails; |
| 397 |
} |
| 398 |
|
| 399 |
/** |
| 400 |
* Save updated access_token to avoid unnecessary token generation |
| 401 |
* |
| 402 |
* @param Integer $fromID ID of Integration related form |
| 403 |
* @param Integer $integrationID ID of Zoho crm Integration |
| 404 |
* @param Obeject $tokenDetails refreshed token info |
| 405 |
* |
| 406 |
* @return null |
| 407 |
*/ |
| 408 |
protected static function _saveRefreshedToken($formID, $integrationID, $tokenDetails, $others = null) |
| 409 |
{ |
| 410 |
if (empty($formID) || empty($integrationID)) { |
| 411 |
return; |
| 412 |
} |
| 413 |
|
| 414 |
$integrationHandler = new IntegrationHandler($formID, IpTool::getUserDetail()); |
| 415 |
$zanalyticsDetails = $integrationHandler->getAIntegration($integrationID); |
| 416 |
|
| 417 |
if (is_wp_error($zanalyticsDetails)) { |
| 418 |
return; |
| 419 |
} |
| 420 |
$newDetails = json_decode($zanalyticsDetails[0]->integration_details); |
| 421 |
|
| 422 |
$newDetails->tokenDetails = $tokenDetails; |
| 423 |
if (!empty($others['workspaces'])) { |
| 424 |
$newDetails->default->workspaces = $others['workspaces']; |
| 425 |
} |
| 426 |
if (!empty($others['tables'])) { |
| 427 |
$newDetails->default->tables = $others['tables']; |
| 428 |
} |
| 429 |
if (!empty($others['table_headers'])) { |
| 430 |
$newDetails->default->tables->headers->{$others['table']} = $others['table_headers']; |
| 431 |
} |
| 432 |
|
| 433 |
$integrationHandler->updateIntegration($integrationID, $zanalyticsDetails[0]->integration_name, 'Zoho Analytics', \json_encode($newDetails), 'form'); |
| 434 |
} |
| 435 |
|
| 436 |
public function execute(IntegrationHandler $integrationHandler, $integrationData, $fieldValues, $entryID, $logID) |
| 437 |
{ |
| 438 |
$integrationDetails = is_string($integrationData->integration_details) ? json_decode($integrationData->integration_details) : $integrationData->integration_details; |
| 439 |
|
| 440 |
$tokenDetails = $integrationDetails->tokenDetails; |
| 441 |
$workspace = $integrationDetails->workspace; |
| 442 |
$table = $integrationDetails->table; |
| 443 |
$ownerEmail = $integrationDetails->ownerEmail; |
| 444 |
$dataCenter = $integrationDetails->dataCenter; |
| 445 |
$fieldMap = $integrationDetails->field_map; |
| 446 |
$actions = $integrationDetails->actions; |
| 447 |
$defaultDataConf = $integrationDetails->default; |
| 448 |
if ( |
| 449 |
empty($tokenDetails) |
| 450 |
|| empty($workspace) |
| 451 |
|| empty($table) |
| 452 |
|| empty($fieldMap) |
| 453 |
) { |
| 454 |
$error = new WP_Error('REQ_FIELD_EMPTY', __('workspace, table, fields are required for zoho analytics api', 'bit-form')); |
| 455 |
$this->_logResponse->apiResponse($logID, $this->_integrationID, 'record', 'validation', $error); |
| 456 |
return $error; |
| 457 |
} |
| 458 |
|
| 459 |
$requiredParams = null; |
| 460 |
if ((intval($tokenDetails->generates_on) + (55 * 60)) < time()) { |
| 461 |
$requiredParams['clientId'] = $integrationDetails->clientId; |
| 462 |
$requiredParams['clientSecret'] = $integrationDetails->clientSecret; |
| 463 |
$requiredParams['dataCenter'] = $integrationDetails->dataCenter; |
| 464 |
$requiredParams['tokenDetails'] = $tokenDetails; |
| 465 |
$newTokenDetails = ZohoAnalyticsHandler::_refreshAccessToken((object)$requiredParams); |
| 466 |
if ($newTokenDetails) { |
| 467 |
ZohoAnalyticsHandler::_saveRefreshedToken($this->_formID, $this->_integrationID, $newTokenDetails); |
| 468 |
$tokenDetails = $newTokenDetails; |
| 469 |
} |
| 470 |
} |
| 471 |
|
| 472 |
// $actions = $integrationDetails->actions; |
| 473 |
$recordApiHelper = new RecordApiHelper($tokenDetails, $this->_integrationID, $logID); |
| 474 |
|
| 475 |
$zanalyticsApiResponse = $recordApiHelper->executeRecordApi( |
| 476 |
$workspace, |
| 477 |
$table, |
| 478 |
$ownerEmail, |
| 479 |
$dataCenter, |
| 480 |
$actions, |
| 481 |
$defaultDataConf, |
| 482 |
$fieldValues, |
| 483 |
$fieldMap |
| 484 |
); |
| 485 |
|
| 486 |
if (is_wp_error($zanalyticsApiResponse)) { |
| 487 |
return $zanalyticsApiResponse; |
| 488 |
} |
| 489 |
return $zanalyticsApiResponse; |
| 490 |
} |
| 491 |
} |
| 492 |
|