@things-factory/tax-invoice 8.0.79 → 8.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/service/tax-invoice/tax-invoice-mutation.js +17 -7
- package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js +2 -2
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/tax-invoice/tax-invoice-mutation.ts +19 -7
- package/server/service/tax-invoice-api/tax-invoice-api.ts +1 -1
- package/server/service/unipost-api/tax-invoice-inquiry.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/tax-invoice",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.80",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"@things-factory/export-ui-excel": "^8.0.64",
|
|
35
35
|
"@things-factory/shell": "^8.0.64"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "f648b0289efffa73217f3304ddad21bec912a8a0"
|
|
38
38
|
}
|
|
@@ -109,16 +109,28 @@ export class TaxInvoiceMutation {
|
|
|
109
109
|
const insertedData: ConfirmData[] = [] // API 호출 후 결과 회신용
|
|
110
110
|
|
|
111
111
|
// TODO 여기 기본값으로 가져와야하는거 아님?
|
|
112
|
-
const apiInfo =
|
|
112
|
+
const apiInfo = await taxInvoiceApiRepo
|
|
113
|
+
.createQueryBuilder('tia')
|
|
114
|
+
.leftJoinAndSelect('tia.domain', 'domain')
|
|
115
|
+
.where('domain.id = :domainId', { domainId: domain.id })
|
|
116
|
+
.andWhere('tia.isDefault = true')
|
|
117
|
+
.orderBy('tia.createdAt', 'DESC')
|
|
118
|
+
.getOne()
|
|
119
|
+
|
|
120
|
+
if (!apiInfo) {
|
|
121
|
+
throw new Error('기본 세금계산서 API 정보가 설정되어 있지 않습니다.')
|
|
122
|
+
}
|
|
123
|
+
|
|
113
124
|
const businessRegistrationNumber = apiInfo.businessRegistrationNumber
|
|
114
|
-
const { aid = '', bearer = '' } = apiInfo
|
|
125
|
+
const { aid = '', bearer = '' } = apiInfo.attributes || {}
|
|
115
126
|
|
|
116
|
-
logger.info(
|
|
127
|
+
logger.info(`apiInfo : ${JSON.stringify(apiInfo)}`)
|
|
117
128
|
|
|
118
129
|
// API 호출하여 세금계산서 데이터 가져옴
|
|
119
130
|
const { issueNoList, taxList } = await getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)
|
|
120
131
|
|
|
121
|
-
logger.info(
|
|
132
|
+
logger.info(`issueNoList : ${JSON.stringify(issueNoList)}`)
|
|
133
|
+
logger.info(`taxList : ${JSON.stringify(taxList)}`)
|
|
122
134
|
|
|
123
135
|
// 이미 있는 데이터 아이디 검색
|
|
124
136
|
const existingTaxInvoice = await taxInvoiceRepo.find({
|
|
@@ -127,7 +139,7 @@ export class TaxInvoiceMutation {
|
|
|
127
139
|
})
|
|
128
140
|
const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.issueNo)
|
|
129
141
|
|
|
130
|
-
logger.info(
|
|
142
|
+
logger.info(`existingTaxInvoice : ${JSON.stringify(existingTaxInvoice)}`)
|
|
131
143
|
|
|
132
144
|
// 매입, 매출 for문
|
|
133
145
|
for (let tax of taxList) {
|
|
@@ -153,8 +165,8 @@ export class TaxInvoiceMutation {
|
|
|
153
165
|
// 유니 포스트에 조회 후 결과 회신 API 호출
|
|
154
166
|
const confirmResult = await callTaxInvoiceConfirm(businessRegistrationNumber, aid, bearer, insertedData)
|
|
155
167
|
|
|
156
|
-
logger.info(
|
|
157
|
-
logger.info(
|
|
168
|
+
logger.info(`insertedData : ${JSON.stringify(insertedData)}`)
|
|
169
|
+
logger.info(`confirmResult : ${JSON.stringify(confirmResult)}`)
|
|
158
170
|
|
|
159
171
|
return true
|
|
160
172
|
}
|
|
@@ -32,7 +32,7 @@ export class TaxInvoiceApi {
|
|
|
32
32
|
@RelationId((taxInvoiceApi: TaxInvoiceApi) => taxInvoiceApi.domain)
|
|
33
33
|
domainId?: string
|
|
34
34
|
|
|
35
|
-
@Column({ nullable: true, comment: '디폴트 여부' })
|
|
35
|
+
@Column({ type: 'boolean', nullable: true, comment: '디폴트 여부' })
|
|
36
36
|
@Field({ nullable: true, description: '디폴트 여부' })
|
|
37
37
|
isDefault?: boolean
|
|
38
38
|
|
|
@@ -35,14 +35,14 @@ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: strin
|
|
|
35
35
|
for (const taxType of taxTypeArr) {
|
|
36
36
|
const response = await _callTaxInvoiceInquiry(businessRegistrationNumber, aid, bearer, taxType)
|
|
37
37
|
|
|
38
|
-
logger.info(
|
|
38
|
+
logger.info(`response : ${JSON.stringify(response)}`)
|
|
39
39
|
|
|
40
40
|
// 성공 일시 세금 계산서 데이터 배열에 추가
|
|
41
41
|
if (response.status === 200) {
|
|
42
42
|
const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT // 유니포스트의 타입 => 우리 솔루션 형태로 변환
|
|
43
43
|
const taxData = await response.json()
|
|
44
44
|
|
|
45
|
-
logger.info(
|
|
45
|
+
logger.info(`taxData : ${JSON.stringify(taxData)}`)
|
|
46
46
|
|
|
47
47
|
if (taxData.success === true) {
|
|
48
48
|
for (let tax of taxData.tAliceEntry) {
|