7vsdk-pessoas 1.0.27 → 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;
|