public function checkSynchStatus($saveTime = false) { if ($this->shipperDataHelper->getConfigValue('carriers/shipper/active')) { $synchCheckUrl = $this->restHelper->getCheckSynchronizedUrl(); $result = $this->send($synchCheckUrl); $synchResult = $result['result']; $debugData = array('result' => json_decode($result['debug']['response']), 'url' => $result['debug']['url']); $this->shipperLogger->postDebug('Shipperhq_Shipper', 'Check synchronized status', $debugData); if (!empty($synchResult->errors)) { $this->shipperLogger->postWarning('Shipperhq_Shipper', 'Check synchronized status failed. Error: ', $synchResult->errors); return false; } if (!isset($synchResult->responseSummary) || $synchResult->responseSummary->status != 1) { $this->shipperLogger->postWarning('Shipperhq_Shipper', 'Check Synchronized Status failed with no error. ', $synchResult); return false; } $currentVal = $this->shipperDataHelper->getConfigValue($this->shipperDataHelper->getLastSyncPath()); $latestSync = $synchResult->lastSynchronization; $result = $latestSync == $currentVal ? '1' : "Required"; if ($saveTime) { $this->carrierConfigHandler->saveConfig($this->shipperDataHelper->getLastSyncPath(), $latestSync, 'default', 0, false); } return $result; } }