@things-factory/biz-base 10.1.241 → 10.1.243

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/biz-base",
3
- "version": "10.1.241",
3
+ "version": "10.1.243",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "exports": {
@@ -44,5 +44,5 @@
44
44
  "@things-factory/attachment-base": "^10.1.241",
45
45
  "@things-factory/auth-base": "^10.1.241"
46
46
  },
47
- "gitHead": "d7fe2e1a1eb7c02cb21b897da26d385df014f908"
47
+ "gitHead": "70a77f8a032f297a9d756ad530d3072e7a6c4bed"
48
48
  }
@@ -76,3 +76,46 @@ test('a module that keeps names hears every save, in the same transaction', asyn
76
76
  await save([{ name: '니어솔루션', aliases: '니어\n제이투-니어' }])
77
77
  assert.deepEqual(heard, ['니어솔루션'])
78
78
  })
79
+
80
+ test('four kinds - a business, an institution, a person, our own company - by the words people write', async () => {
81
+ const saved = await save([
82
+ { name: '성남세무서', kind: '기관' },
83
+ { name: '김직원', kind: '개인' },
84
+ { name: '개인사업자 상점', kind: '사업자' }
85
+ ])
86
+ assert.deepEqual(saved.map(one => one.kind), ['INSTITUTION', 'PERSON', 'COMPANY'])
87
+ await assert.rejects(save([{ name: '무엇', kind: '외국회사' }]), { code: 'counterparty-kind-invalid' })
88
+ })
89
+
90
+ test('our own company is one counterparty, and it keeps none of the facts 「우리 회사」 keeps', async () => {
91
+ await assert.rejects(save([{ name: '(주)우리', kind: '자사', businessNumber: '3334455555' }]), { code: 'counterparty-self-facts' })
92
+ const [self] = await save([{ name: '(주)우리', kind: '자사', aliases: '(주)우리\n주식회사우리' }])
93
+ assert.equal(self.kind, 'SELF')
94
+ await assert.rejects(save([{ name: '우리 둘째', kind: 'SELF' }]), { code: 'counterparty-self-taken' })
95
+ await assert.rejects(save([{ id: self.id, cuFlag: 'M', address: '성남시' }]), { code: 'counterparty-self-facts' })
96
+
97
+ const [other] = await save([{ name: '주소 있는 곳', address: '서울' }])
98
+ await assert.rejects(save([{ id: other.id, cuFlag: 'M', kind: '자사' }]), { code: 'counterparty-self-facts' }, 'a row turned into our company brings its facts')
99
+ await save([{ id: self.id, cuFlag: 'M', notes: '자기 계좌 사이' }])
100
+ await save([{ id: self.id, cuFlag: '-' }])
101
+ const [again] = await save([{ name: '(주)우리', kind: 'SELF' }])
102
+ assert.equal(again.kind, 'SELF', 'a deleted one frees the place')
103
+ })
104
+
105
+ test('a country is two letters, home is empty, and a number abroad is kept as written', async () => {
106
+ const [home] = await save([{ name: '국내', country: 'kr', businessNumber: '4445566666' }])
107
+ assert.equal(home.country, null, 'home is written one way')
108
+ assert.equal(home.businessNumber, '444-55-66666')
109
+ assert.equal(home.zeroRated, false)
110
+
111
+ const [abroad] = await save([{ name: 'SK AX USA', country: 'us', businessNumber: '12-3456789' }])
112
+ assert.equal(abroad.country, 'US')
113
+ assert.equal(abroad.businessNumber, '12-3456789', 'its form is not checked')
114
+ assert.equal(abroad.zeroRated, true, 'sales abroad are zero-rated unless said')
115
+ const [said] = await save([{ name: 'Torch', country: 'JP', zeroRated: false }])
116
+ assert.equal(said.zeroRated, false)
117
+
118
+ const [moved] = await save([{ id: abroad.id, cuFlag: 'M', businessNumber: 'EIN 98 765' }])
119
+ assert.equal(moved.businessNumber, 'EIN98765', 'a changed number takes the stored country')
120
+ await assert.rejects(save([{ name: '어디', country: 'USA' }]), { code: 'counterparty-country-invalid' })
121
+ })
@@ -13,7 +13,7 @@
13
13
  "error.counterparty-name-required": "Give the counterparty a name.",
14
14
  "error.counterparty-number-clash": "Business number {number} already belongs to '{existing}'. Edit that counterparty instead.",
15
15
  "error.counterparty-not-found": "The counterparty was not found. Reload it.",
16
- "error.counterparty-kind-invalid": "'{text}' is neither a company nor a person.",
16
+ "error.counterparty-kind-invalid": "'{text}' is not a counterparty kind. Choose a business, an institution, a person or our company.",
17
17
  "error.business-number-invalid": "'{text}' is not a business registration number. It has 10 digits.",
18
18
  "error.counterparty-account-number-required": "Give the account number.",
19
19
  "error.counterparty-account-clash": "Account {number} is already registered to '{existing}'.",
@@ -27,5 +27,8 @@
27
27
  "error.company-name-taken": "Trade name {value} is already another company's in this workspace.",
28
28
  "error.counterparty-account-number-letters": "Account number '{value}' has characters other than digits and hyphens. Enter digits and hyphens only.",
29
29
  "error.counterparty-account-counterparty-required": "Choose the account's counterparty.",
30
- "error.bizplace-not-accessible": "The bizplace was not found, or it is not yours to see. Reload the list."
30
+ "error.bizplace-not-accessible": "The bizplace was not found, or it is not yours to see. Reload the list.",
31
+ "error.counterparty-self-facts": "'{name}' is our own company. Its business number, branch number, representative, addresses, business type and item are kept in Our company only. Clear those fields.",
32
+ "error.counterparty-self-taken": "There is one own-company counterparty. '{existing}' already is.",
33
+ "error.counterparty-country-invalid": "'{text}' is not a country code. Write two letters such as US or JP, and leave it empty for one at home."
31
34
  }
@@ -13,7 +13,7 @@
13
13
  "error.counterparty-name-required": "Asigne un nombre a la contraparte.",
14
14
  "error.counterparty-number-clash": "El número de empresa {number} ya pertenece a '{existing}'. Edite esa contraparte en su lugar.",
15
15
  "error.counterparty-not-found": "No se encontró la contraparte. Vuelva a cargarla.",
16
- "error.counterparty-kind-invalid": "'{text}' no es ni una empresa ni una persona.",
16
+ "error.counterparty-kind-invalid": "'{text}' no es una clase de contraparte. Elija empresa, institución, persona o nuestra empresa.",
17
17
  "error.business-number-invalid": "'{text}' no es un número de registro empresarial. Debe tener 10 dígitos.",
18
18
  "error.counterparty-account-number-required": "Indique el número de cuenta.",
19
19
  "error.counterparty-account-clash": "La cuenta {number} ya está registrada a '{existing}'.",
@@ -27,5 +27,8 @@
27
27
  "error.company-name-taken": "La razón social {value} ya la usa otra empresa de este espacio de trabajo.",
28
28
  "error.counterparty-account-number-letters": "El número de cuenta '{value}' tiene caracteres que no son dígitos ni guiones. Introduzca solo dígitos y guiones.",
29
29
  "error.counterparty-account-counterparty-required": "Elija la contraparte de la cuenta.",
30
- "error.bizplace-not-accessible": "No se encontró el centro o no puede verlo. Vuelva a cargar la lista."
30
+ "error.bizplace-not-accessible": "No se encontró el centro o no puede verlo. Vuelva a cargar la lista.",
31
+ "error.counterparty-self-facts": "'{name}' es nuestra propia empresa. Su número fiscal, sucursal, representante, direcciones, actividad y rubro se guardan solo en Nuestra empresa. Vacíe esos campos.",
32
+ "error.counterparty-self-taken": "Solo hay una contraparte de nuestra empresa. '{existing}' ya lo es.",
33
+ "error.counterparty-country-invalid": "'{text}' no es un código de país. Escriba dos letras como US o JP, y déjelo vacío si es nacional."
31
34
  }
@@ -13,7 +13,7 @@
13
13
  "error.counterparty-name-required": "거래처 이름을 입력해 주세요.",
14
14
  "error.counterparty-number-clash": "사업자번호 {number}은(는) 이미 거래처 '{existing}'의 번호입니다. 그 거래처를 수정해 주세요.",
15
15
  "error.counterparty-not-found": "거래처를 찾을 수 없습니다. 다시 불러오세요.",
16
- "error.counterparty-kind-invalid": "'{text}'은(는) 회사도 개인도 아닙니다.",
16
+ "error.counterparty-kind-invalid": "'{text}'은(는) 거래처 구분이 아닙니다. 사업자 · 기관 · 개인 · 자사 가운데 하나를 고르세요.",
17
17
  "error.business-number-invalid": "'{text}'은(는) 사업자등록번호가 아닙니다. 사업자등록번호는 숫자 10자리입니다.",
18
18
  "error.counterparty-account-number-required": "계좌번호를 입력해 주세요.",
19
19
  "error.counterparty-account-clash": "계좌 {number}은(는) 이미 거래처 '{existing}'의 계좌입니다.",
@@ -27,5 +27,8 @@
27
27
  "error.company-name-taken": "상호 {value}은(는) 이 사업장의 다른 회사가 쓰고 있습니다.",
28
28
  "error.counterparty-account-number-letters": "계좌번호 '{value}'에 숫자와 하이픈(-) 아닌 글자가 있습니다. 숫자와 하이픈만 입력하세요.",
29
29
  "error.counterparty-account-counterparty-required": "계좌의 거래처를 고르세요.",
30
- "error.bizplace-not-accessible": "사업장을 찾을 수 없거나 볼 수 없는 사업장입니다. 목록을 새로 불러오세요."
30
+ "error.bizplace-not-accessible": "사업장을 찾을 수 없거나 볼 수 없는 사업장입니다. 목록을 새로 불러오세요.",
31
+ "error.counterparty-self-facts": "'{name}'은(는) 자사입니다. 사업자번호 · 종사업장번호 · 대표자 · 주소 · 청구 주소 · 업태 · 종목은 「우리 회사」에만 둡니다. 이 칸들을 비워 주세요.",
32
+ "error.counterparty-self-taken": "자사는 하나뿐입니다. 이미 '{existing}'이(가) 자사입니다.",
33
+ "error.counterparty-country-invalid": "'{text}'은(는) 나라 코드가 아닙니다. US · JP 처럼 영문 두 글자로 적고, 국내면 비워 두세요."
31
34
  }