* @brief KCP PG(Payment Gateway) Helper */ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access"); if(!function_exists("get_pgkcp_config")) { function get_pgkcp_config() { $pgkcp_config = array(); // include configuration file $inc_file = get_current_working_dir() . "/vendor/pgkcp/cfg/site_conf_inc.php"; if(file_exists($inc_file)) { include($inc_file); $pgkcp_config = array( "g_conf_home_dir" => $g_conf_home_dir, "g_conf_log_path" => $g_conf_log_path, "g_conf_gw_url" => $g_conf_gw_url, "g_conf_js_url" => $g_conf_js_url, "g_wsdl" => $g_wsdl, "g_conf_site_cd" => $g_conf_site_cd, "g_conf_site_key" => $g_conf_site_key, "g_conf_site_name" => $g_conf_site_name, "g_conf_log_level" => $g_conf_log_level, "g_conf_gw_port" => $g_conf_gw_port, "module_type" => $module_type, ); } else { set_error("PGKCP configuration file does not exists."); show_errors(); } // check installed platform $platform = get_pgkcp_platform($pgkcp_config); if(empty($platform)) { set_error("pp_cli or pp_cli.exe file not found"); show_errors(); } else { $pgkcp_config['g_conf_platform'] = $platform; } return $pgkcp_config; } } if(!function_exists("get_pgkcp_platform")) { function get_pgkcp_platform($pgkcp_config) { $platform = false; $exe_files = array( "linux" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli", "windows" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli.exe" ); foreach($exe_files as $k=>$v) { if(file_exists($v)) { $platform = $k; break; } } return $platform; } } if(!function_exists("load_pgkcp_library")) { function load_pgkcp_library() { $inc_file = get_current_working_dir() . "/vendor/pgkcp/res/pp_cli_hub_lib.php"; if(file_exists($inc_file)) { include($inc_file); } else { set_error("PGKCP payment library file does not exists."); show_errors(); } } }