request = $request; $this->resource = $resource; $this->ordershipment = $ordershipment; $this->helper = $helper; $this->json = $json; $this->logger = $logger; $this->netsuiteupdateinvoicepdf = $netsuiteupdateinvoicepdf; } public function createProduct() { if ($this->helper->getNetSuiteIsEnabled()) { $this->logger->initLog(NetSuiteConstants::NETSUITE_CREATE_UPDATEPDF_LOG_FILENAME); $this->logger->writeLog('----------------------------'); $this->logger->writeLog('Create Product Started'); $this->logger->writeLog('----------------------------'); $this->logger->writeLog(''); $postData = $this->request->getBodyParams(); try { if ($postData['sku']) { $this->logger->writeLog('Product Sku: '.$postData['sku']); if (!$postData['sku'] || !$postData['name'] || !$postData['price']) { $this->logger->writeLog('Please add required fields'); $responseData['success'] = false; $responseData['message'] = "Please add required fields"; return [$responseData]; } } else { $this->logger->writeLog('Sku field can\'t be empty'); $responseData['success'] = false; $responseData['message'] = "Sku field can't be empty"; } } catch (Exception $e) { $responseData['success'] = false; $responseData['message'] = 'Exception : '.$e->getMessage(); $this->logger->writeLog('Exception: '.$e->getMessage()); } $this->logger->writeLog(''); $this->logger->writeLog('----------------------------'); $this->logger->writeLog('Create Product Stopped'); $this->logger->writeLog('----------------------------'); } return [$responseData]; } public function getordershipment(string $incrementshipId) { $shipId = 0; try { $shipment = $this->ordershipment->loadByIncrementId($incrementshipId); $shipId = $shipment->getId(); return $shipId; } catch (Exception $e) { return $shipId; } } }