fix:홈택스 API CorpNum을 파트너사 사업자번호로 복원
- CorpNum은 파트너사 인증용 (CERTKEY와 매칭) - UserID만 테넌트별 바로빌 ID 사용 - 카드 API와 동일한 구조로 통일 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user