@things-factory/tax-invoice 6.2.96 → 6.2.101
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/dist-server/service/unipost-api/test-data.js +0 -3812
- package/dist-server/service/unipost-api/test-data.js.map +0 -1
|
@@ -62,17 +62,17 @@ let TaxInvoiceMutation = class TaxInvoiceMutation {
|
|
|
62
62
|
const businessRegistrationNumber = apiInfo.businessRegistrationNumber;
|
|
63
63
|
const { aid = '', bearer = '' } = apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.attributes;
|
|
64
64
|
// API 호출하여 세금계산서 데이터 가져옴
|
|
65
|
-
const {
|
|
65
|
+
const { issueNoList, taxList } = await (0, tax_invoice_inquiry_1.getTaxInvoiceByUniposApi)(businessRegistrationNumber, aid, bearer);
|
|
66
66
|
// 이미 있는 데이터 아이디 검색
|
|
67
67
|
const existingTaxInvoice = await taxInvoiceRepo.find({
|
|
68
|
-
select: ['
|
|
69
|
-
where: {
|
|
68
|
+
select: ['issueNo'],
|
|
69
|
+
where: { issueNo: (0, typeorm_1.In)(issueNoList) }
|
|
70
70
|
});
|
|
71
|
-
const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.
|
|
71
|
+
const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.issueNo);
|
|
72
72
|
// 매입, 매출 for문
|
|
73
73
|
for (let tax of taxList) {
|
|
74
|
-
// 있는지 없는지 확인
|
|
75
|
-
if (existingIds.includes(tax.
|
|
74
|
+
// 있는지 없는지 확인 (이미 있는 세금계산서는 패스)
|
|
75
|
+
if (existingIds.includes(tax.exd_id))
|
|
76
76
|
continue;
|
|
77
77
|
// 세금계산서 데이터 객체 생성
|
|
78
78
|
const newTaxInvoice = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-mutation.js","sourceRoot":"","sources":["../../../server/service/tax-invoice/tax-invoice-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAAoD;AACpD,yDAAmE;AACnE,qFAA6E;AAC7E,2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AFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACpD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DA6HhC;AA3MU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CA+M9B;AA/MY,gDAAkB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Category, TaxInvoice } from './tax-invoice'\nimport { NewTaxInvoice, TaxInvoicePatch } from './tax-invoice-type'\nimport { NewTaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item-type'\nimport { TaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item'\nimport { TaxInvoiceApi } from '../tax-invoice-api/tax-invoice-api'\nimport { AttributeSet } from '@things-factory/shell/dist-server/service/attribute-set/attribute-set'\nimport { ConfirmData, UnipostTaxType, callTaxInvoiceConfirm, getTaxInvoiceByUniposApi } from '../unipost-api/tax-invoice-inquiry'\n\n@Resolver(TaxInvoice)\nexport class TaxInvoiceMutation {\n @Directive('@transaction')\n @Mutation(returns => TaxInvoice, { description: 'To create new TaxInvoice' })\n async createTaxInvoice(\n @Arg('taxInvoice') taxInvoice: NewTaxInvoice,\n @Arg('taxInvoiceItems', () => [NewTaxInvoiceItem]) taxInvoiceItems: NewTaxInvoiceItem[],\n @Ctx() context: ResolverContext\n ): Promise<TaxInvoice> {\n const { domain, user, tx } = context.state\n\n const newTaxInvoice = await tx.getRepository(TaxInvoice).save({\n ...taxInvoice,\n domain,\n creator: user,\n updater: user\n })\n\n // 아이템 저장\n for (const item of taxInvoiceItems) {\n await tx.getRepository(TaxInvoiceItem).save({ ...item, taxInvoice: newTaxInvoice, domain, creator: user })\n }\n\n return newTaxInvoice\n }\n\n // 그리드에서 메모 수정용 으로만\n @Directive('@transaction')\n @Mutation(returns => [TaxInvoice], { description: \"To modify multiple TaxInvoices' information\" })\n async updateMultipleTaxInvoice(@Arg('patches', type => [TaxInvoicePatch]) patches: TaxInvoicePatch[], @Ctx() context: ResolverContext): Promise<TaxInvoice[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const taxInvoiceRepo = tx.getRepository(TaxInvoice)\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const taxInvoice = await taxInvoiceRepo.findOneBy({ id: updateRecord.id })\n\n const result = await taxInvoiceRepo.save({\n ...taxInvoice,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete TaxInvoice' })\n async deleteTaxInvoice(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoice).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple TaxInvoices' })\n async deleteTaxInvoices(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoice).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'create tax invoice data by API' })\n async fetchTaxInvoiceByApi(@Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, user, tx } = context.state\n const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)\n const taxInvoiceRepo = tx.getRepository(TaxInvoice)\n const insertedData: ConfirmData[] = [] // API 호출 후 결과 회신용\n\n const apiInfo = (await taxInvoiceApiRepo.find()).at(0)\n const businessRegistrationNumber = apiInfo.businessRegistrationNumber\n const { aid = '', bearer = '' } = apiInfo?.attributes\n\n // API 호출하여 세금계산서 데이터 가져옴\n const { approvalNoList, taxList } = await getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)\n\n // 이미 있는 데이터 아이디 검색\n const existingTaxInvoice = await taxInvoiceRepo.find({\n select: ['approvalNo'],\n where: { approvalNo: In(approvalNoList) }\n })\n const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.approvalNo)\n\n // 매입, 매출 for문\n for (let tax of taxList) {\n // 있는지 없는지 확인\n if (existingIds.includes(tax.tid_issueid)) continue\n\n // 세금계산서 데이터 객체 생성\n const newTaxInvoice: NewTaxInvoice = {\n issueNo: tax.exd_id,\n approvalNo: tax.tid_issueid,\n originalApprovalNo: tax.tid_originalissueid,\n issueDate: this._dateFormat(tax.tid_issuedatetime),\n signatureDate: this._dateFormat(tax.exd_issuedatetime),\n invoiceType: tax.tid_typecode,\n purpose: tax.tid_purposecode,\n revisedReason: tax.tid_amendcode,\n remark0: tax.tid_desc0,\n remark1: tax.tid_desc1,\n remark2: tax.tid_desc2,\n category: tax.category,\n supplierBusinessRegistrationCategory: tax.tit_alice_specorg_biztypecode,\n supplierBusinessRegistrationNumber: tax.tit_alice_id,\n supplierBranchIdentification: tax.tit_alice_specorg_taxregid,\n supplierBusinessName: tax.tit_alice_name,\n supplierRepresentativeName: tax.tit_alice_specperson_name,\n supplierAddress: tax.tit_alice_specaddr_lineone,\n supplierBusinessType: tax.tit_alice_typecode,\n supplierIndustryType: tax.tit_alice_classcode,\n supplierDepartment: tax.tit_alice_defcont_deptname,\n supplierContactName: tax.tit_alice_defcont_personname,\n supplierContactPhone: tax.tit_alice_defcont_telcomm,\n supplierContactEmail: tax.tit_alice_defcont_uricomm,\n supplierContactCellPhone: tax.tit_alice_defcont_cellphone,\n buyerBusinessRegistrationCategory: tax.tit_bob_specorg_biztypecode,\n buyerBusinessRegistrationNumber: tax.tit_bob_id,\n buyerBranchIdentification: tax.tit_bob_specorg_taxregid,\n buyerBusinessName: tax.tit_bob_name,\n buyerRepresentativeName: tax.tit_bob_specperson_name,\n buyerAddress: tax.tit_bob_specaddr_lineone,\n buyerBusinessType: tax.tit_bob_typecode,\n buyerIndustryType: tax.tit_bob_classcode,\n buyer1stDepartment: tax.tit_bob_1stdefcont_deptname,\n buyer1stContactName: tax.tit_bob_1stdefcont_personname,\n buyer1stContactPhone: tax.tit_bob_1stdefcont_telcomm,\n buyer1stContactEmail: tax.tit_bob_1stdefcont_uricomm,\n buyer1stContactCellPhone: tax.tit_bob_1stdefcont_cellphone,\n buyer2ndDepartment: tax.tit_bob_2nddefcont_deptname,\n buyer2ndContactName: tax.tit_bob_2nddefcont_personname,\n buyer2ndContactPhone: tax.tit_bob_2nddefcont_telcomm,\n buyer2ndContactEmail: tax.tit_bob_2nddefcont_uricomm,\n buyer2ndContactCellPhone: tax.tit_bob_2nddefcont_cellphone,\n agentBusinessRegistrationCategory: tax.tit_broker_specorg_biztypecode,\n agentBusinessRegistrationNumber: tax.tit_broker_id,\n agentBranchIdentification: tax.tit_broker_specorg_taxregid,\n agentBusinessName: tax.tit_broker_name,\n agentRepresentativeName: tax.tit_broker_specperson_name,\n agentAddress: tax.tit_broker_specaddr_lineone,\n agentBusinessType: tax.tit_broker_typecode,\n agentIndustryType: tax.tit_broker_classcode,\n agentDepartment: tax.tit_broker_defcont_deptname,\n agentContactName: tax.tit_broker_defcont_personname,\n agentContactPhone: tax.tit_broker_defcont_telcomm,\n agentContactEmail: tax.tit_broker_defcont_uricomm,\n agentContactCellPhone: tax.tit_broker_defcont_cellphone,\n paymentAmountCash: tax.tit_specpay_paidamount10,\n paymentAmountCheck: tax.tit_specpay_paidamount20,\n paymentAmountPromissoryNote: tax.tit_specpay_paidamount30,\n paymentAmountAccountsReceivable: tax.tit_specpay_paidamount40,\n supplyAmount: tax.tit_specsum_chargeamount,\n taxAmount: tax.tit_specsum_taxamount,\n totalAmount: tax.tit_specsum_grandamount\n }\n\n // 세금계산서 아이템 데이터 객체 생성\n const newTaxInvoiceItem: NewTaxInvoiceItem[] = []\n for (let item of tax.tAliceItemList) {\n newTaxInvoiceItem.push({\n sequence: item.tii_seqnumeric,\n supplyDate: this._dateFormat(item.tii_purchaseexpirydatetime),\n itemName: item.tii_nametext,\n specification: item.tii_informationtext,\n quantity: item.tii_chargeableunitquantity,\n unitPrice: item.tii_unitprice_unitamount,\n supplyPrice: item.tii_invoiceamount,\n taxPrice: item.tii_totaltax_calcamount,\n remark: item.tii_descriptiontext\n })\n }\n\n // Insert\n this.createTaxInvoice(newTaxInvoice, newTaxInvoiceItem, context)\n\n // API 결과 회신 데이터 생성\n insertedData.push({\n aid: aid,\n tax_type: tax.category == Category.EXPORT ? UnipostTaxType.EXPORT : UnipostTaxType.IMPORT,\n tid_issueid: tax.tid_issueid,\n success: true,\n message: ''\n })\n }\n\n // 유니 포스트에 조회 후 결과 회신 API 호출\n callTaxInvoiceConfirm(businessRegistrationNumber, aid, bearer, insertedData)\n\n return true\n }\n\n // YYYYMMDD => YYYY-MM-DD\n private _dateFormat = date => date.replace(/(\\d{4})(\\d{2})(\\d{2})/g, '$1-$2-$3')\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tax-invoice-mutation.js","sourceRoot":"","sources":["../../../server/service/tax-invoice/tax-invoice-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAAoD;AACpD,yDAAmE;AACnE,qFAA6E;AAC7E,2EAAqE;AACrE,wEAAkE;AAElE,4EAAiI;AAG1H,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QA6ML,yBAAyB;QACjB,gBAAW,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAA;IAClF,CAAC;IA5MO,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACO,eAAoC,EAChF,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE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port { In } from 'typeorm'\n\nimport { Category, TaxInvoice } from './tax-invoice'\nimport { NewTaxInvoice, TaxInvoicePatch } from './tax-invoice-type'\nimport { NewTaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item-type'\nimport { TaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item'\nimport { TaxInvoiceApi } from '../tax-invoice-api/tax-invoice-api'\nimport { AttributeSet } from '@things-factory/shell/dist-server/service/attribute-set/attribute-set'\nimport { ConfirmData, UnipostTaxType, callTaxInvoiceConfirm, getTaxInvoiceByUniposApi } from '../unipost-api/tax-invoice-inquiry'\n\n@Resolver(TaxInvoice)\nexport class TaxInvoiceMutation {\n @Directive('@transaction')\n @Mutation(returns => TaxInvoice, { description: 'To create new TaxInvoice' })\n async createTaxInvoice(\n @Arg('taxInvoice') taxInvoice: NewTaxInvoice,\n @Arg('taxInvoiceItems', () => [NewTaxInvoiceItem]) taxInvoiceItems: NewTaxInvoiceItem[],\n @Ctx() context: ResolverContext\n ): Promise<TaxInvoice> {\n const { domain, user, tx } = context.state\n\n const newTaxInvoice = await tx.getRepository(TaxInvoice).save({\n ...taxInvoice,\n domain,\n creator: user,\n updater: user\n })\n\n // 아이템 저장\n for (const item of taxInvoiceItems) {\n await tx.getRepository(TaxInvoiceItem).save({ ...item, taxInvoice: newTaxInvoice, domain, creator: user })\n }\n\n return newTaxInvoice\n }\n\n // 그리드에서 메모 수정용 으로만\n @Directive('@transaction')\n @Mutation(returns => [TaxInvoice], { description: \"To modify multiple TaxInvoices' information\" })\n async updateMultipleTaxInvoice(@Arg('patches', type => [TaxInvoicePatch]) patches: TaxInvoicePatch[], @Ctx() context: ResolverContext): Promise<TaxInvoice[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const taxInvoiceRepo = tx.getRepository(TaxInvoice)\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const taxInvoice = await taxInvoiceRepo.findOneBy({ id: updateRecord.id })\n\n const result = await taxInvoiceRepo.save({\n ...taxInvoice,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete TaxInvoice' })\n async deleteTaxInvoice(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoice).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple TaxInvoices' })\n async deleteTaxInvoices(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoice).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'create tax invoice data by API' })\n async fetchTaxInvoiceByApi(@Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, user, tx } = context.state\n const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)\n const taxInvoiceRepo = tx.getRepository(TaxInvoice)\n const insertedData: ConfirmData[] = [] // API 호출 후 결과 회신용\n\n const apiInfo = (await taxInvoiceApiRepo.find()).at(0)\n const businessRegistrationNumber = apiInfo.businessRegistrationNumber\n const { aid = '', bearer = '' } = apiInfo?.attributes\n\n // API 호출하여 세금계산서 데이터 가져옴\n const { issueNoList, taxList } = await getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)\n\n // 이미 있는 데이터 아이디 검색\n const existingTaxInvoice = await taxInvoiceRepo.find({\n select: ['issueNo'],\n where: { issueNo: In(issueNoList) }\n })\n const existingIds = existingTaxInvoice.map(taxInvoice => taxInvoice.issueNo)\n\n // 매입, 매출 for문\n for (let tax of taxList) {\n // 있는지 없는지 확인 (이미 있는 세금계산서는 패스)\n if (existingIds.includes(tax.exd_id)) continue\n\n // 세금계산서 데이터 객체 생성\n const newTaxInvoice: NewTaxInvoice = {\n issueNo: tax.exd_id,\n approvalNo: tax.tid_issueid,\n originalApprovalNo: tax.tid_originalissueid,\n issueDate: this._dateFormat(tax.tid_issuedatetime),\n signatureDate: this._dateFormat(tax.exd_issuedatetime),\n invoiceType: tax.tid_typecode,\n purpose: tax.tid_purposecode,\n revisedReason: tax.tid_amendcode,\n remark0: tax.tid_desc0,\n remark1: tax.tid_desc1,\n remark2: tax.tid_desc2,\n category: tax.category,\n supplierBusinessRegistrationCategory: tax.tit_alice_specorg_biztypecode,\n supplierBusinessRegistrationNumber: tax.tit_alice_id,\n supplierBranchIdentification: tax.tit_alice_specorg_taxregid,\n supplierBusinessName: tax.tit_alice_name,\n supplierRepresentativeName: tax.tit_alice_specperson_name,\n supplierAddress: tax.tit_alice_specaddr_lineone,\n supplierBusinessType: tax.tit_alice_typecode,\n supplierIndustryType: tax.tit_alice_classcode,\n supplierDepartment: tax.tit_alice_defcont_deptname,\n supplierContactName: tax.tit_alice_defcont_personname,\n supplierContactPhone: tax.tit_alice_defcont_telcomm,\n supplierContactEmail: tax.tit_alice_defcont_uricomm,\n supplierContactCellPhone: tax.tit_alice_defcont_cellphone,\n buyerBusinessRegistrationCategory: tax.tit_bob_specorg_biztypecode,\n buyerBusinessRegistrationNumber: tax.tit_bob_id,\n buyerBranchIdentification: tax.tit_bob_specorg_taxregid,\n buyerBusinessName: tax.tit_bob_name,\n buyerRepresentativeName: tax.tit_bob_specperson_name,\n buyerAddress: tax.tit_bob_specaddr_lineone,\n buyerBusinessType: tax.tit_bob_typecode,\n buyerIndustryType: tax.tit_bob_classcode,\n buyer1stDepartment: tax.tit_bob_1stdefcont_deptname,\n buyer1stContactName: tax.tit_bob_1stdefcont_personname,\n buyer1stContactPhone: tax.tit_bob_1stdefcont_telcomm,\n buyer1stContactEmail: tax.tit_bob_1stdefcont_uricomm,\n buyer1stContactCellPhone: tax.tit_bob_1stdefcont_cellphone,\n buyer2ndDepartment: tax.tit_bob_2nddefcont_deptname,\n buyer2ndContactName: tax.tit_bob_2nddefcont_personname,\n buyer2ndContactPhone: tax.tit_bob_2nddefcont_telcomm,\n buyer2ndContactEmail: tax.tit_bob_2nddefcont_uricomm,\n buyer2ndContactCellPhone: tax.tit_bob_2nddefcont_cellphone,\n agentBusinessRegistrationCategory: tax.tit_broker_specorg_biztypecode,\n agentBusinessRegistrationNumber: tax.tit_broker_id,\n agentBranchIdentification: tax.tit_broker_specorg_taxregid,\n agentBusinessName: tax.tit_broker_name,\n agentRepresentativeName: tax.tit_broker_specperson_name,\n agentAddress: tax.tit_broker_specaddr_lineone,\n agentBusinessType: tax.tit_broker_typecode,\n agentIndustryType: tax.tit_broker_classcode,\n agentDepartment: tax.tit_broker_defcont_deptname,\n agentContactName: tax.tit_broker_defcont_personname,\n agentContactPhone: tax.tit_broker_defcont_telcomm,\n agentContactEmail: tax.tit_broker_defcont_uricomm,\n agentContactCellPhone: tax.tit_broker_defcont_cellphone,\n paymentAmountCash: tax.tit_specpay_paidamount10,\n paymentAmountCheck: tax.tit_specpay_paidamount20,\n paymentAmountPromissoryNote: tax.tit_specpay_paidamount30,\n paymentAmountAccountsReceivable: tax.tit_specpay_paidamount40,\n supplyAmount: tax.tit_specsum_chargeamount,\n taxAmount: tax.tit_specsum_taxamount,\n totalAmount: tax.tit_specsum_grandamount\n }\n\n // 세금계산서 아이템 데이터 객체 생성\n const newTaxInvoiceItem: NewTaxInvoiceItem[] = []\n for (let item of tax.tAliceItemList) {\n newTaxInvoiceItem.push({\n sequence: item.tii_seqnumeric,\n supplyDate: this._dateFormat(item.tii_purchaseexpirydatetime),\n itemName: item.tii_nametext,\n specification: item.tii_informationtext,\n quantity: item.tii_chargeableunitquantity,\n unitPrice: item.tii_unitprice_unitamount,\n supplyPrice: item.tii_invoiceamount,\n taxPrice: item.tii_totaltax_calcamount,\n remark: item.tii_descriptiontext\n })\n }\n\n // Insert\n this.createTaxInvoice(newTaxInvoice, newTaxInvoiceItem, context)\n\n // API 결과 회신 데이터 생성\n insertedData.push({\n aid: aid,\n tax_type: tax.category == Category.EXPORT ? UnipostTaxType.EXPORT : UnipostTaxType.IMPORT,\n tid_issueid: tax.tid_issueid,\n success: true,\n message: ''\n })\n }\n\n // 유니 포스트에 조회 후 결과 회신 API 호출\n callTaxInvoiceConfirm(businessRegistrationNumber, aid, bearer, insertedData)\n\n return true\n }\n\n // YYYYMMDD => YYYY-MM-DD\n private _dateFormat = date => date.replace(/(\\d{4})(\\d{2})(\\d{2})/g, '$1-$2-$3')\n}\n"]}
|
|
@@ -33,11 +33,11 @@ tslib_1.__decorate([
|
|
|
33
33
|
], NewTaxInvoice.prototype, "originalApprovalNo", void 0);
|
|
34
34
|
tslib_1.__decorate([
|
|
35
35
|
(0, type_graphql_1.Field)({ nullable: false }),
|
|
36
|
-
tslib_1.__metadata("design:type",
|
|
36
|
+
tslib_1.__metadata("design:type", String)
|
|
37
37
|
], NewTaxInvoice.prototype, "issueDate", void 0);
|
|
38
38
|
tslib_1.__decorate([
|
|
39
39
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
40
|
-
tslib_1.__metadata("design:type",
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
41
|
], NewTaxInvoice.prototype, "signatureDate", void 0);
|
|
42
42
|
tslib_1.__decorate([
|
|
43
43
|
(0, type_graphql_1.Field)({ nullable: false }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice/tax-invoice-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,+CAAuH;AACvH,iDAAoD;AAG7C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAmMzB,CAAA;AAlMC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,E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import { BusinessRegistrationCategory, Category, InvoiceType, Purpose, RevisedReason, TaxInvoice } from './tax-invoice'\nimport { ScalarObject } from '@things-factory/shell'\n\n@InputType()\nexport class NewTaxInvoice {\n @Field({ nullable: true })\n memo?: string\n\n @Field({ nullable: true })\n apiRefId?: string\n\n @Field({ nullable: false })\n category: Category\n\n @Field({ nullable: true })\n issueNo?: string\n\n @Field({ nullable: true })\n approvalNo?: string\n\n @Field({ nullable: true })\n originalApprovalNo?: string\n\n @Field({ nullable: false })\n issueDate: Date\n\n @Field({ nullable: true })\n signatureDate: Date\n\n @Field({ nullable: false })\n invoiceType: InvoiceType\n\n @Field({ nullable: false })\n purpose: Purpose\n\n @Field({ nullable: true })\n revisedReason?: RevisedReason\n\n @Field({ nullable: true })\n remark0?: string\n\n @Field({ nullable: true })\n remark1?: string\n\n @Field({ nullable: true })\n remark2?: string\n\n @Field({ nullable: true })\n supplierBusinessRegistrationCategory: BusinessRegistrationCategory\n\n @Field({ nullable: false })\n supplierBusinessRegistrationNumber: string\n\n @Field({ nullable: true })\n supplierBranchIdentification?: string\n\n @Field({ nullable: false })\n supplierBusinessName: string\n\n @Field({ nullable: false })\n supplierRepresentativeName: string\n\n @Field({ nullable: true })\n supplierAddress?: string\n\n @Field({ nullable: true })\n supplierBusinessType?: string\n\n @Field({ nullable: true })\n supplierIndustryType?: string\n\n @Field({ nullable: true })\n supplierDepartment?: string\n\n @Field({ nullable: true })\n supplierContactName?: string\n\n @Field({ nullable: true })\n supplierContactPhone?: string\n\n @Field({ nullable: true })\n supplierContactEmail?: string\n\n @Field({ nullable: true })\n supplierContactCellPhone?: string\n\n @Field({ nullable: true })\n buyerBusinessRegistrationCategory: BusinessRegistrationCategory\n\n @Field({ nullable: false })\n buyerBusinessRegistrationNumber: string\n\n @Field({ nullable: true })\n buyerBranchIdentification?: string\n\n @Field({ nullable: false })\n buyerBusinessName: string\n\n @Field({ nullable: false })\n buyerRepresentativeName: string\n\n @Field({ nullable: true })\n buyerAddress?: string\n\n @Field({ nullable: true })\n buyerBusinessType?: string\n\n @Field({ nullable: true })\n buyerIndustryType?: string\n\n @Field({ nullable: true })\n buyer1stDepartment?: string\n\n @Field({ nullable: true })\n buyer1stContactName?: string\n\n @Field({ nullable: true })\n buyer1stContactPhone?: string\n\n @Field({ nullable: true })\n buyer1stContactEmail?: string\n\n @Field({ nullable: true })\n buyer1stContactCellPhone?: string\n\n @Field({ nullable: true })\n buyer2ndDepartment?: string\n\n @Field({ nullable: true })\n buyer2ndContactName?: string\n\n @Field({ nullable: true })\n buyer2ndContactPhone?: string\n\n @Field({ nullable: true })\n buyer2ndContactEmail?: string\n\n @Field({ nullable: true })\n buyer2ndContactCellPhone?: string\n\n @Field({ nullable: true })\n agentBusinessRegistrationCategory?: BusinessRegistrationCategory\n\n @Field({ nullable: true })\n agentBusinessRegistrationNumber?: string\n\n @Field({ nullable: true })\n agentBranchIdentification?: string\n\n @Field({ nullable: true })\n agentBusinessName?: string\n\n @Field({ nullable: true })\n agentRepresentativeName?: string\n\n @Field({ nullable: true })\n agentAddress?: string\n\n @Field({ nullable: true })\n agentBusinessType?: string\n\n @Field({ nullable: true })\n agentIndustryType?: string\n\n @Field({ nullable: true })\n agentDepartment?: string\n\n @Field({ nullable: true })\n agentContactName?: string\n\n @Field({ nullable: true })\n agentContactPhone?: string\n\n @Field({ nullable: true })\n agentContactEmail?: string\n\n @Field({ nullable: true })\n agentContactCellPhone?: string\n\n @Field(type => Int, { nullable: true })\n paymentAmountCash?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountCheck?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountPromissoryNote?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountAccountsReceivable?: number\n\n @Field(type => Int, { nullable: false })\n supplyAmount: number\n\n @Field(type => Int, { nullable: true })\n taxAmount: number\n\n @Field(type => Int, { nullable: false })\n totalAmount: number\n}\n\n@InputType()\nexport class TaxInvoicePatch {\n @Field(type => ID, { nullable: false })\n id?: string\n\n @Field({ nullable: true })\n memo?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TaxInvoiceList {\n @Field(type => [TaxInvoice])\n items: TaxInvoice[]\n\n @Field(type => Int)\n total: number\n}\n\n@ObjectType()\nexport class TaxInvoiceSummary {\n @Field(type => ScalarObject)\n summary: {\n supply_amount: number\n tax_amount: number\n total_amount: number\n cnt: number\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tax-invoice-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice/tax-invoice-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,+CAAuH;AACvH,iDAAoD;AAG7C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAmMzB,CAAA;AAlMC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACT;AAEjB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;+CACT;AAElB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACP;AAEnB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACC;AAE3B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;gDACV;AAEjB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACL;AAErB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;kDACH;AAExB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACX;AAEhB;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S3B;AATY,0CAAe;AAYrB,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wBAAU,CAAC,CAAC;;6CACT;AAEnB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;AALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B;AANY,wCAAc;AASpB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAQ7B,CAAA;AAPC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,CAAC;;kDAM3B;AAPU,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAQ7B;AARY,8CAAiB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { BusinessRegistrationCategory, Category, InvoiceType, Purpose, RevisedReason, TaxInvoice } from './tax-invoice'\nimport { ScalarObject } from '@things-factory/shell'\n\n@InputType()\nexport class NewTaxInvoice {\n @Field({ nullable: true })\n memo?: string\n\n @Field({ nullable: true })\n apiRefId?: string\n\n @Field({ nullable: false })\n category: Category\n\n @Field({ nullable: true })\n issueNo?: string\n\n @Field({ nullable: true })\n approvalNo?: string\n\n @Field({ nullable: true })\n originalApprovalNo?: string\n\n @Field({ nullable: false })\n issueDate: string\n\n @Field({ nullable: true })\n signatureDate: string\n\n @Field({ nullable: false })\n invoiceType: InvoiceType\n\n @Field({ nullable: false })\n purpose: Purpose\n\n @Field({ nullable: true })\n revisedReason?: RevisedReason\n\n @Field({ nullable: true })\n remark0?: string\n\n @Field({ nullable: true })\n remark1?: string\n\n @Field({ nullable: true })\n remark2?: string\n\n @Field({ nullable: true })\n supplierBusinessRegistrationCategory: BusinessRegistrationCategory\n\n @Field({ nullable: false })\n supplierBusinessRegistrationNumber: string\n\n @Field({ nullable: true })\n supplierBranchIdentification?: string\n\n @Field({ nullable: false })\n supplierBusinessName: string\n\n @Field({ nullable: false })\n supplierRepresentativeName: string\n\n @Field({ nullable: true })\n supplierAddress?: string\n\n @Field({ nullable: true })\n supplierBusinessType?: string\n\n @Field({ nullable: true })\n supplierIndustryType?: string\n\n @Field({ nullable: true })\n supplierDepartment?: string\n\n @Field({ nullable: true })\n supplierContactName?: string\n\n @Field({ nullable: true })\n supplierContactPhone?: string\n\n @Field({ nullable: true })\n supplierContactEmail?: string\n\n @Field({ nullable: true })\n supplierContactCellPhone?: string\n\n @Field({ nullable: true })\n buyerBusinessRegistrationCategory: BusinessRegistrationCategory\n\n @Field({ nullable: false })\n buyerBusinessRegistrationNumber: string\n\n @Field({ nullable: true })\n buyerBranchIdentification?: string\n\n @Field({ nullable: false })\n buyerBusinessName: string\n\n @Field({ nullable: false })\n buyerRepresentativeName: string\n\n @Field({ nullable: true })\n buyerAddress?: string\n\n @Field({ nullable: true })\n buyerBusinessType?: string\n\n @Field({ nullable: true })\n buyerIndustryType?: string\n\n @Field({ nullable: true })\n buyer1stDepartment?: string\n\n @Field({ nullable: true })\n buyer1stContactName?: string\n\n @Field({ nullable: true })\n buyer1stContactPhone?: string\n\n @Field({ nullable: true })\n buyer1stContactEmail?: string\n\n @Field({ nullable: true })\n buyer1stContactCellPhone?: string\n\n @Field({ nullable: true })\n buyer2ndDepartment?: string\n\n @Field({ nullable: true })\n buyer2ndContactName?: string\n\n @Field({ nullable: true })\n buyer2ndContactPhone?: string\n\n @Field({ nullable: true })\n buyer2ndContactEmail?: string\n\n @Field({ nullable: true })\n buyer2ndContactCellPhone?: string\n\n @Field({ nullable: true })\n agentBusinessRegistrationCategory?: BusinessRegistrationCategory\n\n @Field({ nullable: true })\n agentBusinessRegistrationNumber?: string\n\n @Field({ nullable: true })\n agentBranchIdentification?: string\n\n @Field({ nullable: true })\n agentBusinessName?: string\n\n @Field({ nullable: true })\n agentRepresentativeName?: string\n\n @Field({ nullable: true })\n agentAddress?: string\n\n @Field({ nullable: true })\n agentBusinessType?: string\n\n @Field({ nullable: true })\n agentIndustryType?: string\n\n @Field({ nullable: true })\n agentDepartment?: string\n\n @Field({ nullable: true })\n agentContactName?: string\n\n @Field({ nullable: true })\n agentContactPhone?: string\n\n @Field({ nullable: true })\n agentContactEmail?: string\n\n @Field({ nullable: true })\n agentContactCellPhone?: string\n\n @Field(type => Int, { nullable: true })\n paymentAmountCash?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountCheck?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountPromissoryNote?: number\n\n @Field(type => Int, { nullable: true })\n paymentAmountAccountsReceivable?: number\n\n @Field(type => Int, { nullable: false })\n supplyAmount: number\n\n @Field(type => Int, { nullable: true })\n taxAmount: number\n\n @Field(type => Int, { nullable: false })\n totalAmount: number\n}\n\n@InputType()\nexport class TaxInvoicePatch {\n @Field(type => ID, { nullable: false })\n id?: string\n\n @Field({ nullable: true })\n memo?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TaxInvoiceList {\n @Field(type => [TaxInvoice])\n items: TaxInvoice[]\n\n @Field(type => Int)\n total: number\n}\n\n@ObjectType()\nexport class TaxInvoiceSummary {\n @Field(type => ScalarObject)\n summary: {\n supply_amount: number\n tax_amount: number\n total_amount: number\n cnt: number\n }\n}\n"]}
|
|
@@ -6,6 +6,9 @@ const type_graphql_1 = require("type-graphql");
|
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
7
7
|
const tax_invoice_api_1 = require("./tax-invoice-api");
|
|
8
8
|
const tax_invoice_api_type_1 = require("./tax-invoice-api-type");
|
|
9
|
+
const tax_invoice_item_1 = require("../tax-invoice-item/tax-invoice-item");
|
|
10
|
+
const tax_invoice_1 = require("../tax-invoice/tax-invoice");
|
|
11
|
+
const tax_invoice_send_1 = require("../unipost-api/tax-invoice-send");
|
|
9
12
|
let TaxInvoiceApiMutation = class TaxInvoiceApiMutation {
|
|
10
13
|
async updateMultipleTaxInvoiceApi(patch, context) {
|
|
11
14
|
const { domain, user, tx } = context.state;
|
|
@@ -30,6 +33,140 @@ let TaxInvoiceApiMutation = class TaxInvoiceApiMutation {
|
|
|
30
33
|
});
|
|
31
34
|
return true;
|
|
32
35
|
}
|
|
36
|
+
async sendTaxInvoicesByApi(taxInvoiceSendList, context) {
|
|
37
|
+
if (taxInvoiceSendList.length === 0)
|
|
38
|
+
throw new Error('tax invoice send exception: no list');
|
|
39
|
+
const { domain, user, tx } = context.state;
|
|
40
|
+
const taxInvoiceRepo = tx.getRepository(tax_invoice_1.TaxInvoice);
|
|
41
|
+
const taxInvoiceItemRepo = tx.getRepository(tax_invoice_item_1.TaxInvoiceItem);
|
|
42
|
+
const taxInvoiceApiRepo = tx.getRepository(tax_invoice_api_1.TaxInvoiceApi);
|
|
43
|
+
const apiInfo = (await taxInvoiceApiRepo.find()).at(0);
|
|
44
|
+
const businessRegistrationNumber = apiInfo.businessRegistrationNumber;
|
|
45
|
+
const { aid = '', bearer = '', customer_no = '' } = apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.attributes;
|
|
46
|
+
console.log(apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.attributes);
|
|
47
|
+
// 밸리데이션 및 데이터 파싱
|
|
48
|
+
let newTaxInvoiceSendList = taxInvoiceSendList.map(taxInvoiceSend => this._parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no));
|
|
49
|
+
// 세금계산서 발행 API 호출
|
|
50
|
+
const apiResult = (0, tax_invoice_send_1.sendTaxInvoiceByUniposApi)(businessRegistrationNumber, aid, bearer, newTaxInvoiceSendList);
|
|
51
|
+
if (!apiResult) {
|
|
52
|
+
throw new Error('tax invoice send exception: api problem');
|
|
53
|
+
}
|
|
54
|
+
// 세금계산서 저장 리졸버 호출
|
|
55
|
+
// createTaxInvoice
|
|
56
|
+
return apiResult;
|
|
57
|
+
}
|
|
58
|
+
_parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no) {
|
|
59
|
+
const { taxInvoice, taxInvoiceItems } = taxInvoiceSend;
|
|
60
|
+
let newTaxInvoiceItems = [];
|
|
61
|
+
const today = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date()); // YYYY-MM-DD
|
|
62
|
+
// 필수값 체크
|
|
63
|
+
if (!taxInvoice.supplierBusinessRegistrationNumber ||
|
|
64
|
+
!taxInvoice.supplierBusinessName ||
|
|
65
|
+
!taxInvoice.supplierRepresentativeName ||
|
|
66
|
+
!taxInvoice.buyerBusinessRegistrationNumber ||
|
|
67
|
+
!taxInvoice.buyerBusinessName ||
|
|
68
|
+
!taxInvoice.buyerRepresentativeName ||
|
|
69
|
+
!taxInvoice.issueDate) {
|
|
70
|
+
throw new Error('tax invoice send exception: no essential value');
|
|
71
|
+
}
|
|
72
|
+
// 작성일자가 오늘 날짜를 넘어가면 에러
|
|
73
|
+
if (taxInvoice.issueDate > today) {
|
|
74
|
+
throw new Error('tax invoice send exception: issueDate error');
|
|
75
|
+
}
|
|
76
|
+
// 현금, 수표, 어음, 외상미수금이 있을시 총 합계금액과 금액 동일 체크
|
|
77
|
+
const paymentAmount = taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable;
|
|
78
|
+
if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
|
|
79
|
+
throw new Error('tax invoice send exception: summary is not same');
|
|
80
|
+
}
|
|
81
|
+
for (let item of taxInvoiceItems) {
|
|
82
|
+
// 아이템 필수값 체크
|
|
83
|
+
if (!item.supplyDate || !item.itemName || !item.quantity || !item.unitPrice) {
|
|
84
|
+
throw new Error('tax invoice send exception: no item essential value');
|
|
85
|
+
}
|
|
86
|
+
// 아이템의 일자가 작성일자보다 크면 에러
|
|
87
|
+
if (taxInvoice.issueDate < item.supplyDate) {
|
|
88
|
+
throw new Error('tax invoice send exception: item supplyDate is bigger than issueDate');
|
|
89
|
+
}
|
|
90
|
+
newTaxInvoiceItems.push({
|
|
91
|
+
tii_seqnumeric: item.sequence,
|
|
92
|
+
tii_purchaseexpirydatetime: item.supplyDate.replace(/-/g, ''),
|
|
93
|
+
tii_nametext: item.itemName,
|
|
94
|
+
tii_informationtext: item.specification,
|
|
95
|
+
tii_chargeableunitquantity: item.quantity,
|
|
96
|
+
tii_unitprice_unitamount: item.unitPrice,
|
|
97
|
+
tii_invoiceamount: item.supplyPrice,
|
|
98
|
+
tii_totaltax_calcamount: item.taxPrice,
|
|
99
|
+
tii_descriptiontext: item.remark
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
aid: aid,
|
|
104
|
+
inv_seq: today.replace(/-/g, '') + customer_no,
|
|
105
|
+
exd_refdoc_id: null,
|
|
106
|
+
tid_issuedatetime: taxInvoice.issueDate.replace(/-/g, ''),
|
|
107
|
+
tid_typecode: taxInvoice.invoiceType,
|
|
108
|
+
tid_purposecode: taxInvoice.purpose,
|
|
109
|
+
tid_amendcode: taxInvoice.revisedReason,
|
|
110
|
+
tid_originalissueid: null,
|
|
111
|
+
tid_desc0: taxInvoice.remark0,
|
|
112
|
+
tid_desc1: null,
|
|
113
|
+
tid_desc2: null,
|
|
114
|
+
tit_alice_specorg_biztypecode: taxInvoice.supplierBusinessRegistrationCategory,
|
|
115
|
+
tit_alice_id: taxInvoice.supplierBusinessRegistrationNumber,
|
|
116
|
+
tit_alice_specorg_taxregid: taxInvoice.supplierBranchIdentification,
|
|
117
|
+
tit_alice_name: taxInvoice.supplierBusinessName,
|
|
118
|
+
tit_alice_specperson_name: taxInvoice.supplierRepresentativeName,
|
|
119
|
+
tit_alice_specaddr_lineone: taxInvoice.supplierAddress,
|
|
120
|
+
tit_alice_typecode: taxInvoice.supplierBusinessType,
|
|
121
|
+
tit_alice_classcode: taxInvoice.supplierIndustryType,
|
|
122
|
+
tit_alice_defcont_deptname: taxInvoice.supplierDepartment,
|
|
123
|
+
tit_alice_defcont_personname: taxInvoice.supplierContactName,
|
|
124
|
+
tit_alice_defcont_telcomm: taxInvoice.supplierContactPhone,
|
|
125
|
+
tit_alice_defcont_uricomm: taxInvoice.supplierContactEmail,
|
|
126
|
+
tit_alice_defcont_cellphone: taxInvoice.supplierContactCellPhone,
|
|
127
|
+
tit_bob_specorg_biztypecode: taxInvoice.buyerBusinessRegistrationCategory,
|
|
128
|
+
tit_bob_id: taxInvoice.buyerBusinessRegistrationNumber,
|
|
129
|
+
tit_bob_specorg_taxregid: taxInvoice.buyerBranchIdentification,
|
|
130
|
+
tit_bob_name: taxInvoice.buyerBusinessName,
|
|
131
|
+
tit_bob_specperson_name: taxInvoice.buyerRepresentativeName,
|
|
132
|
+
tit_bob_specaddr_lineone: taxInvoice.buyerAddress,
|
|
133
|
+
tit_bob_typecode: taxInvoice.buyerBusinessType,
|
|
134
|
+
tit_bob_classcode: taxInvoice.buyerIndustryType,
|
|
135
|
+
tit_bob_1stdefcont_deptname: taxInvoice.buyer1stDepartment,
|
|
136
|
+
tit_bob_1stdefcont_personname: taxInvoice.buyer1stContactName,
|
|
137
|
+
tit_bob_1stdefcont_telcomm: taxInvoice.buyer1stContactPhone,
|
|
138
|
+
tit_bob_1stdefcont_uricomm: taxInvoice.buyer1stContactEmail,
|
|
139
|
+
tit_bob_1stdefcont_cellphone: taxInvoice.buyer1stContactCellPhone,
|
|
140
|
+
tit_bob_2nddefcont_deptname: taxInvoice.buyer2ndDepartment,
|
|
141
|
+
tit_bob_2nddefcont_personname: taxInvoice.buyer2ndContactName,
|
|
142
|
+
tit_bob_2nddefcont_telcomm: taxInvoice.buyer2ndContactPhone,
|
|
143
|
+
tit_bob_2nddefcont_uricomm: taxInvoice.buyer2ndContactEmail,
|
|
144
|
+
tit_bob_2nddefcont_cellphone: taxInvoice.buyer2ndContactCellPhone,
|
|
145
|
+
tit_broker_specorg_biztypecode: taxInvoice.agentBusinessRegistrationCategory,
|
|
146
|
+
tit_broker_id: taxInvoice.agentBusinessRegistrationNumber,
|
|
147
|
+
tit_broker_specorg_taxregid: taxInvoice.agentBranchIdentification,
|
|
148
|
+
tit_broker_name: taxInvoice.agentBusinessName,
|
|
149
|
+
tit_broker_specperson_name: taxInvoice.agentRepresentativeName,
|
|
150
|
+
tit_broker_specaddr_lineone: taxInvoice.agentAddress,
|
|
151
|
+
tit_broker_typecode: taxInvoice.agentBusinessType,
|
|
152
|
+
tit_broker_classcode: taxInvoice.agentIndustryType,
|
|
153
|
+
tit_broker_defcont_deptname: taxInvoice.agentDepartment,
|
|
154
|
+
tit_broker_defcont_personname: taxInvoice.agentContactName,
|
|
155
|
+
tit_broker_defcont_telcomm: taxInvoice.agentContactPhone,
|
|
156
|
+
tit_broker_defcont_uricomm: taxInvoice.agentContactEmail,
|
|
157
|
+
tit_broker_defcont_cellphone: taxInvoice.agentContactCellPhone,
|
|
158
|
+
tit_specpay_paidamount10: taxInvoice.paymentAmountCash,
|
|
159
|
+
tit_specpay_paidamount20: taxInvoice.paymentAmountCheck,
|
|
160
|
+
tit_specpay_paidamount30: taxInvoice.paymentAmountPromissoryNote,
|
|
161
|
+
tit_specpay_paidamount40: taxInvoice.paymentAmountAccountsReceivable,
|
|
162
|
+
tit_specsum_chargeamount: taxInvoice.supplyAmount,
|
|
163
|
+
tit_specsum_taxamount: taxInvoice.taxAmount,
|
|
164
|
+
tit_specsum_grandamount: taxInvoice.totalAmount,
|
|
165
|
+
inv_sign: '',
|
|
166
|
+
biz_tocharlesconfirmstatus: null,
|
|
167
|
+
tAliceItemList: newTaxInvoiceItems
|
|
168
|
+
};
|
|
169
|
+
}
|
|
33
170
|
};
|
|
34
171
|
tslib_1.__decorate([
|
|
35
172
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
@@ -49,6 +186,15 @@ tslib_1.__decorate([
|
|
|
49
186
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
50
187
|
tslib_1.__metadata("design:returntype", Promise)
|
|
51
188
|
], TaxInvoiceApiMutation.prototype, "deleteTaxInvoiceApis", null);
|
|
189
|
+
tslib_1.__decorate([
|
|
190
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
191
|
+
(0, type_graphql_1.Mutation)(returns => tax_invoice_api_1.TaxInvoiceApi, { description: 'To Send Tax Invoices By Api' }),
|
|
192
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('taxInvoiceSendList', type => [tax_invoice_api_type_1.TaxInvoiceSend])),
|
|
193
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
194
|
+
tslib_1.__metadata("design:type", Function),
|
|
195
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
196
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
197
|
+
], TaxInvoiceApiMutation.prototype, "sendTaxInvoicesByApi", null);
|
|
52
198
|
TaxInvoiceApiMutation = tslib_1.__decorate([
|
|
53
199
|
(0, type_graphql_1.Resolver)(tax_invoice_api_1.TaxInvoiceApi)
|
|
54
200
|
], TaxInvoiceApiMutation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-api-mutation.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-api/tax-invoice-api-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,uDAAiD;AACjD,iEAA2D;AAGpD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAG1B,AAAN,KAAK,CAAC,2BAA2B,CAA2C,KAAyB,EAAS,OAAwB;QACpI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,iBAAiB,GAAG,EAAE,CAAC,aAAa,CAAC,+BAAa,CAAC,CAAA;QACzD,IAAI,OAAO,CAAA;QAEX,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE;YACtC,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,iCACtC,KAAK,KACR,MAAM,EACN,OAAO,EAAE,IA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Q,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;IACxD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAS7E;AA5CU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,+BAAa,CAAC;GACX,qBAAqB,CA6CjC;AA7CY,sDAAqB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { TaxInvoiceApi } from './tax-invoice-api'\nimport { TaxInvoiceApiPatch } from './tax-invoice-api-type'\n\n@Resolver(TaxInvoiceApi)\nexport class TaxInvoiceApiMutation {\n @Directive('@transaction')\n @Mutation(returns => TaxInvoiceApi, { description: 'To modify Tax Invoice Api information' })\n async updateMultipleTaxInvoiceApi(@Arg('patch', type => TaxInvoiceApiPatch) patch: TaxInvoiceApiPatch, @Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {\n const { domain, user, tx } = context.state\n const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)\n let results\n\n if (patch.cuFlag.toUpperCase() === '+') {\n const result = await taxInvoiceApiRepo.save({\n ...patch,\n domain,\n creator: user,\n updater: user\n })\n\n results = { ...result, cuFlag: '+' }\n }\n\n if (patch.cuFlag.toUpperCase() === 'M') {\n const taxInvoiceApi = await taxInvoiceApiRepo.findOneBy({ id: patch.id })\n const result = await taxInvoiceApiRepo.save({\n ...taxInvoiceApi,\n ...patch,\n updater: user\n })\n\n results = { ...result, cuFlag: 'M' }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Tax Invoice Api' })\n async deleteTaxInvoiceApis(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoiceApi).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tax-invoice-api-mutation.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-api/tax-invoice-api-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,uDAAiD;AACjD,iEAA2E;AAC3E,2EAAqE;AACrE,4DAAuD;AACvD,sEAA2E;AAGpE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAG1B,AAAN,KAAK,CAAC,2BAA2B,CAA2C,KAAyB,EAAS,OAAwB;QACpI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,MAAM,iBAAiB,GAAG,EAAE,CAAC,aAAa,CAAC,+BAAa,CAAC,CAAA;QACzD,IAAI,OAAO,CAAA;QAEX,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE;YACtC,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,iCACtC,KAAK,KACR,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;YAEF,OAAO,mCAAQ,MAAM,KAAE,MAAM,EAAE,GAAG,GAAE,CAAA;SACrC;QAED,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE;YACtC,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;YACzE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,+CACtC,aAAa,GACb,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;YAEF,OAAO,mCAAQ,MAAM,KAAE,MAAM,EAAE,GAAG,GAAE,CAAA;SACrC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAIK,A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AC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAa,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAC1D,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,yCAAkB,CAAC,CAAA;IAA6B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAA1B,yCAAkB;;wEA4BpG;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;IACxD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAS7E;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAa,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAEhF,mBAAA,IAAA,kBAAG,EAAC,oBAAoB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,qCAAc,CAAC,CAAC,CAAA;IACnD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEA2BP;AA7EU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,+BAAa,CAAC;GACX,qBAAqB,CA0MjC;AA1MY,sDAAqB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { TaxInvoiceApi } from './tax-invoice-api'\nimport { TaxInvoiceApiPatch, TaxInvoiceSend } from './tax-invoice-api-type'\nimport { TaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item'\nimport { TaxInvoice } from '../tax-invoice/tax-invoice'\nimport { sendTaxInvoiceByUniposApi } from '../unipost-api/tax-invoice-send'\n\n@Resolver(TaxInvoiceApi)\nexport class TaxInvoiceApiMutation {\n @Directive('@transaction')\n @Mutation(returns => TaxInvoiceApi, { description: 'To modify Tax Invoice Api information' })\n async updateMultipleTaxInvoiceApi(@Arg('patch', type => TaxInvoiceApiPatch) patch: TaxInvoiceApiPatch, @Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {\n const { domain, user, tx } = context.state\n const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)\n let results\n\n if (patch.cuFlag.toUpperCase() === '+') {\n const result = await taxInvoiceApiRepo.save({\n ...patch,\n domain,\n creator: user,\n updater: user\n })\n\n results = { ...result, cuFlag: '+' }\n }\n\n if (patch.cuFlag.toUpperCase() === 'M') {\n const taxInvoiceApi = await taxInvoiceApiRepo.findOneBy({ id: patch.id })\n const result = await taxInvoiceApiRepo.save({\n ...taxInvoiceApi,\n ...patch,\n updater: user\n })\n\n results = { ...result, cuFlag: 'M' }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Tax Invoice Api' })\n async deleteTaxInvoiceApis(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(TaxInvoiceApi).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => TaxInvoiceApi, { description: 'To Send Tax Invoices By Api' })\n async sendTaxInvoicesByApi(\n @Arg('taxInvoiceSendList', type => [TaxInvoiceSend]) taxInvoiceSendList: TaxInvoiceSend[],\n @Ctx() context: ResolverContext\n ): Promise<TaxInvoiceSend[]> {\n if (taxInvoiceSendList.length === 0) throw new Error('tax invoice send exception: no list')\n\n const { domain, user, tx } = context.state\n const taxInvoiceRepo = tx.getRepository(TaxInvoice)\n const taxInvoiceItemRepo = tx.getRepository(TaxInvoiceItem)\n const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)\n\n const apiInfo = (await taxInvoiceApiRepo.find()).at(0)\n const businessRegistrationNumber = apiInfo.businessRegistrationNumber\n const { aid = '', bearer = '', customer_no = '' } = apiInfo?.attributes\n console.log(apiInfo?.attributes)\n\n // 밸리데이션 및 데이터 파싱\n let newTaxInvoiceSendList = taxInvoiceSendList.map(taxInvoiceSend => this._parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no))\n\n // 세금계산서 발행 API 호출\n const apiResult = sendTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer, newTaxInvoiceSendList)\n if (!apiResult) {\n throw new Error('tax invoice send exception: api problem')\n }\n\n // 세금계산서 저장 리졸버 호출\n // createTaxInvoice\n\n return apiResult\n }\n\n private _parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no) {\n const { taxInvoice, taxInvoiceItems } = taxInvoiceSend\n let newTaxInvoiceItems: any = []\n const today = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date()) // YYYY-MM-DD\n\n // 필수값 체크\n if (\n !taxInvoice.supplierBusinessRegistrationNumber ||\n !taxInvoice.supplierBusinessName ||\n !taxInvoice.supplierRepresentativeName ||\n !taxInvoice.buyerBusinessRegistrationNumber ||\n !taxInvoice.buyerBusinessName ||\n !taxInvoice.buyerRepresentativeName ||\n !taxInvoice.issueDate\n ) {\n throw new Error('tax invoice send exception: no essential value')\n }\n\n // 작성일자가 오늘 날짜를 넘어가면 에러\n if (taxInvoice.issueDate > today) {\n throw new Error('tax invoice send exception: issueDate error')\n }\n\n // 현금, 수표, 어음, 외상미수금이 있을시 총 합계금액과 금액 동일 체크\n const paymentAmount: number =\n taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable\n\n if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {\n throw new Error('tax invoice send exception: summary is not same')\n }\n\n for (let item of taxInvoiceItems) {\n // 아이템 필수값 체크\n if (!item.supplyDate || !item.itemName || !item.quantity || !item.unitPrice) {\n throw new Error('tax invoice send exception: no item essential value')\n }\n\n // 아이템의 일자가 작성일자보다 크면 에러\n if (taxInvoice.issueDate < item.supplyDate) {\n throw new Error('tax invoice send exception: item supplyDate is bigger than issueDate')\n }\n\n newTaxInvoiceItems.push({\n tii_seqnumeric: item.sequence,\n tii_purchaseexpirydatetime: item.supplyDate.replace(/-/g, ''),\n tii_nametext: item.itemName,\n tii_informationtext: item.specification,\n tii_chargeableunitquantity: item.quantity,\n tii_unitprice_unitamount: item.unitPrice,\n tii_invoiceamount: item.supplyPrice,\n tii_totaltax_calcamount: item.taxPrice,\n tii_descriptiontext: item.remark\n })\n }\n\n return {\n aid: aid,\n inv_seq: today.replace(/-/g, '') + customer_no,\n exd_refdoc_id: null,\n tid_issuedatetime: taxInvoice.issueDate.replace(/-/g, ''),\n tid_typecode: taxInvoice.invoiceType,\n tid_purposecode: taxInvoice.purpose,\n tid_amendcode: taxInvoice.revisedReason,\n tid_originalissueid: null,\n tid_desc0: taxInvoice.remark0,\n tid_desc1: null,\n tid_desc2: null,\n tit_alice_specorg_biztypecode: taxInvoice.supplierBusinessRegistrationCategory,\n tit_alice_id: taxInvoice.supplierBusinessRegistrationNumber,\n tit_alice_specorg_taxregid: taxInvoice.supplierBranchIdentification,\n tit_alice_name: taxInvoice.supplierBusinessName,\n tit_alice_specperson_name: taxInvoice.supplierRepresentativeName,\n tit_alice_specaddr_lineone: taxInvoice.supplierAddress,\n tit_alice_typecode: taxInvoice.supplierBusinessType,\n tit_alice_classcode: taxInvoice.supplierIndustryType,\n tit_alice_defcont_deptname: taxInvoice.supplierDepartment,\n tit_alice_defcont_personname: taxInvoice.supplierContactName,\n tit_alice_defcont_telcomm: taxInvoice.supplierContactPhone,\n tit_alice_defcont_uricomm: taxInvoice.supplierContactEmail,\n tit_alice_defcont_cellphone: taxInvoice.supplierContactCellPhone,\n tit_bob_specorg_biztypecode: taxInvoice.buyerBusinessRegistrationCategory,\n tit_bob_id: taxInvoice.buyerBusinessRegistrationNumber,\n tit_bob_specorg_taxregid: taxInvoice.buyerBranchIdentification,\n tit_bob_name: taxInvoice.buyerBusinessName,\n tit_bob_specperson_name: taxInvoice.buyerRepresentativeName,\n tit_bob_specaddr_lineone: taxInvoice.buyerAddress,\n tit_bob_typecode: taxInvoice.buyerBusinessType,\n tit_bob_classcode: taxInvoice.buyerIndustryType,\n tit_bob_1stdefcont_deptname: taxInvoice.buyer1stDepartment,\n tit_bob_1stdefcont_personname: taxInvoice.buyer1stContactName,\n tit_bob_1stdefcont_telcomm: taxInvoice.buyer1stContactPhone,\n tit_bob_1stdefcont_uricomm: taxInvoice.buyer1stContactEmail,\n tit_bob_1stdefcont_cellphone: taxInvoice.buyer1stContactCellPhone,\n tit_bob_2nddefcont_deptname: taxInvoice.buyer2ndDepartment,\n tit_bob_2nddefcont_personname: taxInvoice.buyer2ndContactName,\n tit_bob_2nddefcont_telcomm: taxInvoice.buyer2ndContactPhone,\n tit_bob_2nddefcont_uricomm: taxInvoice.buyer2ndContactEmail,\n tit_bob_2nddefcont_cellphone: taxInvoice.buyer2ndContactCellPhone,\n tit_broker_specorg_biztypecode: taxInvoice.agentBusinessRegistrationCategory,\n tit_broker_id: taxInvoice.agentBusinessRegistrationNumber,\n tit_broker_specorg_taxregid: taxInvoice.agentBranchIdentification,\n tit_broker_name: taxInvoice.agentBusinessName,\n tit_broker_specperson_name: taxInvoice.agentRepresentativeName,\n tit_broker_specaddr_lineone: taxInvoice.agentAddress,\n tit_broker_typecode: taxInvoice.agentBusinessType,\n tit_broker_classcode: taxInvoice.agentIndustryType,\n tit_broker_defcont_deptname: taxInvoice.agentDepartment,\n tit_broker_defcont_personname: taxInvoice.agentContactName,\n tit_broker_defcont_telcomm: taxInvoice.agentContactPhone,\n tit_broker_defcont_uricomm: taxInvoice.agentContactEmail,\n tit_broker_defcont_cellphone: taxInvoice.agentContactCellPhone,\n tit_specpay_paidamount10: taxInvoice.paymentAmountCash,\n tit_specpay_paidamount20: taxInvoice.paymentAmountCheck,\n tit_specpay_paidamount30: taxInvoice.paymentAmountPromissoryNote,\n tit_specpay_paidamount40: taxInvoice.paymentAmountAccountsReceivable,\n tit_specsum_chargeamount: taxInvoice.supplyAmount,\n tit_specsum_taxamount: taxInvoice.taxAmount,\n tit_specsum_grandamount: taxInvoice.totalAmount,\n inv_sign: '',\n biz_tocharlesconfirmstatus: null,\n tAliceItemList: newTaxInvoiceItems\n }\n }\n}\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaxInvoiceApiList = exports.TaxInvoiceApiPatch = void 0;
|
|
3
|
+
exports.TaxInvoiceSend = exports.TaxInvoiceApiList = exports.TaxInvoiceApiPatch = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const tax_invoice_api_1 = require("./tax-invoice-api");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const tax_invoice_type_1 = require("../tax-invoice/tax-invoice-type");
|
|
9
|
+
const tax_invoice_item_type_1 = require("../tax-invoice-item/tax-invoice-item-type");
|
|
8
10
|
let TaxInvoiceApiPatch = class TaxInvoiceApiPatch {
|
|
9
11
|
};
|
|
10
12
|
tslib_1.__decorate([
|
|
@@ -105,4 +107,18 @@ TaxInvoiceApiList = tslib_1.__decorate([
|
|
|
105
107
|
(0, type_graphql_1.ObjectType)()
|
|
106
108
|
], TaxInvoiceApiList);
|
|
107
109
|
exports.TaxInvoiceApiList = TaxInvoiceApiList;
|
|
110
|
+
let TaxInvoiceSend = class TaxInvoiceSend {
|
|
111
|
+
};
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, type_graphql_1.Field)(type => tax_invoice_type_1.NewTaxInvoice),
|
|
114
|
+
tslib_1.__metadata("design:type", tax_invoice_type_1.NewTaxInvoice)
|
|
115
|
+
], TaxInvoiceSend.prototype, "taxInvoice", void 0);
|
|
116
|
+
tslib_1.__decorate([
|
|
117
|
+
(0, type_graphql_1.Field)(type => [tax_invoice_item_type_1.NewTaxInvoiceItem]),
|
|
118
|
+
tslib_1.__metadata("design:type", Array)
|
|
119
|
+
], TaxInvoiceSend.prototype, "taxInvoiceItems", void 0);
|
|
120
|
+
TaxInvoiceSend = tslib_1.__decorate([
|
|
121
|
+
(0, type_graphql_1.InputType)()
|
|
122
|
+
], TaxInvoiceSend);
|
|
123
|
+
exports.TaxInvoiceSend = TaxInvoiceSend;
|
|
108
124
|
//# sourceMappingURL=tax-invoice-api-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-api-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-api/tax-invoice-api-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,uDAAiD;AACjD,iDAAoD;
|
|
1
|
+
{"version":3,"file":"tax-invoice-api-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-api/tax-invoice-api-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,uDAAiD;AACjD,iDAAoD;AACpD,sEAA+D;AAC/D,qFAA6E;AAGtE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CA4D9B,CAAA;AA3DC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACX;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACL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ACC,kBAAkB,CA4D9B;AA5DY,gDAAkB;AA+DxB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAa,CAAC,CAAC;;gDACT;AAEtB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;gDACN;AALF,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAM7B;AANY,8CAAiB;AASvB,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gCAAa,CAAC;sCAChB,gCAAa;kDAAA;AAE1B;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yCAAiB,CAAC,CAAC;;uDACE;AAL1B,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAM1B;AANY,wCAAc","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { TaxInvoiceApi } from './tax-invoice-api'\nimport { ScalarObject } from '@things-factory/shell'\nimport { NewTaxInvoice } from '../tax-invoice/tax-invoice-type'\nimport { NewTaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item-type'\n\n@InputType()\nexport class TaxInvoiceApiPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n apiKey?: string\n\n @Field({ nullable: true })\n apiAccountId?: string\n\n @Field({ nullable: true })\n apiAccountPassword?: string\n\n @Field({ nullable: true })\n businessRegistrationNumber?: string\n\n @Field({ nullable: true })\n branchIdentification?: string\n\n @Field({ nullable: true })\n businessName?: string\n\n @Field({ nullable: true })\n representativeName?: string\n\n @Field({ nullable: true })\n address?: string\n\n @Field({ nullable: true })\n businessType?: string\n\n @Field({ nullable: true })\n industryType?: string\n\n @Field({ nullable: true })\n department?: string\n\n @Field({ nullable: true })\n contactName?: string\n\n @Field({ nullable: true })\n contactPhone?: string\n\n @Field({ nullable: true })\n contactEmail?: string\n\n @Field({ nullable: true })\n contactCellPhone?: string\n\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TaxInvoiceApiList {\n @Field(type => [TaxInvoiceApi])\n items: TaxInvoiceApi[]\n\n @Field(type => Int)\n total: number\n}\n\n@InputType()\nexport class TaxInvoiceSend {\n @Field(type => NewTaxInvoice)\n taxInvoice!: NewTaxInvoice\n\n @Field(type => [NewTaxInvoiceItem])\n taxInvoiceItems!: NewTaxInvoiceItem[]\n}\n"]}
|
|
@@ -12,7 +12,7 @@ tslib_1.__decorate([
|
|
|
12
12
|
], NewTaxInvoiceItem.prototype, "sequence", void 0);
|
|
13
13
|
tslib_1.__decorate([
|
|
14
14
|
(0, type_graphql_1.Field)({ nullable: false, description: '공급년월일(YYYY-MM-DD)' }),
|
|
15
|
-
tslib_1.__metadata("design:type",
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
16
|
], NewTaxInvoiceItem.prototype, "supplyDate", void 0);
|
|
17
17
|
tslib_1.__decorate([
|
|
18
18
|
(0, type_graphql_1.Field)({ nullable: false, description: '품목명' }),
|
|
@@ -58,7 +58,7 @@ tslib_1.__decorate([
|
|
|
58
58
|
], TaxInvoiceItemPatch.prototype, "sequence", void 0);
|
|
59
59
|
tslib_1.__decorate([
|
|
60
60
|
(0, type_graphql_1.Field)({ nullable: false, description: '공급년월일(YYYY-MM-DD)' }),
|
|
61
|
-
tslib_1.__metadata("design:type",
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
62
|
], TaxInvoiceItemPatch.prototype, "supplyDate", void 0);
|
|
63
63
|
tslib_1.__decorate([
|
|
64
64
|
(0, type_graphql_1.Field)({ nullable: false, description: '품목명' }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-item-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-item/tax-invoice-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,yDAAmD;AAG5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CA2B7B,CAAA;AA1BC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;mDACjD;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"tax-invoice-item-type.js","sourceRoot":"","sources":["../../../server/service/tax-invoice-item/tax-invoice-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,yDAAmD;AAG5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CA2B7B,CAAA;AA1BC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;mDACjD;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;qDAC3C;AAElB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;;mDAC/B;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;;wDACzB;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;mDACzD;AAEhB;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AAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;qDACzD;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;sDACxD;AAEjB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;;wDAC1C;AAEnB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;;qDAC3C;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;;mDAC9B;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACX;AAhCJ,mBAAmB;IAD/B,IAAA,wBAAS,GAAE;GACC,mBAAmB,CAiC/B;AAjCY,kDAAmB;AAoCzB,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAM9B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iCAAc,CAAC,CAAC;;iDACT;AAEvB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;iDACN;AALF,kBAAkB;IAD9B,IAAA,yBAAU,GAAE;GACA,kBAAkB,CAM9B;AANY,gDAAkB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { TaxInvoiceItem } from './tax-invoice-item'\n\n@InputType()\nexport class NewTaxInvoiceItem {\n @Field(type => Int, { nullable: false, description: '아이템 일련번호' })\n sequence: number\n\n @Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })\n supplyDate: string\n\n @Field({ nullable: false, description: '품목명' })\n itemName: string\n\n @Field({ nullable: false, description: '규격' })\n specification: string\n\n @Field(type => Int, { nullable: false, description: '수량(소수점 2자리까지 허용)' })\n quantity: number\n\n @Field(type => Int, { nullable: false, description: '단가(소수점 2자리까지 허용)' })\n unitPrice: number\n\n @Field(type => Int, { nullable: false, description: '공급가액' })\n supplyPrice: number\n\n @Field(type => Int, { nullable: false, description: '세액' })\n taxPrice: number\n\n @Field({ nullable: true, description: '비고' })\n remark?: string\n}\n\n@InputType()\nexport class TaxInvoiceItemPatch {\n @Field(type => ID, { nullable: false })\n id?: string\n\n @Field(type => Int, { nullable: false, description: '아이템 일련번호' })\n sequence: number\n\n @Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })\n supplyDate: string\n\n @Field({ nullable: false, description: '품목명' })\n itemName: string\n\n @Field({ nullable: false, description: '규격' })\n specification: string\n\n @Field(type => Int, { nullable: false, description: '수량(소수점 2자리까지 허용)' })\n quantity: number\n\n @Field(type => Int, { nullable: false, description: '단가(소수점 2자리까지 허용)' })\n unitPrice: number\n\n @Field(type => Int, { nullable: false, description: '공급가액' })\n supplyPrice: number\n\n @Field(type => Int, { nullable: false, description: '세액' })\n taxPrice: number\n\n @Field({ nullable: true, description: '비고' })\n remark?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TaxInvoiceItemList {\n @Field(type => [TaxInvoiceItem])\n items: TaxInvoiceItem[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -22,7 +22,7 @@ async function getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)
|
|
|
22
22
|
if (!businessRegistrationNumber || !aid || !bearer) {
|
|
23
23
|
throw new Error('no parameter in unipos api');
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const issueNoList = [];
|
|
26
26
|
const taxList = [];
|
|
27
27
|
const taxTypeArr = [UnipostTaxType.EXPORT, UnipostTaxType.IMPORT];
|
|
28
28
|
// 매입, 매출 각각 요청
|
|
@@ -30,11 +30,11 @@ async function getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)
|
|
|
30
30
|
const response = await _callTaxInvoiceInquiry(businessRegistrationNumber, aid, bearer, taxType);
|
|
31
31
|
// 성공 일시 세금 계산서 데이터 배열에 추가
|
|
32
32
|
if (response.status === 200) {
|
|
33
|
-
const category = taxType === 'AR' ? tax_invoice_1.Category.EXPORT : tax_invoice_1.Category.IMPORT;
|
|
33
|
+
const category = taxType === 'AR' ? tax_invoice_1.Category.EXPORT : tax_invoice_1.Category.IMPORT; // 유니포스트의 타입 => 우리 솔루션 형태로 변환
|
|
34
34
|
const taxData = await response.json();
|
|
35
35
|
if (taxData.success === true) {
|
|
36
36
|
for (let tax of taxData.tAliceEntry) {
|
|
37
|
-
|
|
37
|
+
issueNoList.push(tax.exd_id);
|
|
38
38
|
taxList.push(Object.assign(Object.assign({}, tax), { category }));
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -44,13 +44,13 @@ async function getTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer)
|
|
|
44
44
|
// const taxData = getTestTaxInvoiceData(category)
|
|
45
45
|
// if (taxData.success === true) {
|
|
46
46
|
// for (let tax of taxData.tAliceEntry) {
|
|
47
|
-
//
|
|
47
|
+
// issueNoList.push(tax.exd_id)
|
|
48
48
|
// taxList.push({ ...tax, category })
|
|
49
49
|
// }
|
|
50
50
|
// }
|
|
51
51
|
}
|
|
52
52
|
return {
|
|
53
|
-
|
|
53
|
+
issueNoList,
|
|
54
54
|
taxList
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-inquiry.js","sourceRoot":"","sources":["../../../server/service/unipost-api/tax-invoice-inquiry.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AACrD,kDAAkD;AAElD,eAAe;AACf,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,wEAAwE;IAC7E,IAAI,EAAE,+DAA+D;CACtE,CAAA;AACD,sBAAsB;AACtB,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,wEAAwE;IAC7E,IAAI,EAAE,+DAA+D;CACtE,CAAA;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,+BAAa,CAAA,CAAC,KAAK;AACrB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAUM,KAAK,UAAU,wBAAwB,CAAC,0BAAkC,EAAE,GAAW,EAAE,MAAc;IAC5G,IAAI,CAAC,0BAA0B,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QAClD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;KAC9C;IAED,MAAM,
|
|
1
|
+
{"version":3,"file":"tax-invoice-inquiry.js","sourceRoot":"","sources":["../../../server/service/unipost-api/tax-invoice-inquiry.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AACrD,kDAAkD;AAElD,eAAe;AACf,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,wEAAwE;IAC7E,IAAI,EAAE,+DAA+D;CACtE,CAAA;AACD,sBAAsB;AACtB,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,wEAAwE;IAC7E,IAAI,EAAE,+DAA+D;CACtE,CAAA;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,+BAAa,CAAA,CAAC,KAAK;AACrB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAUM,KAAK,UAAU,wBAAwB,CAAC,0BAAkC,EAAE,GAAW,EAAE,MAAc;IAC5G,IAAI,CAAC,0BAA0B,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QAClD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,C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Ac,EAAE,kBAAkB;YAClC,aAAa,EAAE,QAAQ,GAAG,MAAM;YAChC,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,0BAA0B;SACtC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,GAAG;YACH,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,0BAA0B;YAClC,MAAM,EAAE,EAAE;SACX,CAAC;KACH,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AACM,KAAK,UAAU,qBAAqB,CAAC,0BAAkC,EAAE,GAAW,EAAE,MAAc,EAAE,WAA0B;IACrI,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC5C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,QAAQ,GAAG,MAAM;YAChC,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,0BAA0B;SACtC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;KAClC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AAbD,sDAaC","sourcesContent":["import { Category } from '../tax-invoice/tax-invoice'\n// import getTestTaxInvoiceData from './test-data'\n\n// 세금계산서 조회 API\nconst INQUIRY_URL = {\n dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/searchbills',\n prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/searchbills'\n}\n// 세금계산서 조회 후 처리 결과 갱신\nconst CONFIRM_URL = {\n dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/updateBills',\n prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/updateBills'\n}\n\nexport enum UnipostTaxType {\n EXPORT = 'AR', // 매출\n IMPORT = 'AP' // 매입\n}\n\nexport interface ConfirmData {\n aid: string\n tax_type: UnipostTaxType\n tid_issueid: string\n success: boolean\n message: string\n}\n\nexport async function getTaxInvoiceByUniposApi(businessRegistrationNumber: string, aid: string, bearer: string) {\n if (!businessRegistrationNumber || !aid || !bearer) {\n throw new Error('no parameter in unipos api')\n }\n\n const issueNoList: Array<string> = []\n const taxList = []\n const taxTypeArr = [UnipostTaxType.EXPORT, UnipostTaxType.IMPORT]\n\n // 매입, 매출 각각 요청\n for (const taxType of taxTypeArr) {\n const response = await _callTaxInvoiceInquiry(businessRegistrationNumber, aid, bearer, taxType)\n\n // 성공 일시 세금 계산서 데이터 배열에 추가\n if (response.status === 200) {\n const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT // 유니포스트의 타입 => 우리 솔루션 형태로 변환\n const taxData = await response.json()\n\n if (taxData.success === true) {\n for (let tax of taxData.tAliceEntry) {\n issueNoList.push(tax.exd_id)\n taxList.push({ ...tax, category })\n }\n }\n }\n\n // 테스트 코드\n // const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT\n // const taxData = getTestTaxInvoiceData(category)\n // if (taxData.success === true) {\n // for (let tax of taxData.tAliceEntry) {\n // issueNoList.push(tax.exd_id)\n // taxList.push({ ...tax, category })\n // }\n // }\n }\n\n return {\n issueNoList,\n taxList\n }\n}\n\nasync function _callTaxInvoiceInquiry(businessRegistrationNumber: string, aid: string, bearer: string, taxType: UnipostTaxType) {\n const response = await fetch(INQUIRY_URL.dev, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: 'Basic ' + bearer,\n AID: aid,\n COM_REGNO: businessRegistrationNumber\n },\n body: JSON.stringify({\n aid,\n tax_type: taxType,\n biz_no: businessRegistrationNumber,\n period: 30\n })\n })\n\n return response\n}\nexport async function callTaxInvoiceConfirm(businessRegistrationNumber: string, aid: string, bearer: string, confirmData: ConfirmData[]) {\n const response = await fetch(CONFIRM_URL.dev, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: 'Basic ' + bearer,\n AID: aid,\n COM_REGNO: businessRegistrationNumber\n },\n body: JSON.stringify(confirmData)\n })\n\n return response\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendTaxInvoiceByUniposApi = void 0;
|
|
4
|
+
// 세금계산서 발행 API
|
|
5
|
+
const SEND_URL = {
|
|
6
|
+
dev: 'https://unidev.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill',
|
|
7
|
+
prod: 'https://etax.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill'
|
|
8
|
+
};
|
|
9
|
+
async function sendTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer, taxInvoiceSendList) {
|
|
10
|
+
if (!businessRegistrationNumber || !aid || !bearer || !taxInvoiceSendList) {
|
|
11
|
+
throw new Error('no parameter in unipos api');
|
|
12
|
+
}
|
|
13
|
+
const response = await _callTaxInvoiceSend(businessRegistrationNumber, aid, bearer, taxInvoiceSendList);
|
|
14
|
+
// 성공 일시 세금 계산서 데이터 배열에 추가
|
|
15
|
+
if (response.status === 200) {
|
|
16
|
+
}
|
|
17
|
+
const result = await response.json();
|
|
18
|
+
console.log('response : ', response);
|
|
19
|
+
console.log('result : ', result);
|
|
20
|
+
return result.success;
|
|
21
|
+
}
|
|
22
|
+
exports.sendTaxInvoiceByUniposApi = sendTaxInvoiceByUniposApi;
|
|
23
|
+
async function _callTaxInvoiceSend(businessRegistrationNumber, aid, bearer, taxInvoiceSendList) {
|
|
24
|
+
console.log('request : ', taxInvoiceSendList);
|
|
25
|
+
const response = await fetch(SEND_URL.dev, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
Authorization: 'Basic ' + bearer,
|
|
30
|
+
AID: aid,
|
|
31
|
+
COM_REGNO: businessRegistrationNumber
|
|
32
|
+
},
|
|
33
|
+
body: JSON.stringify(taxInvoiceSendList)
|
|
34
|
+
});
|
|
35
|
+
console.log('response1 : ', response);
|
|
36
|
+
return response;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=tax-invoice-send.js.map
|