diff --git a/app/Http/Controllers/Barobill/EaccountController.php b/app/Http/Controllers/Barobill/EaccountController.php index 55540f66..b3d81894 100644 --- a/app/Http/Controllers/Barobill/EaccountController.php +++ b/app/Http/Controllers/Barobill/EaccountController.php @@ -131,32 +131,31 @@ public function index(Request $request): View|Response private function applyMemberServerMode(BarobillMember $member): void { $memberTestMode = $member->isTestMode(); + $targetEnv = $memberTestMode ? 'test' : 'production'; - // 현재 모드와 다르면 재설정 - if ($this->isTestMode !== $memberTestMode) { + // 해당 환경의 BarobillConfig 조회 (is_active 무관하게 환경에 맞는 설정 사용) + $config = BarobillConfig::where('environment', $targetEnv)->first(); + + if ($config) { $this->isTestMode = $memberTestMode; - - // 해당 모드의 BarobillConfig 조회 - $config = BarobillConfig::where('environment', $memberTestMode ? 'test' : 'production') - ->where('is_active', true) - ->first(); - - if ($config) { - $this->certKey = $config->cert_key; - $this->corpNum = $config->corp_num; - $baseUrl = $memberTestMode - ? 'https://testws.baroservice.com' - : 'https://ws.baroservice.com'; - $this->soapUrl = $baseUrl . '/BANKACCOUNT.asmx?WSDL'; - } else { - // 설정이 없으면 기본 URL 사용 - $this->soapUrl = $memberTestMode - ? 'https://testws.baroservice.com/BANKACCOUNT.asmx?WSDL' - : 'https://ws.baroservice.com/BANKACCOUNT.asmx?WSDL'; - } + $this->certKey = $config->cert_key; + $this->corpNum = $config->corp_num; + $baseUrl = $config->base_url ?: ($memberTestMode + ? 'https://testws.baroservice.com' + : 'https://ws.baroservice.com'); + $this->soapUrl = $baseUrl . '/BANKACCOUNT.asmx?WSDL'; // SOAP 클라이언트 재초기화 $this->initSoapClient(); + + Log::info('[Eaccount] 서버 모드 적용', [ + 'targetEnv' => $targetEnv, + 'certKey' => substr($this->certKey ?? '', 0, 10) . '...', + 'corpNum' => $this->corpNum, + 'soapUrl' => $this->soapUrl, + ]); + } else { + Log::warning('[Eaccount] BarobillConfig 없음', ['targetEnv' => $targetEnv]); } } diff --git a/app/Http/Controllers/Barobill/EcardController.php b/app/Http/Controllers/Barobill/EcardController.php index 45cc6b44..e0c471e6 100644 --- a/app/Http/Controllers/Barobill/EcardController.php +++ b/app/Http/Controllers/Barobill/EcardController.php @@ -131,32 +131,31 @@ public function index(Request $request): View|Response private function applyMemberServerMode(BarobillMember $member): void { $memberTestMode = $member->isTestMode(); + $targetEnv = $memberTestMode ? 'test' : 'production'; - // 현재 모드와 다르면 재설정 - if ($this->isTestMode !== $memberTestMode) { + // 해당 환경의 BarobillConfig 조회 (is_active 무관하게 환경에 맞는 설정 사용) + $config = BarobillConfig::where('environment', $targetEnv)->first(); + + if ($config) { $this->isTestMode = $memberTestMode; - - // 해당 모드의 BarobillConfig 조회 - $config = BarobillConfig::where('environment', $memberTestMode ? 'test' : 'production') - ->where('is_active', true) - ->first(); - - if ($config) { - $this->certKey = $config->cert_key; - $this->corpNum = $config->corp_num; - $baseUrl = $memberTestMode - ? 'https://testws.baroservice.com' - : 'https://ws.baroservice.com'; - $this->soapUrl = $baseUrl . '/CARD.asmx?WSDL'; - } else { - // 설정이 없으면 기본 URL 사용 - $this->soapUrl = $memberTestMode - ? 'https://testws.baroservice.com/CARD.asmx?WSDL' - : 'https://ws.baroservice.com/CARD.asmx?WSDL'; - } + $this->certKey = $config->cert_key; + $this->corpNum = $config->corp_num; + $baseUrl = $config->base_url ?: ($memberTestMode + ? 'https://testws.baroservice.com' + : 'https://ws.baroservice.com'); + $this->soapUrl = $baseUrl . '/CARD.asmx?WSDL'; // SOAP 클라이언트 재초기화 $this->initSoapClient(); + + Log::info('[Ecard] 서버 모드 적용', [ + 'targetEnv' => $targetEnv, + 'certKey' => substr($this->certKey ?? '', 0, 10) . '...', + 'corpNum' => $this->corpNum, + 'soapUrl' => $this->soapUrl, + ]); + } else { + Log::warning('[Ecard] BarobillConfig 없음', ['targetEnv' => $targetEnv]); } } diff --git a/app/Http/Controllers/Barobill/EtaxController.php b/app/Http/Controllers/Barobill/EtaxController.php index ea36de19..8fc60f55 100644 --- a/app/Http/Controllers/Barobill/EtaxController.php +++ b/app/Http/Controllers/Barobill/EtaxController.php @@ -123,29 +123,31 @@ public function index(Request $request): View|Response private function applyMemberServerMode(BarobillMember $member): void { $memberTestMode = $member->isTestMode(); + $targetEnv = $memberTestMode ? 'test' : 'production'; - // 현재 모드와 다르면 재설정 - if ($this->isTestMode !== $memberTestMode) { + // 해당 환경의 BarobillConfig 조회 (is_active 무관하게 환경에 맞는 설정 사용) + $config = BarobillConfig::where('environment', $targetEnv)->first(); + + if ($config) { $this->isTestMode = $memberTestMode; - - // 해당 모드의 BarobillConfig 조회 - $config = BarobillConfig::where('environment', $memberTestMode ? 'test' : 'production') - ->where('is_active', true) - ->first(); - - if ($config) { - $this->certKey = $config->cert_key; - $this->corpNum = $config->corp_num; - $this->soapUrl = $config->base_url . '/TI.asmx?WSDL'; - } else { - // 설정이 없으면 기본 URL 사용 - $this->soapUrl = $memberTestMode - ? 'https://testws.baroservice.com/TI.asmx?WSDL' - : 'https://ws.baroservice.com/TI.asmx?WSDL'; - } + $this->certKey = $config->cert_key; + $this->corpNum = $config->corp_num; + $baseUrl = $config->base_url ?: ($memberTestMode + ? 'https://testws.baroservice.com' + : 'https://ws.baroservice.com'); + $this->soapUrl = $baseUrl . '/TI.asmx?WSDL'; // SOAP 클라이언트 재초기화 $this->initSoapClient(); + + Log::info('[Etax] 서버 모드 적용', [ + 'targetEnv' => $targetEnv, + 'certKey' => substr($this->certKey ?? '', 0, 10) . '...', + 'corpNum' => $this->corpNum, + 'soapUrl' => $this->soapUrl, + ]); + } else { + Log::warning('[Etax] BarobillConfig 없음', ['targetEnv' => $targetEnv]); } } diff --git a/app/Http/Controllers/Barobill/HometaxController.php b/app/Http/Controllers/Barobill/HometaxController.php index 2219bf48..614dab8e 100644 --- a/app/Http/Controllers/Barobill/HometaxController.php +++ b/app/Http/Controllers/Barobill/HometaxController.php @@ -132,31 +132,30 @@ public function index(Request $request): View|Response private function applyMemberServerMode(BarobillMember $member): void { $memberTestMode = $member->isTestMode(); + $targetEnv = $memberTestMode ? 'test' : 'production'; - // 현재 모드와 다르면 재설정 - if ($this->isTestMode !== $memberTestMode) { + // 해당 환경의 BarobillConfig 조회 (is_active 무관하게 환경에 맞는 설정 사용) + $config = BarobillConfig::where('environment', $targetEnv)->first(); + + if ($config) { $this->isTestMode = $memberTestMode; - - // 해당 모드의 BarobillConfig 조회 - $config = BarobillConfig::where('environment', $memberTestMode ? 'test' : 'production') - ->where('is_active', true) - ->first(); - - if ($config) { - $this->certKey = $config->cert_key; - $this->corpNum = $config->corp_num; - $this->baseUrl = $memberTestMode - ? 'https://testws.baroservice.com' - : 'https://ws.baroservice.com'; - } else { - // 설정이 없으면 기본 URL 사용 - $this->baseUrl = $memberTestMode - ? 'https://testws.baroservice.com' - : 'https://ws.baroservice.com'; - } + $this->certKey = $config->cert_key; + $this->corpNum = $config->corp_num; + $this->baseUrl = $config->base_url ?: ($memberTestMode + ? 'https://testws.baroservice.com' + : 'https://ws.baroservice.com'); // SOAP 클라이언트 재초기화 $this->initSoapClient(); + + Log::info('[Hometax] 서버 모드 적용', [ + 'targetEnv' => $targetEnv, + 'certKey' => substr($this->certKey ?? '', 0, 10) . '...', + 'corpNum' => $this->corpNum, + 'baseUrl' => $this->baseUrl, + ]); + } else { + Log::warning('[Hometax] BarobillConfig 없음', ['targetEnv' => $targetEnv]); } }