7vsdk-pessoas 1.0.26 → 1.0.28
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.
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { EmpresaRequest, EmpresaResponse
|
|
1
|
+
import { EmpresaRequest, EmpresaResponse } from "7vdomain";
|
|
2
2
|
import { CrudClientBase } from "../base";
|
|
3
3
|
export declare class EmpresaSdk extends CrudClientBase<EmpresaRequest, EmpresaResponse> {
|
|
4
|
-
private pessoaUrl;
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
private readonly pessoaUrl;
|
|
5
|
+
private readonly token;
|
|
6
|
+
private readonly pessoaSdk;
|
|
7
|
+
private readonly pessoaCnpjSdk;
|
|
8
|
+
private readonly enderecoSdk;
|
|
9
|
+
constructor(empresaUrl: string, pessoaUrl: string, tokenJwt: string);
|
|
10
10
|
criarEmpresaRoot(cnpj: string, ie: string, regimeTributario: number, razaoSocial: string, lucroReal: boolean, industria: boolean): Promise<void>;
|
|
11
|
-
incluirEmpresaRootCompleto(cnpj: string, razaoSocial: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>;
|
|
12
|
-
incluirClientePj(cnpjPai: string, cnpjFilho: string, razaoSocialFilho: string): Promise<void>;
|
|
13
|
-
incluirClientePjCompleto(cnpjPai: string, cnpjFilho: string, razaoSocialFilho: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>;
|
|
14
|
-
incluirClientePf(cnpjPai: string, cpfFilho: string, nomeCompletoFilho: string): Promise<void>;
|
|
15
|
-
incluirClientePfCompleto(cnpjPai: string, cpfFilho: string, nomeCompletoFilho: string, endereco: EnderecoRequest[], telefones: PessoaTelefoneRequest[]): Promise<void>;
|
|
16
11
|
}
|
|
@@ -5,31 +5,19 @@ const base_1 = require("../base");
|
|
|
5
5
|
const pessoas_1 = require("../pessoas");
|
|
6
6
|
const EnderecoCidadeClient_1 = require("../enderecos/EnderecoCidadeClient");
|
|
7
7
|
class EmpresaSdk extends base_1.CrudClientBase {
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this.pessoaUrl =
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
setPessoaUrl(urlPessoa) {
|
|
16
|
-
this.pessoaUrl = urlPessoa;
|
|
8
|
+
constructor(empresaUrl, pessoaUrl, tokenJwt) {
|
|
9
|
+
super(empresaUrl, "portal-contador/empresa", tokenJwt);
|
|
10
|
+
this.pessoaUrl = pessoaUrl;
|
|
11
|
+
this.token = tokenJwt;
|
|
12
|
+
this.pessoaSdk = new pessoas_1.PessoaClient(pessoaUrl, tokenJwt);
|
|
13
|
+
this.pessoaCnpjSdk = new pessoas_1.PessoaCnpjClient(pessoaUrl, tokenJwt);
|
|
14
|
+
this.enderecoSdk = new EnderecoCidadeClient_1.EnderecoCidadeClient(pessoaUrl, tokenJwt);
|
|
17
15
|
}
|
|
18
16
|
async criarEmpresaRoot(cnpj, ie, regimeTributario, razaoSocial, lucroReal, industria) {
|
|
19
17
|
if (regimeTributario < 1 || regimeTributario > 3)
|
|
20
|
-
throw new Error("Regime tributário inválido.
|
|
21
|
-
const
|
|
22
|
-
await this.
|
|
23
|
-
}
|
|
24
|
-
async incluirEmpresaRootCompleto(cnpj, razaoSocial, endereco, telefones) {
|
|
25
|
-
}
|
|
26
|
-
async incluirClientePj(cnpjPai, cnpjFilho, razaoSocialFilho) {
|
|
27
|
-
}
|
|
28
|
-
async incluirClientePjCompleto(cnpjPai, cnpjFilho, razaoSocialFilho, endereco, telefones) {
|
|
29
|
-
}
|
|
30
|
-
async incluirClientePf(cnpjPai, cpfFilho, nomeCompletoFilho) {
|
|
31
|
-
}
|
|
32
|
-
async incluirClientePfCompleto(cnpjPai, cpfFilho, nomeCompletoFilho, endereco, telefones) {
|
|
18
|
+
throw new Error("Regime tributário inválido.");
|
|
19
|
+
const pessoa = await this.pessoaSdk.postarPessoa(razaoSocial, "I");
|
|
20
|
+
await this.pessoaCnpjSdk.postarPessoaCnpj(pessoa.PessoaId, cnpj, ie, regimeTributario, lucroReal, industria);
|
|
33
21
|
}
|
|
34
22
|
}
|
|
35
23
|
exports.EmpresaSdk = EmpresaSdk;
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
47
|
-
|
|
8
|
+
private readonly pessoaUrl: string;
|
|
9
|
+
private readonly token: string;
|
|
48
10
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
}
|
|
11
|
+
private readonly pessoaSdk: PessoaClient;
|
|
12
|
+
private readonly pessoaCnpjSdk: PessoaCnpjClient;
|
|
13
|
+
private readonly enderecoSdk: EnderecoCidadeClient;
|
|
55
14
|
|
|
56
|
-
|
|
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";
|