feat:바로빌 CERT_KEY 테스트/운영 모드 분리

- BAROBILL_CERT_KEY_TEST: 테스트 환경용
- BAROBILL_CERT_KEY_PROD: 운영 환경용
- BAROBILL_TEST_MODE에 따라 자동 선택

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
pro
2026-01-23 10:50:46 +09:00
parent 925e22a4c4
commit d212956f25
2 changed files with 15 additions and 7 deletions

View File

@@ -96,8 +96,8 @@ class BarobillService
public function __construct()
{
// .env에서 테스트 모드 설정 가져오기 (기본값)
$this->isTestMode = config('services.barobill.test_mode', false);
// .env에서 테스트 모드 설정 가져오기 (기본값: true = 테스트 모드)
$this->isTestMode = config('services.barobill.test_mode', true);
// DB에서 활성화된 설정 가져오기 (우선순위)
$dbConfig = $this->loadConfigFromDatabase();
@@ -108,7 +108,10 @@ public function __construct()
$this->soapUrls = $this->buildSoapUrls($dbConfig->base_url);
} else {
// DB 설정이 없으면 .env에서 가져오기 (fallback)
$this->certKey = config('services.barobill.cert_key', '');
// 테스트 모드에 따라 적절한 CERT_KEY 선택
$this->certKey = $this->isTestMode
? config('services.barobill.cert_key_test', '')
: config('services.barobill.cert_key_prod', '');
$this->corpNum = config('services.barobill.corp_num', '');
$baseUrl = $this->isTestMode
? 'https://testws.baroservice.com'
@@ -635,8 +638,11 @@ public function checkConfiguration(): array
return [
'cert_key_set' => !empty($this->certKey),
'cert_key_test_set' => !empty(config('services.barobill.cert_key_test')),
'cert_key_prod_set' => !empty(config('services.barobill.cert_key_prod')),
'corp_num_set' => !empty($this->corpNum),
'test_mode' => $this->isTestMode,
'mode_label' => $this->isTestMode ? '테스트' : '운영',
'soap_url' => $this->soapUrls['corpstate'],
'config_source' => $dbConfig ? 'database' : 'env',
'db_config_name' => $dbConfig?->name,

View File

@@ -54,16 +54,18 @@
| 바로빌 API
|--------------------------------------------------------------------------
| 바로빌 SOAP 웹서비스 연동 설정
| - cert_key: 바로빌 개발자센터에서 발급받은 CERTKEY
| - cert_key_test: 테스트 환경용 CERTKEY
| - cert_key_prod: 운영 환경용 CERTKEY
| - corp_num: 파트너 사업자번호 (하이픈 제외)
| - test_mode: 테스트 환경 사용 여부
| - test_mode: 테스트 환경 사용 여부 (true: 테스트, false: 운영)
|
| @see https://dev.barobill.co.kr/
*/
'barobill' => [
'cert_key' => env('BAROBILL_CERT_KEY', ''),
'cert_key_test' => env('BAROBILL_CERT_KEY_TEST', ''),
'cert_key_prod' => env('BAROBILL_CERT_KEY_PROD', ''),
'corp_num' => env('BAROBILL_CORP_NUM', ''),
'test_mode' => env('BAROBILL_TEST_MODE', false),
'test_mode' => env('BAROBILL_TEST_MODE', true),
],
/*