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