@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/tax-invoice",
3
- "version": "8.0.79",
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": "d3e06a1f18781c320e9de3438f67db525e4e6a66"
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 = (await taxInvoiceApiRepo.find())[0]
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?.attributes
125
+ const { aid = '', bearer = '' } = apiInfo.attributes || {}
115
126
 
116
- logger.info('apiInfo : ', apiInfo)
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('issueNoList, taxList : ', issueNoList, taxList)
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('existingTaxInvoice : ', existingTaxInvoice)
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('insertedData : ', insertedData)
157
- logger.info('confirmResult : ', confirmResult)
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('response : ', response)
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('taxData : ', taxData)
45
+ logger.info(`taxData : ${JSON.stringify(taxData)}`)
46
46
 
47
47
  if (taxData.success === true) {
48
48
  for (let tax of taxData.tAliceEntry) {