@things-factory/tax-invoice 6.2.92 → 6.2.98
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/client/pages/tax-invoice-send/tax-invoice-send-page.ts +294 -246
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +1 -1
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +286 -244
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/tax-invoice/tax-invoice-mutation.js +6 -6
- package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
- package/dist-server/service/tax-invoice/tax-invoice-type.js +2 -2
- package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +146 -0
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +17 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
- package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +2 -2
- package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -1
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js +5 -5
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
- package/dist-server/service/unipost-api/tax-invoice-send.js +38 -0
- package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/tax-invoice/tax-invoice-mutation.ts +6 -6
- package/server/service/tax-invoice/tax-invoice-type.ts +2 -2
- package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +161 -1
- package/server/service/tax-invoice-api/tax-invoice-api-type.ts +11 -0
- package/server/service/tax-invoice-item/tax-invoice-item-type.ts +2 -2
- package/server/service/unipost-api/tax-invoice-inquiry.ts +5 -5
- package/server/service/unipost-api/tax-invoice-send.ts +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/tax-invoice",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.98",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@operato/graphql": "^1.0.0",
|
|
31
31
|
"@operato/shell": "^1.0.0",
|
|
32
|
-
"@things-factory/auth-base": "^6.2.
|
|
33
|
-
"@things-factory/export-ui-excel": "^6.2.
|
|
34
|
-
"@things-factory/shell": "^6.2.
|
|
32
|
+
"@things-factory/auth-base": "^6.2.96",
|
|
33
|
+
"@things-factory/export-ui-excel": "^6.2.96",
|
|
34
|
+
"@things-factory/shell": "^6.2.96"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "72d30969be4b3775047b2dc504aaf6188163b228"
|
|
37
37
|
}
|
|
@@ -99,19 +99,19 @@ export class TaxInvoiceMutation {
|
|
|
99
99
|
const { aid = '', bearer = '' } = apiInfo?.attributes
|
|
100
100
|
|
|
101
101
|
// API 호출하여 세금계산서 데이터 가져옴
|
|
102
|
-
const {
|
|
102
|
+
const { issueNoList, taxList } = await getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)
|
|
103
103
|
|
|
104
104
|
// 이미 있는 데이터 아이디 검색
|
|
105
105
|
const existingTaxInvoice = await taxInvoiceRepo.find({
|
|
106
|
-
select: ['
|
|
107
|
-
where: {
|
|
106
|
+
select: ['issueNo'],
|
|
107
|
+
where: { issueNo: In(issueNoList) }
|
|
108
108
|
})
|
|
109
|
-
const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.
|
|
109
|
+
const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.issueNo)
|
|
110
110
|
|
|
111
111
|
// 매입, 매출 for문
|
|
112
112
|
for (let tax of taxList) {
|
|
113
|
-
// 있는지 없는지 확인
|
|
114
|
-
if (existingIds.includes(tax.
|
|
113
|
+
// 있는지 없는지 확인 (이미 있는 세금계산서는 패스)
|
|
114
|
+
if (existingIds.includes(tax.exd_id)) continue
|
|
115
115
|
|
|
116
116
|
// 세금계산서 데이터 객체 생성
|
|
117
117
|
const newTaxInvoice: NewTaxInvoice = {
|
|
@@ -23,10 +23,10 @@ export class NewTaxInvoice {
|
|
|
23
23
|
originalApprovalNo?: string
|
|
24
24
|
|
|
25
25
|
@Field({ nullable: false })
|
|
26
|
-
issueDate:
|
|
26
|
+
issueDate: string
|
|
27
27
|
|
|
28
28
|
@Field({ nullable: true })
|
|
29
|
-
signatureDate:
|
|
29
|
+
signatureDate: string
|
|
30
30
|
|
|
31
31
|
@Field({ nullable: false })
|
|
32
32
|
invoiceType: InvoiceType
|
|
@@ -2,7 +2,10 @@ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
|
2
2
|
import { In } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
import { TaxInvoiceApi } from './tax-invoice-api'
|
|
5
|
-
import { TaxInvoiceApiPatch } from './tax-invoice-api-type'
|
|
5
|
+
import { TaxInvoiceApiPatch, TaxInvoiceSend } from './tax-invoice-api-type'
|
|
6
|
+
import { TaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item'
|
|
7
|
+
import { TaxInvoice } from '../tax-invoice/tax-invoice'
|
|
8
|
+
import { sendTaxInvoiceByUniposApi } from '../unipost-api/tax-invoice-send'
|
|
6
9
|
|
|
7
10
|
@Resolver(TaxInvoiceApi)
|
|
8
11
|
export class TaxInvoiceApiMutation {
|
|
@@ -50,4 +53,161 @@ export class TaxInvoiceApiMutation {
|
|
|
50
53
|
|
|
51
54
|
return true
|
|
52
55
|
}
|
|
56
|
+
|
|
57
|
+
@Directive('@transaction')
|
|
58
|
+
@Mutation(returns => TaxInvoiceApi, { description: 'To Send Tax Invoices By Api' })
|
|
59
|
+
async sendTaxInvoicesByApi(
|
|
60
|
+
@Arg('taxInvoiceSendList', type => [TaxInvoiceSend]) taxInvoiceSendList: TaxInvoiceSend[],
|
|
61
|
+
@Ctx() context: ResolverContext
|
|
62
|
+
): Promise<TaxInvoiceSend[]> {
|
|
63
|
+
if (taxInvoiceSendList.length === 0) throw new Error('tax invoice send exception: no list')
|
|
64
|
+
|
|
65
|
+
const { domain, user, tx } = context.state
|
|
66
|
+
const taxInvoiceRepo = tx.getRepository(TaxInvoice)
|
|
67
|
+
const taxInvoiceItemRepo = tx.getRepository(TaxInvoiceItem)
|
|
68
|
+
const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)
|
|
69
|
+
|
|
70
|
+
const apiInfo = (await taxInvoiceApiRepo.find()).at(0)
|
|
71
|
+
const businessRegistrationNumber = apiInfo.businessRegistrationNumber
|
|
72
|
+
const { aid = '', bearer = '', customer_no = '' } = apiInfo?.attributes
|
|
73
|
+
console.log(apiInfo?.attributes)
|
|
74
|
+
|
|
75
|
+
// 밸리데이션 및 데이터 파싱
|
|
76
|
+
let newTaxInvoiceSendList = taxInvoiceSendList.map(taxInvoiceSend => this._parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no))
|
|
77
|
+
|
|
78
|
+
// 세금계산서 발행 API 호출
|
|
79
|
+
const apiResult = sendTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer, newTaxInvoiceSendList)
|
|
80
|
+
if (!apiResult) {
|
|
81
|
+
throw new Error('tax invoice send exception: api problem')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 세금계산서 저장 리졸버 호출
|
|
85
|
+
// createTaxInvoice
|
|
86
|
+
|
|
87
|
+
return apiResult
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private _parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no) {
|
|
91
|
+
const { taxInvoice, taxInvoiceItems } = taxInvoiceSend
|
|
92
|
+
let newTaxInvoiceItems: any = []
|
|
93
|
+
const today = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date()) // YYYY-MM-DD
|
|
94
|
+
|
|
95
|
+
// 필수값 체크
|
|
96
|
+
if (
|
|
97
|
+
!taxInvoice.supplierBusinessRegistrationNumber ||
|
|
98
|
+
!taxInvoice.supplierBusinessName ||
|
|
99
|
+
!taxInvoice.supplierRepresentativeName ||
|
|
100
|
+
!taxInvoice.buyerBusinessRegistrationNumber ||
|
|
101
|
+
!taxInvoice.buyerBusinessName ||
|
|
102
|
+
!taxInvoice.buyerRepresentativeName ||
|
|
103
|
+
!taxInvoice.issueDate
|
|
104
|
+
) {
|
|
105
|
+
throw new Error('tax invoice send exception: no essential value')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 작성일자가 오늘 날짜를 넘어가면 에러
|
|
109
|
+
if (taxInvoice.issueDate > today) {
|
|
110
|
+
throw new Error('tax invoice send exception: issueDate error')
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 현금, 수표, 어음, 외상미수금이 있을시 총 합계금액과 금액 동일 체크
|
|
114
|
+
const paymentAmount: number =
|
|
115
|
+
taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable
|
|
116
|
+
|
|
117
|
+
if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
|
|
118
|
+
throw new Error('tax invoice send exception: summary is not same')
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
for (let item of taxInvoiceItems) {
|
|
122
|
+
// 아이템 필수값 체크
|
|
123
|
+
if (!item.supplyDate || !item.itemName || !item.quantity || !item.unitPrice) {
|
|
124
|
+
throw new Error('tax invoice send exception: no item essential value')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 아이템의 일자가 작성일자보다 크면 에러
|
|
128
|
+
if (taxInvoice.issueDate < item.supplyDate) {
|
|
129
|
+
throw new Error('tax invoice send exception: item supplyDate is bigger than issueDate')
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
newTaxInvoiceItems.push({
|
|
133
|
+
tii_seqnumeric: item.sequence,
|
|
134
|
+
tii_purchaseexpirydatetime: item.supplyDate.replace(/-/g, ''),
|
|
135
|
+
tii_nametext: item.itemName,
|
|
136
|
+
tii_informationtext: item.specification,
|
|
137
|
+
tii_chargeableunitquantity: item.quantity,
|
|
138
|
+
tii_unitprice_unitamount: item.unitPrice,
|
|
139
|
+
tii_invoiceamount: item.supplyPrice,
|
|
140
|
+
tii_totaltax_calcamount: item.taxPrice,
|
|
141
|
+
tii_descriptiontext: item.remark
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
aid: aid,
|
|
147
|
+
inv_seq: today.replace(/-/g, '') + customer_no,
|
|
148
|
+
exd_refdoc_id: null,
|
|
149
|
+
tid_issuedatetime: taxInvoice.issueDate.replace(/-/g, ''),
|
|
150
|
+
tid_typecode: taxInvoice.invoiceType,
|
|
151
|
+
tid_purposecode: taxInvoice.purpose,
|
|
152
|
+
tid_amendcode: taxInvoice.revisedReason,
|
|
153
|
+
tid_originalissueid: null,
|
|
154
|
+
tid_desc0: taxInvoice.remark0,
|
|
155
|
+
tid_desc1: null,
|
|
156
|
+
tid_desc2: null,
|
|
157
|
+
tit_alice_specorg_biztypecode: taxInvoice.supplierBusinessRegistrationCategory,
|
|
158
|
+
tit_alice_id: taxInvoice.supplierBusinessRegistrationNumber,
|
|
159
|
+
tit_alice_specorg_taxregid: taxInvoice.supplierBranchIdentification,
|
|
160
|
+
tit_alice_name: taxInvoice.supplierBusinessName,
|
|
161
|
+
tit_alice_specperson_name: taxInvoice.supplierRepresentativeName,
|
|
162
|
+
tit_alice_specaddr_lineone: taxInvoice.supplierAddress,
|
|
163
|
+
tit_alice_typecode: taxInvoice.supplierBusinessType,
|
|
164
|
+
tit_alice_classcode: taxInvoice.supplierIndustryType,
|
|
165
|
+
tit_alice_defcont_deptname: taxInvoice.supplierDepartment,
|
|
166
|
+
tit_alice_defcont_personname: taxInvoice.supplierContactName,
|
|
167
|
+
tit_alice_defcont_telcomm: taxInvoice.supplierContactPhone,
|
|
168
|
+
tit_alice_defcont_uricomm: taxInvoice.supplierContactEmail,
|
|
169
|
+
tit_alice_defcont_cellphone: taxInvoice.supplierContactCellPhone,
|
|
170
|
+
tit_bob_specorg_biztypecode: taxInvoice.buyerBusinessRegistrationCategory,
|
|
171
|
+
tit_bob_id: taxInvoice.buyerBusinessRegistrationNumber,
|
|
172
|
+
tit_bob_specorg_taxregid: taxInvoice.buyerBranchIdentification,
|
|
173
|
+
tit_bob_name: taxInvoice.buyerBusinessName,
|
|
174
|
+
tit_bob_specperson_name: taxInvoice.buyerRepresentativeName,
|
|
175
|
+
tit_bob_specaddr_lineone: taxInvoice.buyerAddress,
|
|
176
|
+
tit_bob_typecode: taxInvoice.buyerBusinessType,
|
|
177
|
+
tit_bob_classcode: taxInvoice.buyerIndustryType,
|
|
178
|
+
tit_bob_1stdefcont_deptname: taxInvoice.buyer1stDepartment,
|
|
179
|
+
tit_bob_1stdefcont_personname: taxInvoice.buyer1stContactName,
|
|
180
|
+
tit_bob_1stdefcont_telcomm: taxInvoice.buyer1stContactPhone,
|
|
181
|
+
tit_bob_1stdefcont_uricomm: taxInvoice.buyer1stContactEmail,
|
|
182
|
+
tit_bob_1stdefcont_cellphone: taxInvoice.buyer1stContactCellPhone,
|
|
183
|
+
tit_bob_2nddefcont_deptname: taxInvoice.buyer2ndDepartment,
|
|
184
|
+
tit_bob_2nddefcont_personname: taxInvoice.buyer2ndContactName,
|
|
185
|
+
tit_bob_2nddefcont_telcomm: taxInvoice.buyer2ndContactPhone,
|
|
186
|
+
tit_bob_2nddefcont_uricomm: taxInvoice.buyer2ndContactEmail,
|
|
187
|
+
tit_bob_2nddefcont_cellphone: taxInvoice.buyer2ndContactCellPhone,
|
|
188
|
+
tit_broker_specorg_biztypecode: taxInvoice.agentBusinessRegistrationCategory,
|
|
189
|
+
tit_broker_id: taxInvoice.agentBusinessRegistrationNumber,
|
|
190
|
+
tit_broker_specorg_taxregid: taxInvoice.agentBranchIdentification,
|
|
191
|
+
tit_broker_name: taxInvoice.agentBusinessName,
|
|
192
|
+
tit_broker_specperson_name: taxInvoice.agentRepresentativeName,
|
|
193
|
+
tit_broker_specaddr_lineone: taxInvoice.agentAddress,
|
|
194
|
+
tit_broker_typecode: taxInvoice.agentBusinessType,
|
|
195
|
+
tit_broker_classcode: taxInvoice.agentIndustryType,
|
|
196
|
+
tit_broker_defcont_deptname: taxInvoice.agentDepartment,
|
|
197
|
+
tit_broker_defcont_personname: taxInvoice.agentContactName,
|
|
198
|
+
tit_broker_defcont_telcomm: taxInvoice.agentContactPhone,
|
|
199
|
+
tit_broker_defcont_uricomm: taxInvoice.agentContactEmail,
|
|
200
|
+
tit_broker_defcont_cellphone: taxInvoice.agentContactCellPhone,
|
|
201
|
+
tit_specpay_paidamount10: taxInvoice.paymentAmountCash,
|
|
202
|
+
tit_specpay_paidamount20: taxInvoice.paymentAmountCheck,
|
|
203
|
+
tit_specpay_paidamount30: taxInvoice.paymentAmountPromissoryNote,
|
|
204
|
+
tit_specpay_paidamount40: taxInvoice.paymentAmountAccountsReceivable,
|
|
205
|
+
tit_specsum_chargeamount: taxInvoice.supplyAmount,
|
|
206
|
+
tit_specsum_taxamount: taxInvoice.taxAmount,
|
|
207
|
+
tit_specsum_grandamount: taxInvoice.totalAmount,
|
|
208
|
+
inv_sign: '',
|
|
209
|
+
biz_tocharlesconfirmstatus: null,
|
|
210
|
+
tAliceItemList: newTaxInvoiceItems
|
|
211
|
+
}
|
|
212
|
+
}
|
|
53
213
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
2
|
import { TaxInvoiceApi } from './tax-invoice-api'
|
|
3
3
|
import { ScalarObject } from '@things-factory/shell'
|
|
4
|
+
import { NewTaxInvoice } from '../tax-invoice/tax-invoice-type'
|
|
5
|
+
import { NewTaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item-type'
|
|
4
6
|
|
|
5
7
|
@InputType()
|
|
6
8
|
export class TaxInvoiceApiPatch {
|
|
@@ -73,3 +75,12 @@ export class TaxInvoiceApiList {
|
|
|
73
75
|
@Field(type => Int)
|
|
74
76
|
total: number
|
|
75
77
|
}
|
|
78
|
+
|
|
79
|
+
@InputType()
|
|
80
|
+
export class TaxInvoiceSend {
|
|
81
|
+
@Field(type => NewTaxInvoice)
|
|
82
|
+
taxInvoice!: NewTaxInvoice
|
|
83
|
+
|
|
84
|
+
@Field(type => [NewTaxInvoiceItem])
|
|
85
|
+
taxInvoiceItems!: NewTaxInvoiceItem[]
|
|
86
|
+
}
|
|
@@ -7,7 +7,7 @@ export class NewTaxInvoiceItem {
|
|
|
7
7
|
sequence: number
|
|
8
8
|
|
|
9
9
|
@Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })
|
|
10
|
-
supplyDate:
|
|
10
|
+
supplyDate: string
|
|
11
11
|
|
|
12
12
|
@Field({ nullable: false, description: '품목명' })
|
|
13
13
|
itemName: string
|
|
@@ -40,7 +40,7 @@ export class TaxInvoiceItemPatch {
|
|
|
40
40
|
sequence: number
|
|
41
41
|
|
|
42
42
|
@Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })
|
|
43
|
-
supplyDate:
|
|
43
|
+
supplyDate: string
|
|
44
44
|
|
|
45
45
|
@Field({ nullable: false, description: '품목명' })
|
|
46
46
|
itemName: string
|
|
@@ -30,7 +30,7 @@ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: strin
|
|
|
30
30
|
throw new Error('no parameter in unipos api')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const issueNoList: Array<string> = []
|
|
34
34
|
const taxList = []
|
|
35
35
|
const taxTypeArr = [UnipostTaxType.EXPORT, UnipostTaxType.IMPORT]
|
|
36
36
|
|
|
@@ -40,12 +40,12 @@ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: strin
|
|
|
40
40
|
|
|
41
41
|
// 성공 일시 세금 계산서 데이터 배열에 추가
|
|
42
42
|
if (response.status === 200) {
|
|
43
|
-
const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT
|
|
43
|
+
const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT // 유니포스트의 타입 => 우리 솔루션 형태로 변환
|
|
44
44
|
const taxData = await response.json()
|
|
45
45
|
|
|
46
46
|
if (taxData.success === true) {
|
|
47
47
|
for (let tax of taxData.tAliceEntry) {
|
|
48
|
-
|
|
48
|
+
issueNoList.push(tax.exd_id)
|
|
49
49
|
taxList.push({ ...tax, category })
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -56,14 +56,14 @@ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: strin
|
|
|
56
56
|
// const taxData = getTestTaxInvoiceData(category)
|
|
57
57
|
// if (taxData.success === true) {
|
|
58
58
|
// for (let tax of taxData.tAliceEntry) {
|
|
59
|
-
//
|
|
59
|
+
// issueNoList.push(tax.exd_id)
|
|
60
60
|
// taxList.push({ ...tax, category })
|
|
61
61
|
// }
|
|
62
62
|
// }
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
-
|
|
66
|
+
issueNoList,
|
|
67
67
|
taxList
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// 세금계산서 발행 API
|
|
2
|
+
const SEND_URL = {
|
|
3
|
+
dev: 'https://unidev.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill',
|
|
4
|
+
prod: 'https://etax.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function sendTaxInvoiceByUniposApi(businessRegistrationNumber: string, aid: string, bearer: string, taxInvoiceSendList) {
|
|
8
|
+
if (!businessRegistrationNumber || !aid || !bearer || !taxInvoiceSendList) {
|
|
9
|
+
throw new Error('no parameter in unipos api')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const response = await _callTaxInvoiceSend(businessRegistrationNumber, aid, bearer, taxInvoiceSendList)
|
|
13
|
+
|
|
14
|
+
// 성공 일시 세금 계산서 데이터 배열에 추가
|
|
15
|
+
if (response.status === 200) {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = await response.json()
|
|
19
|
+
|
|
20
|
+
console.log('response : ', response)
|
|
21
|
+
console.log('result : ', result)
|
|
22
|
+
|
|
23
|
+
return result.success
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function _callTaxInvoiceSend(businessRegistrationNumber: string, aid: string, bearer: string, taxInvoiceSendList) {
|
|
27
|
+
console.log('request : ', taxInvoiceSendList)
|
|
28
|
+
|
|
29
|
+
const response = await fetch(SEND_URL.dev, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
Authorization: 'Basic ' + bearer,
|
|
34
|
+
AID: aid,
|
|
35
|
+
COM_REGNO: businessRegistrationNumber
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify(taxInvoiceSendList)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
console.log('response1 : ', response)
|
|
41
|
+
return response
|
|
42
|
+
}
|