<?php
if (!defined('ROOT_PATH')) {
    define('ROOT_PATH', dirname(__DIR__) . '/');
}

$premiumFile = ROOT_PATH . 'modules-premium/pro/payment/api.php';
if (!is_file($premiumFile)) {
    require_once ROOT_PATH . 'core/lib/license.php';
    require_once ROOT_PATH . 'core/lib/license_guard.php';
    require_once ROOT_PATH . 'core/lib/module_loader.php';
    $license = new \Core\Lib\License();
    if ($license->getLevel() > \Core\Lib\License::LEVEL_FREE) {
        $loader = new \Core\Lib\ModuleLoader($license);
        $loader->syncAuthorizedModules();
    }
}

if (!is_file($premiumFile)) {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode(array(
        'code' => 403,
        'msg' => '当前站点未安装支付模块，请联系管理员处理'
    ), JSON_UNESCAPED_UNICODE);
    exit;
}

require $premiumFile;
