7vsdk-pessoas 1.0.26 → 1.0.27

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": "7vsdk-pessoas",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -3,63 +3,46 @@ import { CrudClientBase } from "../base";
3
3
  import { PessoaClient, PessoaCnpjClient } from "../pessoas";
4
4
  import { EnderecoCidadeClient } from "../enderecos/EnderecoCidadeClient";
5
5
 
6
- export class EmpresaSdk extends CrudClientBase<EmpresaRequest, EmpresaResponse>
7
- {
8
- private pessoaUrl: string = "";
9
- private token: string = "";
10
-
11
- private pessoaSdk: PessoaClient;
12
- private enderecoSdk: EnderecoCidadeClient
13
- private pessoaCnpj: PessoaCnpjClient
14
-
15
- constructor(Url: string, tokenJwt: string)
16
- {
17
- super(Url, "portal-contador/empresa", tokenJwt);
18
- this.token = tokenJwt;
19
- this.pessoaCnpj = new PessoaCnpjClient(this.pessoaUrl, this.token);
20
- this.enderecoSdk = new EnderecoCidadeClient(this.pessoaUrl, this.token);
21
- this.pessoaSdk = new PessoaClient(this.pessoaUrl, this.token);
22
- }
23
-
24
- setPessoaUrl(urlPessoa: string)
25
- {
26
- this.pessoaUrl = urlPessoa;
27
-
28
- this.pessoaCnpj = new PessoaCnpjClient(this.pessoaUrl, this.token)
29
- this.enderecoSdk = new EnderecoCidadeClient(this.pessoaUrl, this.token);
30
- this.pessoaSdk = new PessoaClient(this.pessoaUrl, this.token);
31
- }
32
-
33
- async criarEmpresaRoot(cnpj: string, ie: string, regimeTributario: number, razaoSocial: string, lucroReal: boolean, industria: boolean): Promise<void>
34
- {
35
- if(regimeTributario < 1 || regimeTributario > 3)
36
- throw new Error("Regime tributário inválido. Use 1 para Simples Nacional, 2 para Lucro Presumido ou 3 para Lucro Real.");
37
- const pessoaMandou: PessoaResponse = await this.pessoaSdk.postarPessoa(razaoSocial, "I");
38
- await this.pessoaCnpj.postarPessoaCnpj(pessoaMandou.PessoaId, cnpj, ie, regimeTributario, lucroReal, industria);
39
- }
40
-
41
- async incluirEmpresaRootCompleto(cnpj: string, razaoSocial: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>
42
- {
43
-
44
- }
6
+ export class EmpresaSdk extends CrudClientBase<EmpresaRequest, EmpresaResponse> {
45
7
 
46
- async incluirClientePj(cnpjPai: string, cnpjFilho: string, razaoSocialFilho: string): Promise<void>
47
- {
8
+ private readonly pessoaUrl: string;
9
+ private readonly token: string;
48
10
 
49
- }
50
-
51
- async incluirClientePjCompleto(cnpjPai: string, cnpjFilho: string, razaoSocialFilho: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>
52
- {
53
-
54
- }
11
+ private readonly pessoaSdk: PessoaClient;
12
+ private readonly pessoaCnpjSdk: PessoaCnpjClient;
13
+ private readonly enderecoSdk: EnderecoCidadeClient;
55
14
 
56
- async incluirClientePf(cnpjPai: string, cpfFilho: string, nomeCompletoFilho: string): Promise<void>
57
- {
15
+ constructor(empresaUrl: string, pessoaUrl: string, tokenJwt: string) {
16
+ super(empresaUrl, "portal-contador/empresa", tokenJwt);
58
17
 
59
- }
60
-
61
- async incluirClientePfCompleto(cnpjPai: string, cpfFilho: string, nomeCompletoFilho: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>
62
- {
18
+ this.pessoaUrl = pessoaUrl;
19
+ this.token = tokenJwt;
63
20
 
64
- }
65
- }
21
+ this.pessoaSdk = new PessoaClient(pessoaUrl, tokenJwt);
22
+ this.pessoaCnpjSdk = new PessoaCnpjClient(pessoaUrl, tokenJwt);
23
+ this.enderecoSdk = new EnderecoCidadeClient(pessoaUrl, tokenJwt);
24
+ }
25
+
26
+ async criarEmpresaRoot(
27
+ cnpj: string,
28
+ ie: string,
29
+ regimeTributario: number,
30
+ razaoSocial: string,
31
+ lucroReal: boolean,
32
+ industria: boolean
33
+ ): Promise<void> {
34
+
35
+ if (regimeTributario < 1 || regimeTributario > 3)
36
+ throw new Error("Regime tributário inválido.");
37
+
38
+ const pessoa = await this.pessoaSdk.postarPessoa(razaoSocial, "I");
39
+ await this.pessoaCnpjSdk.postarPessoaCnpj(
40
+ pessoa.PessoaId,
41
+ cnpj,
42
+ ie,
43
+ regimeTributario,
44
+ lucroReal,
45
+ industria
46
+ );
47
+ }
48
+ }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from "./clients"
1
+ export * from "./clients";