From 55a6e815286e89e1f756035d8e8f5b6d0fedadff Mon Sep 17 00:00:00 2001 From: pro Date: Fri, 23 Jan 2026 20:23:25 +0900 Subject: [PATCH] =?UTF-8?q?fix:=ED=99=88=ED=83=9D=EC=8A=A4=20API=20CorpNum?= =?UTF-8?q?=EC=9D=84=20=ED=8C=8C=ED=8A=B8=EB=84=88=EC=82=AC=20=EC=82=AC?= =?UTF-8?q?=EC=97=85=EC=9E=90=EB=B2=88=ED=98=B8=EB=A1=9C=20=EB=B3=B5?= =?UTF-8?q?=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CorpNum은 파트너사 인증용 (CERTKEY와 매칭) - UserID만 테넌트별 바로빌 ID 사용 - 카드 API와 동일한 구조로 통일 Co-Authored-By: Claude Opus 4.5 --- .../Barobill/HometaxController.php | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/Barobill/HometaxController.php b/app/Http/Controllers/Barobill/HometaxController.php index daa4ec7c..687e21ad 100644 --- a/app/Http/Controllers/Barobill/HometaxController.php +++ b/app/Http/Controllers/Barobill/HometaxController.php @@ -108,17 +108,16 @@ public function sales(Request $request): JsonResponse } $userId = $barobillMember->barobill_id ?? ''; - $memberCorpNum = $barobillMember->biz_no ?? ''; - if (empty($memberCorpNum)) { + if (empty($userId)) { return response()->json([ 'success' => false, - 'error' => '테넌트의 사업자번호가 설정되지 않았습니다.' + 'error' => '바로빌 사용자 ID가 설정되지 않았습니다.' ]); } $result = $this->callSoap('GetPeriodTaxInvoiceSalesList', [ - 'CorpNum' => $memberCorpNum, // 테넌트의 사업자번호 사용 + // CorpNum은 callSoap에서 파트너사 사업자번호로 자동 설정 'UserID' => $userId, 'TaxType' => $taxType, 'DateType' => 1, // 1:작성일 기준 @@ -209,17 +208,16 @@ public function purchases(Request $request): JsonResponse } $userId = $barobillMember->barobill_id ?? ''; - $memberCorpNum = $barobillMember->biz_no ?? ''; - if (empty($memberCorpNum)) { + if (empty($userId)) { return response()->json([ 'success' => false, - 'error' => '테넌트의 사업자번호가 설정되지 않았습니다.' + 'error' => '바로빌 사용자 ID가 설정되지 않았습니다.' ]); } $result = $this->callSoap('GetPeriodTaxInvoicePurchaseList', [ - 'CorpNum' => $memberCorpNum, // 테넌트의 사업자번호 사용 + // CorpNum은 callSoap에서 파트너사 사업자번호로 자동 설정 'UserID' => $userId, 'TaxType' => $taxType, 'DateType' => 1, // 1:작성일 기준 @@ -305,10 +303,8 @@ public function getScrapRequestUrl(Request $request): JsonResponse } $userId = $barobillMember->barobill_id ?? ''; - $memberCorpNum = $barobillMember->biz_no ?? ''; $result = $this->callSoap('GetTaxInvoiceScrapRequestURL', [ - 'CorpNum' => $memberCorpNum, 'UserID' => $userId ]); @@ -370,10 +366,8 @@ public function refreshScrap(Request $request): JsonResponse } $userId = $barobillMember->barobill_id ?? ''; - $memberCorpNum = $barobillMember->biz_no ?? ''; $result = $this->callSoap('RefreshTaxInvoiceScrap', [ - 'CorpNum' => $memberCorpNum, 'UserID' => $userId ]); @@ -429,13 +423,13 @@ public function diagnose(Request $request): JsonResponse $diagnostics = [ 'config' => [ 'certKey' => !empty($this->certKey) ? substr($this->certKey, 0, 8) . '...' : '미설정', - 'partnerCorpNum' => $this->corpNum ?? '미설정', // 파트너사 사업자번호 + 'corpNum' => $this->corpNum ?? '미설정', // 파트너사 사업자번호 (API 인증용) 'isTestMode' => $this->isTestMode, 'baseUrl' => $this->baseUrl ], 'member' => [ - 'userId' => $userId ?: '미설정', - 'bizNo' => $memberCorpNum ?: '미설정', // 테넌트 사업자번호 (실제 API 호출에 사용) + 'userId' => $userId ?: '미설정', // 테넌트의 바로빌 ID (API 호출에 사용) + 'bizNo' => $memberCorpNum ?: '미설정', // 테넌트 사업자번호 (참고용) 'corpName' => $barobillMember?->corp_name ?? '미설정' ], 'tests' => [] @@ -443,7 +437,6 @@ public function diagnose(Request $request): JsonResponse // 테스트 1: 홈택스 스크래핑 URL 조회 (서비스 활성화 확인용) $scrapUrlResult = $this->callSoap('GetTaxInvoiceScrapRequestURL', [ - 'CorpNum' => $memberCorpNum, 'UserID' => $userId ]); $diagnostics['tests']['scrapRequestUrl'] = [ @@ -456,7 +449,6 @@ public function diagnose(Request $request): JsonResponse // 테스트 2: 매출 세금계산서 조회 (기간: 최근 1개월) $salesResult = $this->callSoap('GetPeriodTaxInvoiceSalesList', [ - 'CorpNum' => $memberCorpNum, // 테넌트 사업자번호 사용 'UserID' => $userId, 'TaxType' => 0, 'DateType' => 1, @@ -477,7 +469,6 @@ public function diagnose(Request $request): JsonResponse // 테스트 3: 회원사 로그인 URL 조회 (기본 연결 확인용) $loginUrlResult = $this->callSoap('GetLoginURL', [ - 'CorpNum' => $memberCorpNum, 'UserID' => $userId ]); $diagnostics['tests']['loginUrl'] = [ @@ -829,7 +820,7 @@ private function callSoap(string $method, array $params = []): array } try { - Log::info("바로빌 API 호출 (HTTP) - Method: {$method}, CorpNum: {$this->corpNum}, CERTKEY: " . substr($params['CERTKEY'] ?? '', 0, 20) . "..., UserID: " . ($params['UserID'] ?? 'N/A')); + Log::info("바로빌 홈택스 API 호출 - Method: {$method}, CorpNum: " . ($params['CorpNum'] ?? 'N/A') . ", UserID: " . ($params['UserID'] ?? 'N/A') . ", CERTKEY: " . substr($params['CERTKEY'] ?? '', 0, 10) . "..."); // SOAP 요청 XML 생성 $soapXml = $this->buildSoapRequest($method, $params);