fix:바로빌 세금계산서 발행 API 레거시 코드와 동기화

- InvoicerParty에 ContactID 필드 추가 (기본값: cbx0913)
- TaxRegID, BizType, BizClass, TEL, HP 등 누락 필드 추가
- InvoiceeParty에도 동일한 필드 추가
- TaxInvoiceTradeLineItem에 PurchaseExpiry, Information, Description 추가
- 레거시 barobill_config.php와 동일한 구조로 맞춤

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
pro
2026-01-23 09:50:19 +09:00
parent a9dc428085
commit ad9dfe2c2a

View File

@@ -357,12 +357,12 @@ private function issueTaxInvoice(array $invoiceData): array
$taxType = $vat == 0 ? 2 : 1;
$taxInvoice = [
'IssueDirection' => 1,
'TaxInvoiceType' => 1,
'ModifyCode' => '',
'TaxType' => $taxType,
'TaxCalcType' => 1,
'PurposeType' => 2,
'IssueDirection' => 1, // 1: 정발행
'TaxInvoiceType' => 1, // 1: 세금계산서
'ModifyCode' => '', // 수정사유코드 (신규발행시 빈값)
'TaxType' => $taxType, // 1: 과세, 2: 영세, 3: 면세
'TaxCalcType' => 1, // 1: 소계합계
'PurposeType' => 2, // 2: 청구
'WriteDate' => date('Ymd', strtotime($invoiceData['supplyDate'] ?? date('Y-m-d'))),
'AmountTotal' => number_format($supplyAmt, 0, '', ''),
'TaxTotal' => number_format($vat, 0, '', ''),
@@ -372,33 +372,55 @@ private function issueTaxInvoice(array $invoiceData): array
'Note' => '0',
'Credit' => number_format($total, 0, '', ''),
'Remark1' => $invoiceData['memo'] ?? '',
'Remark2' => '',
'Remark3' => '',
'Kwon' => '',
'Ho' => '',
'SerialNum' => '',
'InvoicerParty' => [
'MgtNum' => $mgtKey,
'CorpNum' => $this->corpNum,
'TaxRegID' => '', // 종사업장번호
'CorpName' => $invoiceData['supplierName'] ?? '',
'CEOName' => $invoiceData['supplierCeo'] ?? '',
'Addr' => $invoiceData['supplierAddr'] ?? '',
'BizType' => '', // 업태
'BizClass' => '', // 종목
'ContactID' => $invoiceData['supplierContactId'] ?? 'cbx0913', // 바로빌 담당자 ID (필수)
'ContactName' => $invoiceData['supplierContact'] ?? '',
'TEL' => $invoiceData['supplierTel'] ?? '',
'HP' => '',
'Email' => $invoiceData['supplierEmail'] ?? '',
],
'InvoiceeParty' => [
'MgtNum' => '',
'CorpNum' => str_replace('-', '', $invoiceData['recipientBizno'] ?? ''),
'TaxRegID' => '',
'CorpName' => $invoiceData['recipientName'] ?? '',
'CEOName' => $invoiceData['recipientCeo'] ?? '',
'Addr' => $invoiceData['recipientAddr'] ?? '',
'BizType' => '',
'BizClass' => '',
'ContactID' => '',
'ContactName' => $invoiceData['recipientContact'] ?? '',
'TEL' => $invoiceData['recipientTel'] ?? '',
'HP' => '',
'Email' => $invoiceData['recipientEmail'] ?? '',
],
'BrokerParty' => [], // 위수탁 거래시에만 사용
'TaxInvoiceTradeLineItems' => ['TaxInvoiceTradeLineItem' => []],
];
foreach ($invoiceData['items'] ?? [] as $item) {
$taxInvoice['TaxInvoiceTradeLineItems']['TaxInvoiceTradeLineItem'][] = [
'Name' => $item['name'] ?? '',
'ChargeableUnit' => $item['qty'] ?? '1',
'UnitPrice' => number_format(floatval($item['unitPrice'] ?? 0), 0, '', ''),
'Amount' => number_format(floatval($item['supplyAmt'] ?? 0), 0, '', ''),
'Tax' => number_format(floatval($item['vat'] ?? 0), 0, '', ''),
'PurchaseExpiry' => '', // 공제기한
'Name' => $item['name'] ?? '', // 품명
'Information' => $item['spec'] ?? '', // 규격
'ChargeableUnit' => $item['qty'] ?? '1', // 수량
'UnitPrice' => number_format(floatval($item['unitPrice'] ?? 0), 0, '', ''), // 단가
'Amount' => number_format(floatval($item['supplyAmt'] ?? 0), 0, '', ''), // 공급가액
'Tax' => number_format(floatval($item['vat'] ?? 0), 0, '', ''), // 부가세
'Description' => $item['description'] ?? '', // 비고
];
}