@things-factory/tax-invoice 6.2.125 → 6.2.129

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.
Files changed (48) hide show
  1. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +99 -61
  2. package/client/pages/tax-invoice-company/tax-invoice-company-importer.ts +0 -10
  3. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +0 -32
  4. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +2 -2
  5. package/config/config.development.js +13 -0
  6. package/config/config.production.js +13 -0
  7. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +3 -2
  8. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +91 -61
  9. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
  10. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +2 -11
  11. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +0 -10
  12. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -1
  13. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +0 -8
  14. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +0 -32
  15. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -1
  16. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +2 -2
  17. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  18. package/dist-client/tsconfig.tsbuildinfo +1 -1
  19. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +20 -12
  20. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  21. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +13 -7
  22. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
  23. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +3 -7
  24. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
  25. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +9 -21
  26. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
  27. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +27 -6
  28. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -1
  29. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +55 -5
  30. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -1
  31. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +1 -19
  32. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -1
  33. package/dist-server/service/unipost-api/tax-invoice-inquiry.js +6 -10
  34. package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
  35. package/dist-server/service/unipost-api/tax-invoice-send.js +4 -5
  36. package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -1
  37. package/dist-server/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +6 -5
  39. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +34 -20
  40. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +12 -6
  41. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +2 -5
  42. package/server/service/tax-invoice-api/tax-invoice-api.ts +9 -19
  43. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +24 -5
  44. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +40 -4
  45. package/server/service/tax-invoice-company/tax-invoice-company.ts +0 -18
  46. package/server/service/unipost-api/tax-invoice-inquiry.ts +6 -10
  47. package/server/service/unipost-api/tax-invoice-send.ts +5 -5
  48. package/translations/ko.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/tax-invoice",
3
- "version": "6.2.125",
3
+ "version": "6.2.129",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -29,9 +29,10 @@
29
29
  "dependencies": {
30
30
  "@operato/graphql": "^1.0.0",
31
31
  "@operato/shell": "^1.0.0",
32
- "@things-factory/auth-base": "^6.2.122",
33
- "@things-factory/export-ui-excel": "^6.2.122",
34
- "@things-factory/shell": "^6.2.122"
32
+ "@things-factory/auth-base": "^6.2.126",
33
+ "@things-factory/env": "^6.2.126",
34
+ "@things-factory/export-ui-excel": "^6.2.126",
35
+ "@things-factory/shell": "^6.2.126"
35
36
  },
36
- "gitHead": "7d694035e7e886593088face69dfefe70b8c0486"
37
+ "gitHead": "6939e013d9a091fb17094d6f988c32f4dab278f4"
37
38
  }
@@ -11,32 +11,46 @@ import { parseTaxInvoiceByUnipostFormat } from '../tax-invoice/tax-invoice-util'
11
11
  @Resolver(TaxInvoiceApi)
12
12
  export class TaxInvoiceApiMutation {
13
13
  @Directive('@transaction')
14
- @Mutation(returns => TaxInvoiceApi, { description: 'To modify Tax Invoice Api information' })
15
- async updateMultipleTaxInvoiceApi(@Arg('patch', type => TaxInvoiceApiPatch) patch: TaxInvoiceApiPatch, @Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {
14
+ @Mutation(returns => [TaxInvoiceApi], { description: 'To modify Tax Invoice Api information' })
15
+ async updateMultipleTaxInvoiceApi(
16
+ @Arg('patches', type => [TaxInvoiceApiPatch]) patches: TaxInvoiceApiPatch[],
17
+ @Ctx() context: ResolverContext
18
+ ): Promise<TaxInvoiceApi[]> {
16
19
  const { domain, user, tx } = context.state
20
+
21
+ let results = []
22
+ const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
23
+ const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
17
24
  const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)
18
- let results
19
-
20
- if (patch.cuFlag.toUpperCase() === '+') {
21
- const result = await taxInvoiceApiRepo.save({
22
- ...patch,
23
- domain,
24
- creator: user,
25
- updater: user
26
- })
27
25
 
28
- results = { ...result, cuFlag: '+' }
26
+ if (_createRecords.length > 0) {
27
+ for (let i = 0; i < _createRecords.length; i++) {
28
+ const newRecord = _createRecords[i]
29
+
30
+ const result = await taxInvoiceApiRepo.save({
31
+ ...newRecord,
32
+ domain,
33
+ creator: user,
34
+ updater: user
35
+ })
36
+
37
+ results.push({ ...result, cuFlag: '+' })
38
+ }
29
39
  }
30
40
 
31
- if (patch.cuFlag.toUpperCase() === 'M') {
32
- const taxInvoiceApi = await taxInvoiceApiRepo.findOneBy({ id: patch.id })
33
- const result = await taxInvoiceApiRepo.save({
34
- ...taxInvoiceApi,
35
- ...patch,
36
- updater: user
37
- })
41
+ if (_updateRecords.length > 0) {
42
+ for (let i = 0; i < _updateRecords.length; i++) {
43
+ const updateRecord = _updateRecords[i]
44
+ const taxAuditResult = await taxInvoiceApiRepo.findOneBy({ id: updateRecord.id })
38
45
 
39
- results = { ...result, cuFlag: 'M' }
46
+ const result = await taxInvoiceApiRepo.save({
47
+ ...taxAuditResult,
48
+ ...updateRecord,
49
+ updater: user
50
+ })
51
+
52
+ results.push({ ...result, cuFlag: 'M' })
53
+ }
40
54
  }
41
55
 
42
56
  return results
@@ -1,17 +1,23 @@
1
- import { Resolver, Query, FieldResolver, Root, Ctx } from 'type-graphql'
2
- import { Domain, getRepository } from '@things-factory/shell'
1
+ import { Resolver, Query, FieldResolver, Root, Args, Ctx } from 'type-graphql'
2
+ import { Domain, ListParam, getQueryBuilderFromListParams, getRepository } from '@things-factory/shell'
3
3
  import { User } from '@things-factory/auth-base'
4
4
  import { TaxInvoiceApi } from './tax-invoice-api'
5
+ import { TaxInvoiceApiList } from './tax-invoice-api-type'
5
6
 
6
7
  @Resolver(TaxInvoiceApi)
7
8
  export class TaxInvoiceApiQuery {
8
- @Query(returns => TaxInvoiceApi!, { nullable: true, description: 'To fetch a Tax Invoice Api' })
9
- async taxInvoiceApi(@Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {
9
+ @Query(returns => TaxInvoiceApiList!, { nullable: true, description: 'To fetch a Tax Invoice Api List' })
10
+ async taxInvoiceApis(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaxInvoiceApiList> {
10
11
  const { domain } = context.state
11
12
 
12
- return await getRepository(TaxInvoiceApi).findOne({
13
- where: { domain: { id: domain.id } }
13
+ const queryBuilder = getQueryBuilderFromListParams({
14
+ domain,
15
+ params,
16
+ repository: await getRepository(TaxInvoiceApi)
14
17
  })
18
+ const [items, total] = await queryBuilder.getManyAndCount()
19
+
20
+ return { items, total }
15
21
  }
16
22
 
17
23
  @FieldResolver(type => Domain)
@@ -10,13 +10,10 @@ export class TaxInvoiceApiPatch {
10
10
  id?: string
11
11
 
12
12
  @Field({ nullable: true })
13
- name?: string
13
+ isDefault?: boolean
14
14
 
15
15
  @Field({ nullable: true })
16
- description?: string
17
-
18
- @Field({ nullable: true })
19
- apiKey?: string
16
+ provider?: string
20
17
 
21
18
  @Field({ nullable: true })
22
19
  apiAccountId?: string
@@ -1,12 +1,11 @@
1
- import { CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
1
+ import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
2
2
  import { ObjectType, Field, ID } from 'type-graphql'
3
3
 
4
4
  import { Domain, ScalarObject, encryptTransformer } from '@things-factory/shell'
5
5
  import { User } from '@things-factory/auth-base'
6
6
 
7
- @Entity('tax_invoice_api') // api는 한개만 존재해야함.
8
- @Index('ix_tax_invoice_api_0', (taxInvoiceApi: TaxInvoiceApi) => [taxInvoiceApi.domain, taxInvoiceApi.name, taxInvoiceApi.deletedAt])
9
- @Index('ix_tax_invoice_api_1', (taxInvoiceApi: TaxInvoiceApi) => [taxInvoiceApi.domain, taxInvoiceApi.description, taxInvoiceApi.deletedAt])
7
+ @Entity()
8
+ @Index('ix_tax_invoice_api_provider', (taxInvoiceApi: TaxInvoiceApi) => [taxInvoiceApi.domain, taxInvoiceApi.provider], { unique: true })
10
9
  @ObjectType({ description: 'Entity for Tax Invoice Api' })
11
10
  export class TaxInvoiceApi {
12
11
  @PrimaryGeneratedColumn('uuid')
@@ -20,18 +19,13 @@ export class TaxInvoiceApi {
20
19
  @RelationId((taxInvoiceApi: TaxInvoiceApi) => taxInvoiceApi.domain)
21
20
  domainId?: string
22
21
 
23
- // 2개 이상 들어가는 것을 방지하는 플래그
24
- @Field({ nullable: false })
25
- @Column({ nullable: false, default: 1, unique: true })
26
- uniqueSequence!: number
22
+ @Column({ nullable: true, comment: '디폴트 여부' })
23
+ @Field({ nullable: true, description: '디폴트 여부' })
24
+ isDefault?: boolean
27
25
 
28
- @Field({ nullable: false })
29
- @Column({ nullable: false })
30
- name!: string
31
-
32
- @Field({ nullable: true })
33
- @Column({ nullable: true })
34
- description?: string
26
+ @Column({ nullable: false, comment: '공급자' })
27
+ @Field({ nullable: false, description: '공급자' })
28
+ provider!: string
35
29
 
36
30
  @Column({ nullable: true, comment: 'API Key', transformer: encryptTransformer })
37
31
  @Field({ nullable: true, description: 'API Key' })
@@ -105,10 +99,6 @@ export class TaxInvoiceApi {
105
99
  @Field({ nullable: true })
106
100
  updatedAt?: Date
107
101
 
108
- @DeleteDateColumn()
109
- @Field({ nullable: true })
110
- deletedAt?: Date
111
-
112
102
  @ManyToOne(type => User, { nullable: true })
113
103
  @Field(type => User, { nullable: true })
114
104
  creator?: User
@@ -1,8 +1,9 @@
1
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
2
2
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
3
  import { User } from '@things-factory/auth-base'
4
- import { TaxInvoiceCompany, companyTypeLabel } from './tax-invoice-company'
5
- import { TaxInvoiceCompanyList } from './tax-invoice-company-type'
4
+ import { TaxInvoiceCompany } from './tax-invoice-company'
5
+ import { TaxInvoiceCompanyList, TaxInvoiceMyCompany } from './tax-invoice-company-type'
6
+ import { TaxInvoiceApi } from '../tax-invoice-api/tax-invoice-api'
6
7
 
7
8
  @Resolver(TaxInvoiceCompany)
8
9
  export class TaxInvoiceCompanyQuery {
@@ -31,9 +32,27 @@ export class TaxInvoiceCompanyQuery {
31
32
  return { items, total }
32
33
  }
33
34
 
34
- @FieldResolver(type => String)
35
- async convertedType(@Root() taxInvoiceCompany: TaxInvoiceCompany): Promise<string> {
36
- return companyTypeLabel[taxInvoiceCompany.type]
35
+ // 프로젝트 마다 구현 (기본 공급자 정보를 리턴하는 리졸버)
36
+ @Query(returns => TaxInvoiceMyCompany, { nullable: true, description: 'To fetch a Tax Invoice My Company' })
37
+ async taxInvoiceDefaultCompany(@Ctx() context: ResolverContext): Promise<TaxInvoiceMyCompany> {
38
+ const { domain } = context.state
39
+ const taxInvoiceApi = await getRepository(TaxInvoiceApi).findOne({
40
+ where: { domain: { id: domain.id }, isDefault: true }
41
+ })
42
+
43
+ const taxInvoiceCompany: TaxInvoiceMyCompany = { ...taxInvoiceApi }
44
+
45
+ return taxInvoiceCompany
46
+ }
47
+
48
+ @Query(returns => TaxInvoiceMyCompany, { nullable: true, description: 'To fetch a Tax Invoice My Companies' })
49
+ async taxInvoiceMyCompanies(@Ctx() context: ResolverContext): Promise<TaxInvoiceMyCompany> {
50
+ const { domain } = context.state
51
+ const taxInvoiceApi = await getRepository(TaxInvoiceApi).find({
52
+ where: { domain: { id: domain.id } }
53
+ })
54
+
55
+ return null
37
56
  }
38
57
 
39
58
  @FieldResolver(type => Domain)
@@ -1,6 +1,6 @@
1
1
  import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
2
  import { ScalarObject } from '@things-factory/shell'
3
- import { CompanyType, TaxInvoiceCompany } from './tax-invoice-company'
3
+ import { TaxInvoiceCompany } from './tax-invoice-company'
4
4
 
5
5
  @InputType()
6
6
  export class TaxInvoiceCompanyPatch {
@@ -13,9 +13,6 @@ export class TaxInvoiceCompanyPatch {
13
13
  @Field({ nullable: true })
14
14
  description?: string
15
15
 
16
- @Field({ nullable: true })
17
- type?: CompanyType
18
-
19
16
  @Field({ nullable: true })
20
17
  businessRegistrationNumber?: string
21
18
 
@@ -59,6 +56,45 @@ export class TaxInvoiceCompanyPatch {
59
56
  cuFlag?: string
60
57
  }
61
58
 
59
+ @ObjectType()
60
+ export class TaxInvoiceMyCompany {
61
+ @Field({ nullable: true })
62
+ businessRegistrationNumber?: string
63
+
64
+ @Field({ nullable: true })
65
+ branchIdentification?: string
66
+
67
+ @Field({ nullable: true })
68
+ businessName?: string
69
+
70
+ @Field({ nullable: true })
71
+ representativeName?: string
72
+
73
+ @Field({ nullable: true })
74
+ address?: string
75
+
76
+ @Field({ nullable: true })
77
+ businessType?: string
78
+
79
+ @Field({ nullable: true })
80
+ industryType?: string
81
+
82
+ @Field({ nullable: true })
83
+ department?: string
84
+
85
+ @Field({ nullable: true })
86
+ contactName?: string
87
+
88
+ @Field({ nullable: true })
89
+ contactPhone?: string
90
+
91
+ @Field({ nullable: true })
92
+ contactEmail?: string
93
+
94
+ @Field({ nullable: true })
95
+ contactCellPhone?: string
96
+ }
97
+
62
98
  @ObjectType()
63
99
  export class TaxInvoiceCompanyList {
64
100
  @Field(type => [TaxInvoiceCompany])
@@ -15,20 +15,6 @@ import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
15
15
 
16
16
  import { Domain, ScalarObject, encryptTransformer } from '@things-factory/shell'
17
17
  import { User } from '@things-factory/auth-base'
18
- import { TaxInvoiceApi } from '../tax-invoice-api/tax-invoice-api'
19
-
20
- export enum CompanyType {
21
- SUPPLIER = 10, // 공급자
22
- BUYER = 20 // 거래처
23
- }
24
- export const companyTypeLabel = {
25
- [CompanyType.SUPPLIER]: '공급자',
26
- [CompanyType.BUYER]: '거래처'
27
- }
28
- registerEnumType(CompanyType, {
29
- name: 'CompanyType',
30
- description: 'company type'
31
- })
32
18
 
33
19
  @Entity()
34
20
  @Index('ix_tax_invoice_company_0', (taxInvoiceCompany: TaxInvoiceCompany) => [taxInvoiceCompany.domain, taxInvoiceCompany.name, taxInvoiceCompany.deletedAt])
@@ -54,10 +40,6 @@ export class TaxInvoiceCompany {
54
40
  @Column({ nullable: true })
55
41
  description?: string
56
42
 
57
- @Field({ nullable: false })
58
- @Column({ nullable: false })
59
- type!: CompanyType
60
-
61
43
  @Column({ nullable: true, comment: '사업자등록번호', transformer: encryptTransformer })
62
44
  @Field({ nullable: true, description: '사업자등록번호' })
63
45
  businessRegistrationNumber?: string
@@ -1,16 +1,12 @@
1
1
  import { Category } from '../tax-invoice/tax-invoice'
2
+ import { config } from '@things-factory/env'
2
3
  // import getTestTaxInvoiceData from './test-data'
3
4
 
5
+ const UNITAX_CONFIG = config.get('unitax', {})
4
6
  // 세금계산서 조회 API
5
- const INQUIRY_URL = {
6
- dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/searchbills',
7
- prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/searchbills'
8
- }
7
+ const INQUIRY_URL = UNITAX_CONFIG.INQUIRY_URL || ''
9
8
  // 세금계산서 조회 후 처리 결과 갱신
10
- const CONFIRM_URL = {
11
- dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/updateBills',
12
- prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/updateBills'
13
- }
9
+ const CONFIRM_URL = UNITAX_CONFIG.CONFIRM_URL || ''
14
10
 
15
11
  export enum UnipostTaxType {
16
12
  EXPORT = 'AR', // 매출
@@ -69,7 +65,7 @@ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: strin
69
65
  }
70
66
 
71
67
  async function _callTaxInvoiceInquiry(businessRegistrationNumber: string, aid: string, bearer: string, taxType: UnipostTaxType) {
72
- const response = await fetch(INQUIRY_URL.dev, {
68
+ const response = await fetch(INQUIRY_URL, {
73
69
  method: 'POST',
74
70
  headers: {
75
71
  'Content-Type': 'application/json',
@@ -88,7 +84,7 @@ async function _callTaxInvoiceInquiry(businessRegistrationNumber: string, aid: s
88
84
  return response
89
85
  }
90
86
  export async function callTaxInvoiceConfirm(businessRegistrationNumber: string, aid: string, bearer: string, confirmData: ConfirmData[]) {
91
- const response = await fetch(CONFIRM_URL.dev, {
87
+ const response = await fetch(CONFIRM_URL, {
92
88
  method: 'POST',
93
89
  headers: {
94
90
  'Content-Type': 'application/json',
@@ -1,8 +1,8 @@
1
+ import { config } from '@things-factory/env'
2
+
3
+ const UNITAX_CONFIG = config.get('unitax', {})
1
4
  // 세금계산서 발행 API
2
- const SEND_URL = {
3
- dev: 'https://inf2dev.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill',
4
- prod: 'https://inf1.unipost.co.kr/mbill-etaxr-server/api/rest/v3/receivebill'
5
- }
5
+ const SEND_URL = UNITAX_CONFIG.SEND_URL || ''
6
6
 
7
7
  export async function sendTaxInvoiceByUniposApi(businessRegistrationNumber: string, aid: string, bearer: string, taxInvoiceSendList) {
8
8
  if (!businessRegistrationNumber || !aid || !bearer || !taxInvoiceSendList) {
@@ -16,7 +16,7 @@ export async function sendTaxInvoiceByUniposApi(businessRegistrationNumber: stri
16
16
 
17
17
  async function _callTaxInvoiceSend(businessRegistrationNumber: string, aid: string, bearer: string, taxInvoiceSendList) {
18
18
  try {
19
- return await fetch(SEND_URL.dev, {
19
+ return await fetch(SEND_URL, {
20
20
  method: 'POST',
21
21
  headers: {
22
22
  'Content-Type': 'application/json',
@@ -21,6 +21,7 @@
21
21
  "text.tax invoice description purpose 02": "청구",
22
22
  "text.success tax send": "세금계산서가 발행되었습니다.",
23
23
 
24
+ "field.is_default": "기본 여부",
24
25
  "field.memo": "메모",
25
26
  "field.business registration number": "사업자등록번호",
26
27
  "field.short business registration number": "등록번호",