getRequest()->getParam('license')); $moduleName = $this->getRequest()->getParam('module_name'); try { $license = $this->licenseFactory->create(); $license->load($moduleName, 'module_name'); $license->setModuleName($moduleName); $license->setLicenseKey($lcK); $license->save(); $license->updMdsInf(); $result['error'] = false; $result['license'] = $lcK; $result['module_name'] = $moduleName; $licenseValidity = $license->isLcVd($lcK, $moduleName); $result['is_valid'] = ($licenseValidity) ? 'license-status-ok' : 'license-status-nok'; $result['is_valid_msg'] = ($licenseValidity) ? __('Valid') : __('Invalid'); $result['message'] = __('The license key was successfully updated.'); $result['message'] .= "

"; if ($licenseValidity) { $result['message'] .= '
' . __('The license key introduced is valid') . '
'; } else { $userFriendlyNames = $license->getUserFriendlyModuleNames(); $options = []; $options['module_name'] = $moduleName; $options['license'] = $lcK; $licenseErrorMessage = $this->wpHelper->getLicenseErrorMessage($options, $userFriendlyNames, false); $result['message'] .= '
' . __('The license key you entered is invalid.') . '
' . $licenseErrorMessage . '

' . '' . __('Common reasons:') . '
' . __('- Wrong domain name - check active license domain under My Downloadable Products section of your weltpixel.com account. License allows using the product on one Magento installation with any number of store views / URLs. Product can be installed on up to 5 sub-domains of the licensed domain for testing purpose, including domains .local | .localhost | .localdev | .dev | .development | .staging | .stage Ex: staging.domain.com, development.domain.com, domain.local, domain.dev etc..') . '

' . __('- Wrong Magento edition - using a Magento Open Source license key for a Magento Commerce installation.') . '

' . __('- Wrong module - using a license key from a different product or product pack.'); } } catch (\Exception $ex) { $result['error'] = true; $result['message'] = __('There was a problem with the license key saving.') . ' ' . $ex->getMessage(); } $resultJson = $this->resultJsonFactory->create(); $resultJson->setData($result); return $resultJson; } }