@liderautomacao/emissor-fiscal-sdk 1.1.21 → 1.1.22

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,4 +1,5 @@
1
- export * from './nfse-envio-cancelamento';
1
+ export * from './nfse-envio-cancelamento-por-chave';
2
+ export * from './nfse-envio-cancelamento-por-rps';
2
3
  export * from './nfse-envio-consulta-por-chave';
3
4
  export * from './nfse-envio-consulta-por-rps';
4
5
  export * from './nfse-envio-emitir';
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./nfse-envio-cancelamento"), exports);
17
+ __exportStar(require("./nfse-envio-cancelamento-por-chave"), exports);
18
+ __exportStar(require("./nfse-envio-cancelamento-por-rps"), exports);
18
19
  __exportStar(require("./nfse-envio-consulta-por-chave"), exports);
19
20
  __exportStar(require("./nfse-envio-consulta-por-rps"), exports);
20
21
  __exportStar(require("./nfse-envio-emitir"), exports);
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ export declare const NfseEnvioCancelamentoPorChaveSchema: z.ZodObject<{
3
+ configuracoes: z.ZodObject<{
4
+ logo: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodBase64]>>>;
5
+ site: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
6
+ sistema: z.ZodDefault<z.ZodString>;
7
+ certificado: z.ZodObject<{
8
+ arquivoBase64: z.ZodBase64;
9
+ senha: z.ZodString;
10
+ }, z.core.$strip>;
11
+ configuracoesEnvio: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ modelo: z.ZodLiteral<99>;
13
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
14
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
17
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ tipoEmissao: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<9>]>>;
19
+ modelo: z.ZodLiteral<65>;
20
+ idCSC: z.ZodString;
21
+ csc: z.ZodString;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
24
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ modelo: z.ZodLiteral<55>;
26
+ tipoEmissao: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<9>]>>;
27
+ }, z.core.$strip>], "modelo">;
28
+ emitente: z.ZodObject<{
29
+ documento: z.ZodString;
30
+ razao: z.ZodString;
31
+ fantasia: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ inscicaoMunicipal: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>>;
33
+ inscicaoEstadual: z.ZodString;
34
+ regimeTributario: z.ZodNumber;
35
+ incentivadorCultural: z.ZodDefault<z.ZodBoolean>;
36
+ contato: z.ZodOptional<z.ZodNullable<z.ZodObject<{
37
+ email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
38
+ telefone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ }, z.core.$strip>>>;
40
+ endereco: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
+ logradouro: z.ZodString;
42
+ numero: z.ZodCoercedString<unknown>;
43
+ bairro: z.ZodString;
44
+ municipioCodigo: z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodTransform<number, string>>;
45
+ municipioNome: z.ZodString;
46
+ complemento: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ cep: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
48
+ paisCodigo: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
49
+ paisNome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ uf: z.ZodEnum<{
51
+ AC: "AC";
52
+ AL: "AL";
53
+ AM: "AM";
54
+ AP: "AP";
55
+ BA: "BA";
56
+ CE: "CE";
57
+ DF: "DF";
58
+ ES: "ES";
59
+ GO: "GO";
60
+ MA: "MA";
61
+ MG: "MG";
62
+ MS: "MS";
63
+ MT: "MT";
64
+ PA: "PA";
65
+ PB: "PB";
66
+ PE: "PE";
67
+ PI: "PI";
68
+ PR: "PR";
69
+ RJ: "RJ";
70
+ RN: "RN";
71
+ RO: "RO";
72
+ RR: "RR";
73
+ RS: "RS";
74
+ SC: "SC";
75
+ SE: "SE";
76
+ SP: "SP";
77
+ TO: "TO";
78
+ }>;
79
+ }, z.core.$strip>>>;
80
+ }, z.core.$strip>;
81
+ email: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodObject<{
82
+ host: z.ZodString;
83
+ password: z.ZodString;
84
+ port: z.ZodCoercedString<unknown>;
85
+ userName: z.ZodString;
86
+ }, z.core.$strip>>>>;
87
+ webService: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
88
+ usuario: z.ZodString;
89
+ senha: z.ZodString;
90
+ usaPadraoNacional: z.ZodDefault<z.ZodBoolean>;
91
+ chaveAutoriz: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ chaveAcesso: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
+ fraseSecr: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ }, z.core.$strip>>>>;
95
+ }, z.core.$strip>;
96
+ dados: z.ZodObject<{
97
+ chave: z.ZodNullable<z.ZodOptional<z.ZodString>>;
98
+ codigoCancelamento: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
99
+ motivo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
100
+ }, z.core.$strip>;
101
+ }, z.core.$strip>;
102
+ export type NfseEnvioCancelamentoPorChave = z.infer<typeof NfseEnvioCancelamentoPorChaveSchema>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NfseEnvioCancelamentoPorChaveSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ const DadosSchema = zod_1.z.object({
7
+ chave: zod_1.z.string().optional().nullable(),
8
+ codigoCancelamento: zod_1.z.number().int().min(1).max(99).optional().nullable(),
9
+ motivo: zod_1.z.string().max(255).optional().nullable(),
10
+ });
11
+ exports.NfseEnvioCancelamentoPorChaveSchema = zod_1.z.object({
12
+ configuracoes: models_1.ConfiguracoesSchema,
13
+ dados: DadosSchema,
14
+ });
@@ -0,0 +1,107 @@
1
+ import { z } from 'zod';
2
+ export declare const NfseEnvioCancelamentoPorRpsSchema: z.ZodObject<{
3
+ configuracoes: z.ZodObject<{
4
+ logo: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodBase64]>>>;
5
+ site: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
6
+ sistema: z.ZodDefault<z.ZodString>;
7
+ certificado: z.ZodObject<{
8
+ arquivoBase64: z.ZodBase64;
9
+ senha: z.ZodString;
10
+ }, z.core.$strip>;
11
+ configuracoesEnvio: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ modelo: z.ZodLiteral<99>;
13
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
14
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
17
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ tipoEmissao: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<9>]>>;
19
+ modelo: z.ZodLiteral<65>;
20
+ idCSC: z.ZodString;
21
+ csc: z.ZodString;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ ambiente: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
24
+ documentoContador: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ modelo: z.ZodLiteral<55>;
26
+ tipoEmissao: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<9>]>>;
27
+ }, z.core.$strip>], "modelo">;
28
+ emitente: z.ZodObject<{
29
+ documento: z.ZodString;
30
+ razao: z.ZodString;
31
+ fantasia: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ inscicaoMunicipal: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>>;
33
+ inscicaoEstadual: z.ZodString;
34
+ regimeTributario: z.ZodNumber;
35
+ incentivadorCultural: z.ZodDefault<z.ZodBoolean>;
36
+ contato: z.ZodOptional<z.ZodNullable<z.ZodObject<{
37
+ email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
38
+ telefone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ }, z.core.$strip>>>;
40
+ endereco: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
+ logradouro: z.ZodString;
42
+ numero: z.ZodCoercedString<unknown>;
43
+ bairro: z.ZodString;
44
+ municipioCodigo: z.ZodPipe<z.ZodCoercedString<unknown>, z.ZodTransform<number, string>>;
45
+ municipioNome: z.ZodString;
46
+ complemento: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ cep: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
48
+ paisCodigo: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
49
+ paisNome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ uf: z.ZodEnum<{
51
+ AC: "AC";
52
+ AL: "AL";
53
+ AM: "AM";
54
+ AP: "AP";
55
+ BA: "BA";
56
+ CE: "CE";
57
+ DF: "DF";
58
+ ES: "ES";
59
+ GO: "GO";
60
+ MA: "MA";
61
+ MG: "MG";
62
+ MS: "MS";
63
+ MT: "MT";
64
+ PA: "PA";
65
+ PB: "PB";
66
+ PE: "PE";
67
+ PI: "PI";
68
+ PR: "PR";
69
+ RJ: "RJ";
70
+ RN: "RN";
71
+ RO: "RO";
72
+ RR: "RR";
73
+ RS: "RS";
74
+ SC: "SC";
75
+ SE: "SE";
76
+ SP: "SP";
77
+ TO: "TO";
78
+ }>;
79
+ }, z.core.$strip>>>;
80
+ }, z.core.$strip>;
81
+ email: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodObject<{
82
+ host: z.ZodString;
83
+ password: z.ZodString;
84
+ port: z.ZodCoercedString<unknown>;
85
+ userName: z.ZodString;
86
+ }, z.core.$strip>>>>;
87
+ webService: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
88
+ usuario: z.ZodString;
89
+ senha: z.ZodString;
90
+ usaPadraoNacional: z.ZodDefault<z.ZodBoolean>;
91
+ chaveAutoriz: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ chaveAcesso: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
+ fraseSecr: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ }, z.core.$strip>>>>;
95
+ }, z.core.$strip>;
96
+ dados: z.ZodObject<{
97
+ numeroNFSe: z.ZodNullable<z.ZodOptional<z.ZodString>>;
98
+ numeroRps: z.ZodNullable<z.ZodOptional<z.ZodString>>;
99
+ serie: z.ZodNullable<z.ZodOptional<z.ZodString>>;
100
+ lote: z.ZodNullable<z.ZodOptional<z.ZodString>>;
101
+ protocolo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
102
+ codigoCancelamento: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
103
+ motivo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
104
+ tipoRps: z.ZodNullable<z.ZodOptional<z.ZodString>>;
105
+ }, z.core.$strip>;
106
+ }, z.core.$strip>;
107
+ export type NfseEnvioCancelamentoPorRps = z.infer<typeof NfseEnvioCancelamentoPorRpsSchema>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NfseEnvioCancelamentoPorRpsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ const DadosSchema = zod_1.z.object({
7
+ numeroNFSe: zod_1.z.string().optional().nullable(),
8
+ numeroRps: zod_1.z.string().optional().nullable(),
9
+ serie: zod_1.z.string().optional().nullable(),
10
+ lote: zod_1.z.string().optional().nullable(),
11
+ protocolo: zod_1.z.string().optional().nullable(),
12
+ codigoCancelamento: zod_1.z.number().int().min(1).max(99).optional().nullable(),
13
+ motivo: zod_1.z.string().max(255).optional().nullable(),
14
+ tipoRps: zod_1.z.string().max(1).optional().nullable(),
15
+ });
16
+ exports.NfseEnvioCancelamentoPorRpsSchema = zod_1.z.object({
17
+ configuracoes: models_1.ConfiguracoesSchema,
18
+ dados: DadosSchema,
19
+ });
@@ -1,6 +1,8 @@
1
+ export * from './beneficio-municipal';
1
2
  export * from './exigibilidade-iss';
2
3
  export * from './ibs-cbs';
3
4
  export * from './nfse';
5
+ export * from './obra';
4
6
  export * from './orgao-gerador';
5
7
  export * from './regime-especial-tributacao';
6
8
  export * from './rps';
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./beneficio-municipal"), exports);
17
18
  __exportStar(require("./exigibilidade-iss"), exports);
18
19
  __exportStar(require("./ibs-cbs"), exports);
19
20
  __exportStar(require("./nfse"), exports);
21
+ __exportStar(require("./obra"), exports);
20
22
  __exportStar(require("./orgao-gerador"), exports);
21
23
  __exportStar(require("./regime-especial-tributacao"), exports);
22
24
  __exportStar(require("./rps"), exports);
@@ -1,6 +1,6 @@
1
1
  import { EmissorFiscalApi } from "../api/emissor-fiscal-api.service";
2
- import { CalculaNfseRequest } from "../dtos";
3
- import { NfseEnvioCancelamento } from "../dtos/nfse/nfse-envio-cancelamento";
2
+ import { CalculaNfseRequest, NfseEnvioCancelamentoPorChave } from "../dtos";
3
+ import { NfseEnvioCancelamentoPorRps } from "../dtos/nfse/nfse-envio-cancelamento-por-rps";
4
4
  import { NfseEnvioConsultaPorChave } from "../dtos/nfse/nfse-envio-consulta-por-chave";
5
5
  import { NfseEnvioConsultaPorRps } from "../dtos/nfse/nfse-envio-consulta-por-rps";
6
6
  import { NfseEnvioEmitir } from "../dtos/nfse/nfse-envio-emitir";
@@ -210,7 +210,7 @@ export declare class NfseService {
210
210
  } | null | undefined;
211
211
  } | null | undefined;
212
212
  }>;
213
- cancelar(request: NfseEnvioCancelamento): Promise<{
213
+ cancelarPorChave(request: NfseEnvioCancelamentoPorRps): Promise<{
214
214
  data: Date;
215
215
  sucesso: boolean;
216
216
  msgCanc?: string | null | undefined;
@@ -218,7 +218,15 @@ export declare class NfseService {
218
218
  idEvento?: string | null | undefined;
219
219
  sequenciaEvento?: string | null | undefined;
220
220
  }>;
221
- consultarNfsePorChave(request: NfseEnvioConsultaPorChave): Promise<{
221
+ cancelarPorRps(request: NfseEnvioCancelamentoPorChave): Promise<{
222
+ data: Date;
223
+ sucesso: boolean;
224
+ msgCanc?: string | null | undefined;
225
+ situacao?: string | null | undefined;
226
+ idEvento?: string | null | undefined;
227
+ sequenciaEvento?: string | null | undefined;
228
+ }>;
229
+ consultarPorChave(request: NfseEnvioConsultaPorChave): Promise<{
222
230
  envio: Date;
223
231
  id?: string | null | undefined;
224
232
  serie?: string | null | undefined;
@@ -232,7 +240,7 @@ export declare class NfseService {
232
240
  codigoVerificacao?: string | null | undefined;
233
241
  xml?: string | null | undefined;
234
242
  }>;
235
- consultarNfsePorRps(request: NfseEnvioConsultaPorRps): Promise<{
243
+ consultarPorRps(request: NfseEnvioConsultaPorRps): Promise<{
236
244
  envio: Date;
237
245
  id?: string | null | undefined;
238
246
  serie?: string | null | undefined;
@@ -11,15 +11,19 @@ class NfseService {
11
11
  const usecase = new nfse_1.CalculaNfse(this.api);
12
12
  return usecase.executa(request);
13
13
  }
14
- async cancelar(request) {
15
- const usecase = new nfse_1.CancelarNfse(this.api);
14
+ async cancelarPorChave(request) {
15
+ const usecase = new nfse_1.CancelarNfsePorChave(this.api);
16
16
  return usecase.executa(request);
17
17
  }
18
- async consultarNfsePorChave(request) {
18
+ async cancelarPorRps(request) {
19
+ const usecase = new nfse_1.CancelarNfsePorRps(this.api);
20
+ return usecase.executa(request);
21
+ }
22
+ async consultarPorChave(request) {
19
23
  const usecase = new nfse_1.ConsultarNfsePorChave(this.api);
20
24
  return usecase.executa(request);
21
25
  }
22
- async consultarNfsePorRps(request) {
26
+ async consultarPorRps(request) {
23
27
  const usecase = new nfse_1.ConsultarNfsePorRps(this.api);
24
28
  return usecase.executa(request);
25
29
  }
@@ -0,0 +1,8 @@
1
+ import { EmissorFiscalApi } from "../../api/emissor-fiscal-api.service";
2
+ import { NfseRetornoCancelamento } from "../../dtos";
3
+ import { NfseEnvioCancelamentoPorChave } from "../../dtos/nfse/nfse-envio-cancelamento-por-chave";
4
+ export declare class CancelarNfsePorChave {
5
+ private readonly api;
6
+ constructor(api: EmissorFiscalApi);
7
+ executa(request: NfseEnvioCancelamentoPorChave): Promise<NfseRetornoCancelamento>;
8
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelarNfsePorChave = void 0;
4
+ const dtos_1 = require("../../dtos");
5
+ const nfse_envio_cancelamento_por_chave_1 = require("../../dtos/nfse/nfse-envio-cancelamento-por-chave");
6
+ const emissor_fiscal_error_1 = require("../../utils/errors/emissor-fiscal.error");
7
+ class CancelarNfsePorChave {
8
+ api;
9
+ constructor(api) {
10
+ this.api = api;
11
+ }
12
+ async executa(request) {
13
+ const parsedData = nfse_envio_cancelamento_por_chave_1.NfseEnvioCancelamentoPorChaveSchema.safeParse(request);
14
+ if (!parsedData.success) {
15
+ throw emissor_fiscal_error_1.EmissorFiscalError.fromZodError("Dados de envio inválidos", parsedData.error);
16
+ }
17
+ const response = await this.api.post('/nfse/cancelar', parsedData.data);
18
+ return dtos_1.NfseRetornoCancelamentoSchema.parse(response);
19
+ }
20
+ }
21
+ exports.CancelarNfsePorChave = CancelarNfsePorChave;
@@ -0,0 +1,8 @@
1
+ import { EmissorFiscalApi } from "../../api/emissor-fiscal-api.service";
2
+ import { NfseRetornoCancelamento } from "../../dtos";
3
+ import { NfseEnvioCancelamentoPorRps } from "../../dtos/nfse/nfse-envio-cancelamento-por-rps";
4
+ export declare class CancelarNfsePorRps {
5
+ private readonly api;
6
+ constructor(api: EmissorFiscalApi);
7
+ executa(request: NfseEnvioCancelamentoPorRps): Promise<NfseRetornoCancelamento>;
8
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelarNfsePorRps = void 0;
4
+ const dtos_1 = require("../../dtos");
5
+ const nfse_envio_cancelamento_por_rps_1 = require("../../dtos/nfse/nfse-envio-cancelamento-por-rps");
6
+ const emissor_fiscal_error_1 = require("../../utils/errors/emissor-fiscal.error");
7
+ class CancelarNfsePorRps {
8
+ api;
9
+ constructor(api) {
10
+ this.api = api;
11
+ }
12
+ async executa(request) {
13
+ const parsedData = nfse_envio_cancelamento_por_rps_1.NfseEnvioCancelamentoPorRpsSchema.safeParse(request);
14
+ if (!parsedData.success) {
15
+ throw emissor_fiscal_error_1.EmissorFiscalError.fromZodError("Dados de envio inválidos", parsedData.error);
16
+ }
17
+ const response = await this.api.post('/nfse/cancelar', parsedData.data);
18
+ return dtos_1.NfseRetornoCancelamentoSchema.parse(response);
19
+ }
20
+ }
21
+ exports.CancelarNfsePorRps = CancelarNfsePorRps;
@@ -1,5 +1,6 @@
1
1
  export * from './calcular-nfse';
2
- export * from './cancelar-nfse';
2
+ export * from './cancelar-nfse-chave';
3
+ export * from './cancelar-nfse-rps';
3
4
  export * from './consultar-nfse-chave';
4
5
  export * from './consultar-nfse-rps';
5
6
  export * from './emitir-nfse';
@@ -15,7 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./calcular-nfse"), exports);
18
- __exportStar(require("./cancelar-nfse"), exports);
18
+ __exportStar(require("./cancelar-nfse-chave"), exports);
19
+ __exportStar(require("./cancelar-nfse-rps"), exports);
19
20
  __exportStar(require("./consultar-nfse-chave"), exports);
20
21
  __exportStar(require("./consultar-nfse-rps"), exports);
21
22
  __exportStar(require("./emitir-nfse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liderautomacao/emissor-fiscal-sdk",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Um pacote npm com TypeScript.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,5 @@
1
- export * from './nfse-envio-cancelamento';
1
+ export * from './nfse-envio-cancelamento-por-chave';
2
+ export * from './nfse-envio-cancelamento-por-rps';
2
3
  export * from './nfse-envio-consulta-por-chave';
3
4
  export * from './nfse-envio-consulta-por-rps';
4
5
  export * from './nfse-envio-emitir';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { ConfiguracoesSchema } from '../../models';
3
+
4
+ const DadosSchema = z.object({
5
+ chave: z.string().optional().nullable(),
6
+ codigoCancelamento: z.number().int().min(1).max(99).optional().nullable(),
7
+ motivo: z.string().max(255).optional().nullable(),
8
+ });
9
+
10
+ export const NfseEnvioCancelamentoPorChaveSchema = z.object({
11
+ configuracoes: ConfiguracoesSchema,
12
+ dados: DadosSchema,
13
+ });
14
+
15
+ export type NfseEnvioCancelamentoPorChave = z.infer<typeof NfseEnvioCancelamentoPorChaveSchema>;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { ConfiguracoesSchema } from '../../models';
3
+
4
+ const DadosSchema = z.object({
5
+ numeroNFSe: z.string().optional().nullable(),
6
+ numeroRps: z.string().optional().nullable(),
7
+ serie: z.string().optional().nullable(),
8
+ lote: z.string().optional().nullable(),
9
+ protocolo: z.string().optional().nullable(),
10
+ codigoCancelamento: z.number().int().min(1).max(99).optional().nullable(),
11
+ motivo: z.string().max(255).optional().nullable(),
12
+ tipoRps: z.string().max(1).optional().nullable(),
13
+ });
14
+
15
+ export const NfseEnvioCancelamentoPorRpsSchema = z.object({
16
+ configuracoes: ConfiguracoesSchema,
17
+ dados: DadosSchema,
18
+ });
19
+
20
+ export type NfseEnvioCancelamentoPorRps = z.infer<typeof NfseEnvioCancelamentoPorRpsSchema>;
@@ -20,3 +20,4 @@ export * from './status';
20
20
  export * from './substituicao-tributaria';
21
21
  export * from './total';
22
22
  export * from './ufs';
23
+
@@ -19,3 +19,4 @@ export * from './reducao';
19
19
  export * from './transferencia_credito';
20
20
  export * from './tributacao_regular';
21
21
  export * from './uf';
22
+
@@ -4,4 +4,3 @@ export * from './icms';
4
4
  export * from './nfce';
5
5
  export * from './nfe';
6
6
  export * from './nfse';
7
-
@@ -1,6 +1,8 @@
1
+ export * from './beneficio-municipal';
1
2
  export * from './exigibilidade-iss';
2
3
  export * from './ibs-cbs';
3
4
  export * from './nfse';
5
+ export * from './obra';
4
6
  export * from './orgao-gerador';
5
7
  export * from './regime-especial-tributacao';
6
8
  export * from './rps';
@@ -8,3 +10,4 @@ export * from './servico';
8
10
  export * from './status-rps';
9
11
  export * from './tipo-rps';
10
12
  export * from './valores';
13
+
@@ -1,13 +1,13 @@
1
1
  import { EmissorFiscalApi } from "../api/emissor-fiscal-api.service";
2
- import { CalculaNfseRequest } from "../dtos";
3
- import { NfseEnvioCancelamento } from "../dtos/nfse/nfse-envio-cancelamento";
2
+ import { CalculaNfseRequest, NfseEnvioCancelamentoPorChave } from "../dtos";
3
+ import { NfseEnvioCancelamentoPorRps } from "../dtos/nfse/nfse-envio-cancelamento-por-rps";
4
4
  import { NfseEnvioConsultaPorChave } from "../dtos/nfse/nfse-envio-consulta-por-chave";
5
5
  import { NfseEnvioConsultaPorRps } from "../dtos/nfse/nfse-envio-consulta-por-rps";
6
6
  import { NfseEnvioEmitir } from "../dtos/nfse/nfse-envio-emitir";
7
7
  import { NfseEnvioEnviarEmail } from "../dtos/nfse/nfse-envio-enviar-email";
8
8
  import { NfseEnvioGerar } from "../dtos/nfse/nfse-envio-gerar";
9
9
  import { NfseEnvioImpressao } from "../dtos/nfse/nfse-envio-impressao";
10
- import { CalculaNfse, CancelarNfse, ConsultarNfsePorChave, ConsultarNfsePorRps, EmitirNfse, EnviarNfsePorEmail, GerarNfse, ImprimirNfse } from "../use-cases/nfse";
10
+ import { CalculaNfse, CancelarNfsePorChave, CancelarNfsePorRps, ConsultarNfsePorChave, ConsultarNfsePorRps, EmitirNfse, EnviarNfsePorEmail, GerarNfse, ImprimirNfse } from "../use-cases/nfse";
11
11
 
12
12
  export class NfseService {
13
13
 
@@ -18,17 +18,22 @@ export class NfseService {
18
18
  return usecase.executa(request);
19
19
  }
20
20
 
21
- public async cancelar(request: NfseEnvioCancelamento) {
22
- const usecase = new CancelarNfse(this.api)
21
+ public async cancelarPorChave(request: NfseEnvioCancelamentoPorRps) {
22
+ const usecase = new CancelarNfsePorChave(this.api)
23
23
  return usecase.executa(request);
24
24
  }
25
25
 
26
- public async consultarNfsePorChave(request: NfseEnvioConsultaPorChave) {
26
+ public async cancelarPorRps(request: NfseEnvioCancelamentoPorChave) {
27
+ const usecase = new CancelarNfsePorRps(this.api)
28
+ return usecase.executa(request);
29
+ }
30
+
31
+ public async consultarPorChave(request: NfseEnvioConsultaPorChave) {
27
32
  const usecase = new ConsultarNfsePorChave(this.api)
28
33
  return usecase.executa(request);
29
34
  }
30
35
 
31
- public async consultarNfsePorRps(request: NfseEnvioConsultaPorRps) {
36
+ public async consultarPorRps(request: NfseEnvioConsultaPorRps) {
32
37
  const usecase = new ConsultarNfsePorRps(this.api)
33
38
  return usecase.executa(request);
34
39
  }
@@ -0,0 +1,26 @@
1
+ import { EmissorFiscalApi } from "../../api/emissor-fiscal-api.service";
2
+ import { NfseRetornoCancelamento, NfseRetornoCancelamentoSchema } from "../../dtos";
3
+ import { NfseEnvioCancelamentoPorChave, NfseEnvioCancelamentoPorChaveSchema } from "../../dtos/nfse/nfse-envio-cancelamento-por-chave";
4
+ import { EmissorFiscalError } from "../../utils/errors/emissor-fiscal.error";
5
+
6
+
7
+ export class CancelarNfsePorChave {
8
+ private readonly api: EmissorFiscalApi
9
+
10
+ constructor(api: EmissorFiscalApi) {
11
+ this.api = api;
12
+ }
13
+
14
+ async executa(request: NfseEnvioCancelamentoPorChave): Promise<NfseRetornoCancelamento> {
15
+ const parsedData = NfseEnvioCancelamentoPorChaveSchema.safeParse(request);
16
+
17
+ if (!parsedData.success) {
18
+ throw EmissorFiscalError.fromZodError("Dados de envio inválidos", parsedData.error);
19
+ }
20
+
21
+ const response = await this.api.post<any, NfseRetornoCancelamento>('/nfse/cancelar', parsedData.data);
22
+ return NfseRetornoCancelamentoSchema.parse(response);
23
+ }
24
+
25
+
26
+ }
@@ -1,18 +1,18 @@
1
1
  import { EmissorFiscalApi } from "../../api/emissor-fiscal-api.service";
2
2
  import { NfseRetornoCancelamento, NfseRetornoCancelamentoSchema } from "../../dtos";
3
- import { NfseEnvioCancelamento, NfseEnvioCancelamentoSchema } from "../../dtos/nfse/nfse-envio-cancelamento";
3
+ import { NfseEnvioCancelamentoPorRps, NfseEnvioCancelamentoPorRpsSchema } from "../../dtos/nfse/nfse-envio-cancelamento-por-rps";
4
4
  import { EmissorFiscalError } from "../../utils/errors/emissor-fiscal.error";
5
5
 
6
6
 
7
- export class CancelarNfse {
7
+ export class CancelarNfsePorRps {
8
8
  private readonly api: EmissorFiscalApi
9
9
 
10
10
  constructor(api: EmissorFiscalApi) {
11
11
  this.api = api;
12
12
  }
13
13
 
14
- async executa(request: NfseEnvioCancelamento): Promise<NfseRetornoCancelamento> {
15
- const parsedData = NfseEnvioCancelamentoSchema.safeParse(request);
14
+ async executa(request: NfseEnvioCancelamentoPorRps): Promise<NfseRetornoCancelamento> {
15
+ const parsedData = NfseEnvioCancelamentoPorRpsSchema.safeParse(request);
16
16
 
17
17
  if (!parsedData.success) {
18
18
  throw EmissorFiscalError.fromZodError("Dados de envio inválidos", parsedData.error);
@@ -1,8 +1,10 @@
1
1
  export * from './calcular-nfse';
2
- export * from './cancelar-nfse';
2
+ export * from './cancelar-nfse-chave';
3
+ export * from './cancelar-nfse-rps';
3
4
  export * from './consultar-nfse-chave';
4
5
  export * from './consultar-nfse-rps';
5
6
  export * from './emitir-nfse';
6
7
  export * from './enviar-nfse-por-email';
7
8
  export * from './gerar-nfse';
8
9
  export * from './imprimir-nfse';
10
+
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- import { ConfiguracoesSchema } from '../../models';
3
-
4
- const DadosSchema = z.union([
5
- z.object({
6
- numeroNFSe: z.string().optional().nullable(),
7
- numeroRps: z.string().optional().nullable(),
8
- serie: z.string().optional().nullable(),
9
- lote: z.string().optional().nullable(),
10
- protocolo: z.string().optional().nullable(),
11
- codigoCancelamento: z.number().int().min(1).max(99).optional().nullable(),
12
- motivo: z.string().max(255).optional().nullable(),
13
- tipoRps: z.string().max(1).optional().nullable(),
14
- }),
15
- z.object({
16
- chave: z.string().optional().nullable(),
17
- codigoCancelamento: z.number().int().min(1).max(99).optional().nullable(),
18
- motivo: z.string().max(255).optional().nullable(),
19
- })
20
- ]);
21
-
22
- export const NfseEnvioCancelamentoSchema = z.object({
23
- configuracoes: ConfiguracoesSchema,
24
- dados: DadosSchema,
25
- });
26
-
27
- export type NfseEnvioCancelamento = z.infer<typeof NfseEnvioCancelamentoSchema>;