/** * Get the Mollie client. Needs the Config object to retrieve the API key. * * @param Config $config * * @return Mollie_API_Client */ public static function getAPIClient($config) { if (!self::$api_client && self::apiClientFound()) { require_once realpath(DIR_SYSTEM . "/..") . "/catalog/controller/payment/mollie-api-client/src/Mollie/API/Autoloader.php"; $mollie = new Mollie_API_Client(); $mollie->setApiKey($config->get('mollie_api_key')); $mollie->addVersionString("OpenCart/" . VERSION); $mollie->addVersionString("MollieOpenCart/" . self::PLUGIN_VERSION); self::$api_client = $mollie; } return self::$api_client; }
/** * @return Mollie_API_Client */ protected function getAPIClient() { return MollieHelper::getAPIClient($this->config); }
protected function checkModuleStatus() { $need_files = array(); if ($this->isOpencart22()) { $mod_files = array(DIR_APPLICATION . "controller/extension/payment/mollie/base.php", DIR_APPLICATION . "language/en-gb/extension/payment/mollie.php", DIR_TEMPLATE . "extension/payment/mollie.tpl", DIR_TEMPLATE . "extension/payment/mollie_2.tpl", DIR_CATALOG . "controller/extension/payment/mollie-api-client/", DIR_CATALOG . "controller/extension/payment/mollie/base.php", DIR_CATALOG . "language/en-gb/extension/payment/mollie.php", DIR_CATALOG . "model/extension/payment/mollie/base.php", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_checkout_form.tpl", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_return.tpl", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_return_2.tpl"); } else { $mod_files = array(DIR_APPLICATION . "controller/extension/payment/mollie/base.php", DIR_APPLICATION . "language/english/extension/payment/mollie.php", DIR_TEMPLATE . "extension/payment/mollie.tpl", DIR_TEMPLATE . "extension/payment/mollie_2.tpl", DIR_CATALOG . "controller/extension/payment/mollie-api-client/", DIR_CATALOG . "controller/extension/payment/mollie/base.php", DIR_CATALOG . "language/english/extension/payment/mollie.php", DIR_CATALOG . "model/extension/payment/mollie/base.php", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_checkout_form.tpl", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_return.tpl", DIR_CATALOG . "view/theme/default/template/extension/payment/mollie_return_2.tpl"); } foreach (MollieHelper::$MODULE_NAMES as $module_name) { if ($this->isOpencart22()) { $mod_files[] = DIR_APPLICATION . "controller/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_APPLICATION . "language/en-gb/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_CATALOG . "controller/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_CATALOG . "model/extension/payment/mollie_" . $module_name . ".php"; } else { $mod_files[] = DIR_APPLICATION . "controller/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_APPLICATION . "language/english/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_CATALOG . "controller/extension/payment/mollie_" . $module_name . ".php"; $mod_files[] = DIR_CATALOG . "model/extension/payment/mollie_" . $module_name . ".php"; } } foreach ($mod_files as $file) { $realpath = realpath($file); if (!file_exists($realpath)) { $need_files[] = '<span style="color:red">' . $file . '</span>'; } } if (!MollieHelper::apiClientFound()) { $need_files[] = '<span style="color:red">' . 'API client not found. Please make sure you have installed the module correctly. Use the download ' . 'button on the <a href="https://github.com/mollie/OpenCart/releases/latest" target="_blank">release page</a>' . '</span>'; } if (count($need_files) > 0) { return $need_files; } return '<span style="color:green">OK</span>'; }