nfets 0.0.14 → 0.0.16

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,6 +1,6 @@
1
- import { StateCode, EnvironmentCode, DecimalValue, StateAcronym, TransmitterOptions, Transmitter, Client, RequestConfig, SignedEntity, NFeTsError, ReadCertificateResponse, RemoteTransmissionRepository, ReadCertificateRequest, HttpClient, XmlToolkit, CacheAdapter, CertificateRepository } from '@nfets/core/domain';
1
+ import { StateCode, EnvironmentCode, DecimalValue, Signature, StateAcronym, TransmitterOptions, Transmitter, Client, RequestConfig, SignedEntity, NFeTsError, ReadCertificateResponse, RemoteTransmissionRepository, Namespaced, ReadCertificateRequest, HttpClient, XmlToolkit, CacheAdapter, CertificateRepository } from '@nfets/core/domain';
2
2
  import { Either } from '@nfets/core/shared/either';
3
- import { StateCode as StateCode$1, EnvironmentCode as EnvironmentCode$1, StateCodes, StateAcronym as StateAcronym$1, Either as Either$1, CertificateRepository as CertificateRepository$1, SignedEntity as SignedEntity$1 } from '@nfets/core';
3
+ import { StateCode as StateCode$1, EnvironmentCode as EnvironmentCode$1, StateCodes, StateAcronym as StateAcronym$1, Either as Either$1, CertificateRepository as CertificateRepository$1, SignedEntity as SignedEntity$1, Signature as Signature$1 } from '@nfets/core';
4
4
  import { Either as Either$2, DeepPartial } from '@nfets/core/shared';
5
5
  import { Ide as Ide$1 } from '@nfets/nfe/domain/entities/nfe/inf-nfe/ide';
6
6
  import { InfNFeAttributes as InfNFeAttributes$1, InfNFe as InfNFe$1 } from '@nfets/nfe/domain/entities/nfe/inf-nfe';
@@ -35,13 +35,13 @@ import { INfeXmlBuilder as INfeXmlBuilder$1, InfNFeBuilder as InfNFeBuilder$1, I
35
35
  import * as _nfets_nfe_domain_entities_services_autorizacao from '@nfets/nfe/domain/entities/services/autorizacao';
36
36
  import { AutorizacaoPayload as AutorizacaoPayload$1, AutorizacaoResponse as AutorizacaoResponse$1 } from '@nfets/nfe/domain/entities/services/autorizacao';
37
37
  import { L as Left, R as Right, E as Either$3, N as NFeTsError$1 } from '../either-CdHd_Yt7.cjs';
38
- import { EntitySigner } from '@nfets/core/application';
39
38
  import { NfeTransmitter as NfeTransmitter$1, NfeRemoteClient as NfeRemoteClient$1, NfeTransmitterOptions as NfeTransmitterOptions$1, ContingencyOptions as ContingencyOptions$1 } from '@nfets/nfe/domain/entities/transmission/nfe-remote-client';
40
39
  import { NFe as NFe$3 } from '@nfets/nfe/infrastructure/dto/nfe/nfe';
40
+ import { EntitySigner } from '@nfets/core/application';
41
41
  import * as _nfets_nfe_domain_entities_services_consulta_cadastro from '@nfets/nfe/domain/entities/services/consulta-cadastro';
42
42
  import { ConsultaCadastroPayload as ConsultaCadastroPayload$1 } from '@nfets/nfe/domain/entities/services/consulta-cadastro';
43
43
  import * as _nfets_nfe_domain_entities_services_evento from '@nfets/nfe/domain/entities/services/evento';
44
- import { EventoPayload as EventoPayload$1 } from '@nfets/nfe/domain/entities/services/evento';
44
+ import { EventoRequest as EventoRequest$1 } from '@nfets/nfe/domain/entities/services/evento';
45
45
  import * as _nfets_nfe_domain_entities_services_ret_autorizacao from '@nfets/nfe/domain/entities/services/ret-autorizacao';
46
46
  import { RetAutorizacaoPayload as RetAutorizacaoPayload$1 } from '@nfets/nfe/domain/entities/services/ret-autorizacao';
47
47
  import * as _nfets_nfe_domain_entities_services_consulta_protocolo from '@nfets/nfe/domain/entities/services/consulta-protocolo';
@@ -78,6 +78,7 @@ interface VerifiedAccessKey extends AccessKey {
78
78
 
79
79
  declare enum TpEmis {
80
80
  Normal = "1",
81
+ EPEC = "4",
81
82
  SVCAN = "6",
82
83
  SVCRS = "7",
83
84
  OFFLINE = "9"
@@ -755,7 +756,7 @@ interface ObsItem {
755
756
  }
756
757
 
757
758
  interface DetAttributes {
758
- nItem?: string;
759
+ nItem: string;
759
760
  }
760
761
  interface Det {
761
762
  $: DetAttributes;
@@ -888,6 +889,30 @@ interface Cobr {
888
889
  dup?: Dup[];
889
890
  }
890
891
 
892
+ declare const TPags: {
893
+ readonly Dinheiro: "01";
894
+ readonly Cheque: "02";
895
+ readonly CartaoDeCredito: "03";
896
+ readonly CartaoDeDebito: "04";
897
+ readonly CartaoDaLoja: "05";
898
+ readonly ValeAlimentacao: "10";
899
+ readonly ValeRefeicao: "11";
900
+ readonly ValePresente: "12";
901
+ readonly ValeCombustivel: "13";
902
+ readonly BoletoBancario: "15";
903
+ readonly DepositoBancario: "16";
904
+ readonly PIXDinamico: "17";
905
+ readonly TransferenciaBancaria: "18";
906
+ readonly ProgramaFidelidade: "19";
907
+ readonly PIXEstatico: "20";
908
+ readonly CreditoEmLoja: "21";
909
+ readonly PagamentoNaoInformado: "22";
910
+ readonly SemPagamento: "90";
911
+ readonly PagamentoPosterior: "91";
912
+ readonly Outros: "99";
913
+ };
914
+ type TPag = (typeof TPags)[keyof typeof TPags];
915
+
891
916
  interface Card {
892
917
  cNPJ?: string;
893
918
  tBand?: string;
@@ -895,7 +920,7 @@ interface Card {
895
920
  }
896
921
  interface DetPag {
897
922
  indPag?: string;
898
- tPag: string;
923
+ tPag: TPag;
899
924
  vPag: DecimalValue;
900
925
  card?: Card;
901
926
  xPag?: string;
@@ -976,6 +1001,26 @@ interface InfNFe {
976
1001
  infSolicNFF?: InfSolicNFF;
977
1002
  }
978
1003
 
1004
+ interface ProtNFeAttributes {
1005
+ versao: string;
1006
+ }
1007
+ interface InfProt {
1008
+ tpAmb: string;
1009
+ verAplic: string;
1010
+ chNFe: string;
1011
+ dhRecbto: string;
1012
+ nProt: string;
1013
+ digVal: string;
1014
+ cStat: string;
1015
+ xMotivo: string;
1016
+ cMsg?: string;
1017
+ xMsg?: string;
1018
+ }
1019
+ interface ProtNFe$1 {
1020
+ $: ProtNFeAttributes;
1021
+ infProt: InfProt;
1022
+ }
1023
+
979
1024
  interface NFeAttributes {
980
1025
  xmlns: 'http://www.portalfiscal.inf.br/nfe';
981
1026
  }
@@ -983,6 +1028,10 @@ interface NFe$1 {
983
1028
  $: NFeAttributes;
984
1029
  infNFe: InfNFe;
985
1030
  }
1031
+ interface NFeProc {
1032
+ NFe: NFe$1;
1033
+ protNFe: ProtNFe$1;
1034
+ }
986
1035
 
987
1036
  interface InfNFeSupl {
988
1037
  qrCode: string;
@@ -992,6 +1041,10 @@ interface InfNFeSupl {
992
1041
  interface NFCe$1 extends NFe$1 {
993
1042
  infNFeSupl: InfNFeSupl;
994
1043
  }
1044
+ interface NFCeProc {
1045
+ NFe: NFCe$1;
1046
+ protNFe: ProtNFe$1;
1047
+ }
995
1048
 
996
1049
  interface ConsultStatusPayload {
997
1050
  tpAmb: EnvironmentCode;
@@ -1018,29 +1071,32 @@ interface ConsultStatusResponse {
1018
1071
  };
1019
1072
  }
1020
1073
 
1021
- interface InutilizacaoPayload {
1074
+ interface InfInutAttributes {
1075
+ Id: string;
1076
+ }
1077
+ interface InfInut {
1078
+ $: InfInutAttributes;
1022
1079
  tpAmb?: EnvironmentCode;
1023
1080
  xServ?: 'INUTILIZAR';
1024
1081
  cUF?: StateCode;
1025
1082
  ano: string;
1026
- CNPJ: string;
1083
+ CNPJ?: string;
1084
+ CPF?: string;
1027
1085
  mod: string;
1028
1086
  serie: string;
1029
1087
  nNFIni: string;
1030
1088
  nNFFin: string;
1031
1089
  xJust: string;
1032
1090
  }
1091
+ interface InutNFeAttributes {
1092
+ xmlns: string;
1093
+ }
1094
+ interface InutilizacaoPayload {
1095
+ $: InutNFeAttributes;
1096
+ infInut: InfInut;
1097
+ }
1033
1098
  interface InutilizacaoRequest {
1034
- inutNFe: {
1035
- $: {
1036
- versao: string;
1037
- };
1038
- infInut: InutilizacaoPayload & {
1039
- $: {
1040
- Id: string;
1041
- };
1042
- };
1043
- };
1099
+ inutNFe: InutilizacaoPayload;
1044
1100
  }
1045
1101
  interface InutilizacaoResponse {
1046
1102
  retInutNFe: {
@@ -1068,39 +1124,67 @@ interface InutilizacaoResponse {
1068
1124
  };
1069
1125
  }
1070
1126
 
1071
- interface EventoPayload {
1072
- tpAmb: EnvironmentCode;
1073
- cUF: StateCode;
1127
+ declare enum TpEvent {
1128
+ Cancelamento = "110111"
1129
+ }
1130
+
1131
+ interface EventoPayload<T> {
1074
1132
  idLote: string;
1075
- evento: EventoItem | EventoItem[];
1133
+ evento: EventoItem<T>;
1134
+ }
1135
+ interface InfEventoAttributes {
1136
+ Id: string;
1137
+ }
1138
+ interface InfEvento<T> {
1139
+ $: InfEventoAttributes;
1140
+ cOrgao: StateCode;
1141
+ tpAmb: EnvironmentCode;
1142
+ CNPJ?: string;
1143
+ CPF?: string;
1144
+ chNFe: string;
1145
+ dhEvento: string;
1146
+ tpEvento: TpEvent;
1147
+ nSeqEvento: number;
1148
+ verEvento: string;
1149
+ detEvento: T;
1150
+ }
1151
+ interface EventoItemAttributes {
1152
+ xmlns: string;
1153
+ }
1154
+ interface EventoItem<T> {
1155
+ $: EventoItemAttributes;
1156
+ infEvento: InfEvento<T>;
1076
1157
  }
1077
- interface EventoItem {
1158
+ interface EventoRequest<T> {
1159
+ envEvento: EventoPayload<{
1160
+ descEvento: string;
1161
+ } & T>;
1162
+ }
1163
+ interface RetEvento {
1078
1164
  $: {
1079
1165
  versao: string;
1080
1166
  };
1081
1167
  infEvento: {
1082
- $: {
1083
- Id: string;
1168
+ $?: {
1169
+ Id?: string;
1084
1170
  };
1085
- cOrgao: string;
1086
1171
  tpAmb: string;
1087
- CNPJ?: string;
1088
- CPF?: string;
1089
- chNFe: string;
1090
- dhEvento: string;
1091
- tpEvento: string;
1092
- nSeqEvento: string;
1093
- verEvento: string;
1094
- detEvento: {
1095
- $: {
1096
- versao: string;
1097
- };
1098
- [key: string]: unknown;
1099
- };
1172
+ verAplic: string;
1173
+ cOrgao: string;
1174
+ cStat: string;
1175
+ xMotivo: string;
1176
+ chNFe?: string;
1177
+ tpEvento?: string;
1178
+ xEvento?: string;
1179
+ nSeqEvento?: string;
1180
+ cOrgaoAutor?: string;
1181
+ CNPJDest?: string;
1182
+ CPFDest?: string;
1183
+ emailDest?: string;
1184
+ dhRegEvento: string;
1185
+ nProt?: string;
1100
1186
  };
1101
- }
1102
- interface EventoRequest {
1103
- envEvento: EventoPayload;
1187
+ Signature?: Signature;
1104
1188
  }
1105
1189
  interface EventoResponse {
1106
1190
  retEnvEvento: {
@@ -1113,31 +1197,7 @@ interface EventoResponse {
1113
1197
  cOrgao: string;
1114
1198
  cStat: string;
1115
1199
  xMotivo: string;
1116
- retEvento?: {
1117
- $: {
1118
- versao: string;
1119
- };
1120
- infEvento: {
1121
- tpAmb: string;
1122
- verAplic: string;
1123
- cOrgao: string;
1124
- cStat: string;
1125
- xMotivo: string;
1126
- chNFe?: string;
1127
- tpEvento?: string;
1128
- xEvento?: string;
1129
- nSeqEvento?: string;
1130
- cOrgaoAutor?: string;
1131
- CNPJDest?: string;
1132
- CPFDest?: string;
1133
- emailDest?: string;
1134
- dhRegEvento: string;
1135
- nProt?: string;
1136
- $?: {
1137
- Id?: string;
1138
- };
1139
- };
1140
- }[];
1200
+ retEvento?: RetEvento;
1141
1201
  };
1142
1202
  }
1143
1203
 
@@ -1213,7 +1273,7 @@ interface ProcEventoNFe {
1213
1273
  $: {
1214
1274
  versao: string;
1215
1275
  };
1216
- evento: EventoItem;
1276
+ evento: EventoItem<unknown>;
1217
1277
  retEvento: RetEventoItem;
1218
1278
  }
1219
1279
  interface ConsultaProtocoloResponse {
@@ -1387,7 +1447,7 @@ interface NfeTransmitter extends Transmitter<NfeRemoteClient> {
1387
1447
  consultaProtocolo(payload: ConsultaProtocoloPayload): Promise<Either<NFeTsError, ConsultaProtocoloResponse>>;
1388
1448
  autorizacao(payload: AutorizacaoPayload<SignedEntity<NFe$1>>): Promise<Either<NFeTsError, AutorizacaoResponse>>;
1389
1449
  retAutorizacao(payload: RetAutorizacaoPayload): Promise<Either<NFeTsError, RetAutorizacaoResponse>>;
1390
- recepcaoEvento(payload: EventoPayload): Promise<Either<NFeTsError, EventoResponse>>;
1450
+ recepcaoEvento<T>(payload: EventoPayload<T>): Promise<Either<NFeTsError, EventoResponse>>;
1391
1451
  consultaCadastro(payload: ConsultaCadastroPayload): Promise<Either<NFeTsError, ConsultaCadastroResponse>>;
1392
1452
  }
1393
1453
  interface NfeRemoteClient extends Client {
@@ -1396,7 +1456,7 @@ interface NfeRemoteClient extends Client {
1396
1456
  nfeConsultaNF(args: ConsultaProtocoloRequest, opt?: RequestConfig): Promise<ConsultaProtocoloResponse>;
1397
1457
  nfeAutorizacaoLote(args: AutorizacaoRequest<SignedEntity<NFe$1>>, opt?: RequestConfig): Promise<AutorizacaoResponse>;
1398
1458
  nfeRetAutorizacaoLote(args: RetAutorizacaoRequest, opt?: RequestConfig): Promise<RetAutorizacaoResponse>;
1399
- nfeRecepcaoEvento(args: EventoRequest, opt?: RequestConfig): Promise<EventoResponse>;
1459
+ nfeRecepcaoEvento<T>(args: EventoRequest<T>, opt?: RequestConfig): Promise<EventoResponse>;
1400
1460
  consultaCadastro(args: ConsultaCadastroRequest, opt?: RequestConfig): Promise<ConsultaCadastroResponse>;
1401
1461
  }
1402
1462
 
@@ -2985,24 +3045,25 @@ declare class NfeRemoteTransmitter implements NfeTransmitter$1 {
2985
3045
  service<WS extends Record<string, unknown> = typeof webservices$1, O extends Record<string, unknown> = typeof _default$1, S extends StateCode = StateCode, E extends EnvironmentCode = EnvironmentCode>(options: ServiceOptions$1<WS, O, S, E>): Webservice;
2986
3046
  protected errors(): string[] | undefined;
2987
3047
  protected validate<T extends object>(payload: T): Left<NFeTsError> | Right<T>;
2988
- protected payload<T extends object>(payload: T, version: string): {
3048
+ protected ns<T extends object>(payload: Namespaced<T>, version: string): T & {
2989
3049
  $: {
2990
3050
  xmlns: string;
2991
3051
  versao: string;
2992
3052
  };
2993
- } & T;
3053
+ };
2994
3054
  protected xsd(name: string): string;
2995
3055
  consultStatus(payload: ConsultStatusPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_consult_status.ConsultStatusResponse>>;
2996
3056
  inutilizacao(payload: InutilizacaoPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_inutilizacao.InutilizacaoResponse>>;
2997
3057
  consultaProtocolo(payload: ConsultaProtocoloPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_consulta_protocolo.ConsultaProtocoloResponse>>;
2998
3058
  autorizacao(payload: AutorizacaoPayload$1<SignedEntity<NFe$2>>): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_autorizacao.AutorizacaoResponse>>;
2999
3059
  retAutorizacao(payload: RetAutorizacaoPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_ret_autorizacao.RetAutorizacaoResponse>>;
3000
- recepcaoEvento(payload: EventoPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_evento.EventoResponse>>;
3060
+ recepcaoEvento<T>(payload: EventoRequest$1<T>['envEvento']): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_evento.EventoResponse>>;
3001
3061
  consultaCadastro(payload: ConsultaCadastroPayload$1): Promise<Either$3<NFeTsError, _nfets_nfe_domain_entities_services_consulta_cadastro.ConsultaCadastroResponse>>;
3002
3062
  }
3003
3063
 
3004
- declare class NfeAuthorizerPipeline {
3064
+ declare abstract class Pipeline {
3005
3065
  protected readonly certificate: ReadCertificateRequest;
3066
+ protected readonly xmlns = "http://www.portalfiscal.inf.br/nfe";
3006
3067
  protected readonly http: HttpClient;
3007
3068
  protected readonly toolkit: XmlToolkit;
3008
3069
  protected readonly caching: CacheAdapter;
@@ -3011,6 +3072,10 @@ declare class NfeAuthorizerPipeline {
3011
3072
  protected readonly transmitter: NfeRemoteTransmitter;
3012
3073
  protected readonly signer: EntitySigner;
3013
3074
  constructor(certificate: ReadCertificateRequest);
3075
+ protected errors(): string[] | undefined;
3076
+ }
3077
+
3078
+ declare class NfeAuthorizerPipeline extends Pipeline {
3014
3079
  execute(payload: AutorizacaoPayload$1<NFe$3>, options?: Pick<NfeTransmitterOptions$1, 'schema'>): Promise<Either$3<NFeTsError$1, _nfets_nfe_domain_entities_services_autorizacao.AutorizacaoResponse>>;
3015
3080
  protected contingency(payload: AutorizacaoPayload$1<NFe$3>): {
3016
3081
  dhCont: string;
@@ -4613,10 +4678,14 @@ declare class NfeDetXmlBuilder implements INfeDetXmlBuilder$1 {
4613
4678
  declare class NFe implements NFe$2 {
4614
4679
  $: NFeAttributes$1;
4615
4680
  infNFe: InfNFe$1;
4681
+ Signature?: Signature$1;
4616
4682
  }
4617
4683
 
4618
- declare class NFCe extends NFe implements NFCe$2 {
4684
+ declare class NFCe implements NFCe$2 {
4685
+ $: NFeAttributes$1;
4686
+ infNFe: InfNFe$1;
4619
4687
  infNFeSupl: InfNFeSupl$1;
4688
+ Signature?: Signature;
4620
4689
  }
4621
4690
 
4622
- export { type AccessKey, AccessKeyBuilder, type ContingencyOptions, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DetBuilderAggregator, nfeDetXmlBuilder as INfeDetXmlBuilder, nfeXmlBuilder as INfeXmlBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfeAuthorizerPipeline, NfeDetXmlBuilder, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, type Schema, type TotalBuilderAggregator, TpEmis, type VerifiedAccessKey, directory };
4691
+ export { type AccessKey, AccessKeyBuilder, type ContingencyOptions, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DetBuilderAggregator, nfeDetXmlBuilder as INfeDetXmlBuilder, nfeXmlBuilder as INfeXmlBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFCeProc, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, type NFeProc, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfeAuthorizerPipeline, NfeDetXmlBuilder, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, type Schema, type TotalBuilderAggregator, TpEmis, type VerifiedAccessKey, directory };