etax 서버환경으로 수정

This commit is contained in:
2025-12-16 16:22:30 +09:00
parent 5e786c26a1
commit 1d79a2989b
11 changed files with 223 additions and 212 deletions

View File

@@ -3,12 +3,10 @@ header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
// 바로빌 API 설정 로드
try {
require_once(__DIR__ . '/barobill_config.php');
// POST 데이터 읽기
$input = json_decode(file_get_contents('php://input'), true);
require_once(__DIR__ . '/barobill_config.php');
// POST 데이터 읽기
$input = json_decode(file_get_contents('php://input'), true);
if (!$input) {
http_response_code(400);
@@ -145,7 +143,6 @@ if ($useRealAPI) {
}
} else {
// 시뮬레이션 모드 (API 키가 없을 때)
// 시뮬레이션 모드 코드 (변경 없음)
$issueKey = "BARO-" . date('Y') . "-" . str_pad(rand(1, 9999), 4, '0', STR_PAD_LEFT);
$newInvoice = [
@@ -224,24 +221,6 @@ if ($useRealAPI) {
usleep(500000); // 0.5초 지연 시뮬레이션
}
$jsonOutput = json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
if ($jsonOutput === false) {
throw new Exception("JSON Encoding Error: " . json_last_error_msg());
}
echo $jsonOutput;
} catch (Throwable $e) {
error_log("API Error: " . $e->getMessage() . "\n" . $e->getTraceAsString());
http_response_code(500);
echo json_encode([
"success" => false,
"error" => "Internal Server Error: " . $e->getMessage(),
"debug" => [
"file" => $e->getFile(),
"line" => $e->getLine()
]
], JSON_UNESCAPED_UNICODE);
}
echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
?>