@orbe-agro/client-core 5.6.134 → 5.6.136
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/dist/@ecme/services/ApiServiceJ.js +26 -0
- package/dist/@ecme/services/ApiServiceJ.js.map +1 -0
- package/dist/@types/@ecme/services/ApiServiceJ.d.ts +8 -0
- package/dist/@types/@ecme/services/ApiServiceJ.d.ts.map +1 -0
- package/dist/@types/base/@types/api/request/juridico/termos/termo.d.ts +54 -0
- package/dist/@types/base/@types/api/request/juridico/termos/termo.d.ts.map +1 -0
- package/dist/@types/base/@types/api/request/juridico/termos/types.d.ts +102 -0
- package/dist/@types/base/@types/api/request/juridico/termos/types.d.ts.map +1 -0
- package/dist/@types/base/configs/endpoints.config/HubFiscal/nfe.endpoint.config.d.ts +1 -0
- package/dist/@types/base/configs/endpoints.config/HubFiscal/nfe.endpoint.config.d.ts.map +1 -1
- package/dist/@types/base/services/modules/HubFiscal/NfeService.d.ts +1 -0
- package/dist/@types/base/services/modules/HubFiscal/NfeService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/juridico/JuridicoService.d.ts +4 -0
- package/dist/@types/base/services/modules/juridico/JuridicoService.d.ts.map +1 -0
- package/dist/@types/base/services/modules/juridico/docusignService.d.ts +32 -0
- package/dist/@types/base/services/modules/juridico/docusignService.d.ts.map +1 -0
- package/dist/@types/base/services/modules/juridico/municipiosService.d.ts +4 -0
- package/dist/@types/base/services/modules/juridico/municipiosService.d.ts.map +1 -0
- package/dist/@types/base/services/modules/juridico/termosService.d.ts +28 -0
- package/dist/@types/base/services/modules/juridico/termosService.d.ts.map +1 -0
- package/dist/base/@types/api/request/juridico/termos/termo.js +2 -0
- package/dist/base/@types/api/request/juridico/termos/termo.js.map +1 -0
- package/dist/base/@types/api/request/juridico/termos/types.js +48 -0
- package/dist/base/@types/api/request/juridico/termos/types.js.map +1 -0
- package/dist/base/configs/endpoints.config/HubFiscal/nfe.endpoint.config.js +2 -1
- package/dist/base/configs/endpoints.config/HubFiscal/nfe.endpoint.config.js.map +1 -1
- package/dist/base/services/modules/HubFiscal/NfeService.js +8 -0
- package/dist/base/services/modules/HubFiscal/NfeService.js.map +1 -1
- package/dist/base/services/modules/juridico/JuridicoService.js +48 -0
- package/dist/base/services/modules/juridico/JuridicoService.js.map +1 -0
- package/dist/base/services/modules/juridico/docusignService.js +112 -0
- package/dist/base/services/modules/juridico/docusignService.js.map +1 -0
- package/dist/base/services/modules/juridico/municipiosService.js +42 -0
- package/dist/base/services/modules/juridico/municipiosService.js.map +1 -0
- package/dist/base/services/modules/juridico/termosService.js +108 -0
- package/dist/base/services/modules/juridico/termosService.js.map +1 -0
- package/lib/@ecme/services/ApiServiceJ.ts +30 -0
- package/lib/base/@types/api/request/juridico/termos/termo.ts +53 -0
- package/lib/base/@types/api/request/juridico/termos/types.ts +112 -0
- package/lib/base/configs/endpoints.config/HubFiscal/nfe.endpoint.config.ts +2 -1
- package/lib/base/services/modules/HubFiscal/NfeService.ts +8 -0
- package/lib/base/services/modules/juridico/JuridicoService.ts +52 -0
- package/lib/base/services/modules/juridico/docusignService.ts +154 -0
- package/lib/base/services/modules/juridico/municipiosService.ts +46 -0
- package/lib/base/services/modules/juridico/termosService.ts +118 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ApiService from "../../../../@ecme/services/ApiService.js";
|
|
2
|
+
const municipiosService = {
|
|
3
|
+
getAll: async () => {
|
|
4
|
+
try {
|
|
5
|
+
console.log("Fazendo requisição para /dados-mestres/api/municipio/find");
|
|
6
|
+
const response = await ApiService.fetchDataWithAxios({
|
|
7
|
+
url: "/dados-mestres/api/municipio/find",
|
|
8
|
+
method: "POST",
|
|
9
|
+
data: {
|
|
10
|
+
id: null,
|
|
11
|
+
municipio: null,
|
|
12
|
+
codigo: null,
|
|
13
|
+
pageable: {
|
|
14
|
+
pageNumber: 1,
|
|
15
|
+
pageSize: 1e4,
|
|
16
|
+
sort: [{
|
|
17
|
+
sortField: "municipio",
|
|
18
|
+
sortOrder: "asc"
|
|
19
|
+
}]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
console.log("Resposta da API:", response);
|
|
24
|
+
const municipios = response.content || [];
|
|
25
|
+
return municipios.map((municipio) => ({
|
|
26
|
+
id: municipio.id,
|
|
27
|
+
nome: municipio.municipio,
|
|
28
|
+
uf: municipio.uf,
|
|
29
|
+
codigo: municipio.codigo,
|
|
30
|
+
ativo: true
|
|
31
|
+
// Assumindo que todos os retornados estão ativos
|
|
32
|
+
}));
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Error fetching municipalities:", error);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
municipiosService
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=municipiosService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"municipiosService.js","sources":["../../../../../lib/base/services/modules/juridico/municipiosService.ts"],"sourcesContent":["import ApiService from '@/services/ApiService'\nimport { TQueryResponse } from '@base/@types/api'\n\nexport const municipiosService = {\n getAll: async (): Promise<any[]> => {\n try {\n console.log('Fazendo requisição para /dados-mestres/api/municipio/find')\n \n // Usando o ApiService padrão do projeto que já inclui o X-Service-Token\n const response = await ApiService.fetchDataWithAxios<TQueryResponse<any>>({\n url: '/dados-mestres/api/municipio/find',\n method: 'POST',\n data: {\n id: null,\n municipio: null,\n codigo: null,\n pageable: {\n pageNumber: 1,\n pageSize: 10000,\n sort: [{\n sortField: 'municipio',\n sortOrder: 'asc'\n }]\n }\n }\n })\n \n console.log('Resposta da API:', response)\n \n // A resposta é paginada, então pegamos o conteúdo\n const municipios = response.content || []\n \n // Mapear para o formato esperado pelo frontend\n return municipios.map((municipio: any) => ({\n id: municipio.id,\n nome: municipio.municipio,\n uf: municipio.uf,\n codigo: municipio.codigo,\n ativo: true // Assumindo que todos os retornados estão ativos\n }))\n } catch (error) {\n console.error('Error fetching municipalities:', error)\n return []\n }\n }\n}"],"names":[],"mappings":";AAGO,MAAM,oBAAoB;AAAA,EAC7B,QAAQ,YAA4B;AAChC,QAAI;AACA,cAAQ,IAAI,2DAA2D;AAGvE,YAAM,WAAW,MAAM,WAAW,mBAAwC;AAAA,QACtE,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,UACF,IAAI;AAAA,UACJ,WAAW;AAAA,UACX,QAAQ;AAAA,UACR,UAAU;AAAA,YACN,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,MAAM,CAAC;AAAA,cACH,WAAW;AAAA,cACX,WAAW;AAAA,YAAA,CACd;AAAA,UAAA;AAAA,QACL;AAAA,MACJ,CACH;AAED,cAAQ,IAAI,oBAAoB,QAAQ;AAGxC,YAAM,aAAa,SAAS,WAAW,CAAA;AAGvC,aAAO,WAAW,IAAI,CAAC,eAAoB;AAAA,QACvC,IAAI,UAAU;AAAA,QACd,MAAM,UAAU;AAAA,QAChB,IAAI,UAAU;AAAA,QACd,QAAQ,UAAU;AAAA,QAClB,OAAO;AAAA;AAAA,MAAA,EACT;AAAA,IACN,SAAS,OAAO;AACZ,cAAQ,MAAM,kCAAkC,KAAK;AACrD,aAAO,CAAA;AAAA,IACX;AAAA,EACJ;AACJ;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import ApiServiceJ from "../../../../@ecme/services/ApiServiceJ.js";
|
|
2
|
+
const BASE_URL = "/juridico/api/juridico/termos";
|
|
3
|
+
const termosService = {
|
|
4
|
+
create: async (termo) => {
|
|
5
|
+
try {
|
|
6
|
+
console.log("Payload being sent:", termo);
|
|
7
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
8
|
+
url: BASE_URL,
|
|
9
|
+
method: "POST",
|
|
10
|
+
data: termo,
|
|
11
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
12
|
+
});
|
|
13
|
+
return response;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error("Detailed error:", error.response?.data);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
downloadPdf: async (id) => {
|
|
20
|
+
console.log("Chamando download com ID:", id);
|
|
21
|
+
try {
|
|
22
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
23
|
+
url: `${BASE_URL}/download/${id}`,
|
|
24
|
+
method: "GET",
|
|
25
|
+
responseType: "arraybuffer",
|
|
26
|
+
headers: {
|
|
27
|
+
"Accept": "application/pdf, application/json;q=0.9, */*;q=0.8"
|
|
28
|
+
},
|
|
29
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
30
|
+
});
|
|
31
|
+
console.log("Resposta recebida:", response);
|
|
32
|
+
return response;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Erro completo:", error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
downloadPdfDocuSign: async (id) => {
|
|
39
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
40
|
+
url: `${BASE_URL}/${id}/docusign/download`,
|
|
41
|
+
method: "GET",
|
|
42
|
+
responseType: "arraybuffer",
|
|
43
|
+
headers: {
|
|
44
|
+
"Accept": "application/pdf, application/json;q=0.9, */*;q=0.8"
|
|
45
|
+
},
|
|
46
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
47
|
+
});
|
|
48
|
+
return response;
|
|
49
|
+
},
|
|
50
|
+
aprovarRejeitar: async (data) => {
|
|
51
|
+
return ApiServiceJ.fetchDataWithAxios({
|
|
52
|
+
url: `${BASE_URL}/aprovar-rejeitar`,
|
|
53
|
+
method: "PUT",
|
|
54
|
+
data,
|
|
55
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
getById: async (id) => {
|
|
59
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
60
|
+
url: `${BASE_URL}/${id}`,
|
|
61
|
+
method: "GET",
|
|
62
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
63
|
+
});
|
|
64
|
+
return response;
|
|
65
|
+
},
|
|
66
|
+
getContratoDocusign: async (id) => {
|
|
67
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
68
|
+
url: `${BASE_URL}/${id}/contrato-docusign`,
|
|
69
|
+
method: "GET",
|
|
70
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
71
|
+
});
|
|
72
|
+
return response;
|
|
73
|
+
},
|
|
74
|
+
attachEnvelope: async (id, envelopeId) => {
|
|
75
|
+
await ApiServiceJ.fetchDataWithAxios({
|
|
76
|
+
url: `${BASE_URL}/${id}/docusign/envelope`,
|
|
77
|
+
method: "PUT",
|
|
78
|
+
data: { envelopeId },
|
|
79
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
enviarEnvelope: async (id) => {
|
|
83
|
+
await ApiServiceJ.fetchDataWithAxios({
|
|
84
|
+
url: `${BASE_URL}/${id}/docusign/enviar`,
|
|
85
|
+
method: "POST",
|
|
86
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
syncStatusDocuSign: async () => {
|
|
90
|
+
await ApiServiceJ.fetchDataWithAxios({
|
|
91
|
+
url: `${BASE_URL}/docusign/sync-status`,
|
|
92
|
+
method: "PUT",
|
|
93
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
getRecipientsStatus: async (id) => {
|
|
97
|
+
const response = await ApiServiceJ.fetchDataWithAxios({
|
|
98
|
+
url: `${BASE_URL}/${id}/docusign/recipients`,
|
|
99
|
+
method: "GET",
|
|
100
|
+
serviceKeyEnvName: "JURIDICO_API_KEY"
|
|
101
|
+
});
|
|
102
|
+
return response || [];
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
termosService
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=termosService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"termosService.js","sources":["../../../../../lib/base/services/modules/juridico/termosService.ts"],"sourcesContent":["import ApiServiceJ from '@/services/ApiServiceJ'\nimport { TTermo } from '@base/@types/api/request/juridico/termos/termo'\nimport { TTermoFormSchema } from '@base/@types/api/request/juridico/termos/types'\n\n\nconst BASE_URL = '/juridico/api/juridico/termos'\n\nexport const termosService = {\n create: async (termo: TTermoFormSchema): Promise<{ id: number }> => {\n try {\n console.log('Payload being sent:', termo)\n \n const response = await ApiServiceJ.fetchDataWithAxios<{ id: number }, TTermoFormSchema>({\n url: BASE_URL,\n method: 'POST',\n data: termo,\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n return response\n } catch (error: any) {\n console.error('Detailed error:', error.response?.data)\n throw error\n }\n },\n \n downloadPdf: async (id: number): Promise<ArrayBuffer> => {\n console.log('Chamando download com ID:', id)\n try {\n const response = await ApiServiceJ.fetchDataWithAxios<ArrayBuffer>({\n url: `${BASE_URL}/download/${id}`,\n method: 'GET',\n responseType: 'arraybuffer',\n headers: {\n 'Accept': 'application/pdf, application/json;q=0.9, */*;q=0.8'\n },\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n console.log('Resposta recebida:', response)\n return response\n } catch (error: any) {\n console.error('Erro completo:', error)\n throw error\n }\n },\n downloadPdfDocuSign: async (id: number): Promise<ArrayBuffer> => {\n const response = await ApiServiceJ.fetchDataWithAxios<ArrayBuffer>({\n url: `${BASE_URL}/${id}/docusign/download`,\n method: 'GET',\n responseType: 'arraybuffer',\n headers: {\n 'Accept': 'application/pdf, application/json;q=0.9, */*;q=0.8'\n },\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n return response\n },\n aprovarRejeitar: async (data: {\n termoId: number;\n status: 'APROVADO' | 'REJEITADO';\n justificativaRejeicao?: string;\n }) => {\n return ApiServiceJ.fetchDataWithAxios({\n url: `${BASE_URL}/aprovar-rejeitar`,\n method: 'PUT',\n data,\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n },\n\n getById: async (id: number): Promise<TTermo> => {\n const response = await ApiServiceJ.fetchDataWithAxios<TTermo>({\n url: `${BASE_URL}/${id}`,\n method: 'GET',\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n return response\n },\n\n getContratoDocusign: async (id: number): Promise<{ envelopeId: string; contratoId: number }> => {\n const response = await ApiServiceJ.fetchDataWithAxios<{ envelopeId: string; contratoId: number }>({\n url: `${BASE_URL}/${id}/contrato-docusign`,\n method: 'GET',\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n return response\n },\n\n attachEnvelope: async (id: number, envelopeId: string): Promise<void> => {\n await ApiServiceJ.fetchDataWithAxios<void, { envelopeId: string }>({\n url: `${BASE_URL}/${id}/docusign/envelope`,\n method: 'PUT',\n data: { envelopeId },\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n },\n enviarEnvelope: async (id: number): Promise<void> => {\n await ApiServiceJ.fetchDataWithAxios<void>({\n url: `${BASE_URL}/${id}/docusign/enviar`,\n method: 'POST',\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n },\n syncStatusDocuSign: async (): Promise<void> => {\n await ApiServiceJ.fetchDataWithAxios<void>({\n url: `${BASE_URL}/docusign/sync-status`,\n method: 'PUT',\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n },\n getRecipientsStatus: async (id: number): Promise<Array<{ name: string; email: string; status?: string }>> => {\n const response = await ApiServiceJ.fetchDataWithAxios<Array<{ name: string; email: string; status?: string }>>({\n url: `${BASE_URL}/${id}/docusign/recipients`,\n method: 'GET',\n serviceKeyEnvName: 'JURIDICO_API_KEY',\n })\n return response || []\n },\n}"],"names":[],"mappings":";AAKA,MAAM,WAAW;AAEV,MAAM,gBAAgB;AAAA,EACzB,QAAQ,OAAO,UAAqD;AAChE,QAAI;AACA,cAAQ,IAAI,uBAAuB,KAAK;AAExC,YAAM,WAAW,MAAM,YAAY,mBAAqD;AAAA,QACpF,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA,CACtB;AACD,aAAO;AAAA,IACX,SAAS,OAAY;AACjB,cAAQ,MAAM,mBAAmB,MAAM,UAAU,IAAI;AACrD,YAAM;AAAA,IACV;AAAA,EACJ;AAAA,EAEA,aAAa,OAAO,OAAqC;AACrD,YAAQ,IAAI,6BAA6B,EAAE;AAC3C,QAAI;AACA,YAAM,WAAW,MAAM,YAAY,mBAAgC;AAAA,QAC/D,KAAK,GAAG,QAAQ,aAAa,EAAE;AAAA,QAC/B,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,SAAS;AAAA,UACL,UAAU;AAAA,QAAA;AAAA,QAEd,mBAAmB;AAAA,MAAA,CACtB;AACD,cAAQ,IAAI,sBAAsB,QAAQ;AAC1C,aAAO;AAAA,IACX,SAAS,OAAY;AACjB,cAAQ,MAAM,kBAAkB,KAAK;AACrC,YAAM;AAAA,IACV;AAAA,EACJ;AAAA,EACA,qBAAqB,OAAO,OAAqC;AAC7D,UAAM,WAAW,MAAM,YAAY,mBAAgC;AAAA,MAC/D,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,SAAS;AAAA,QACL,UAAU;AAAA,MAAA;AAAA,MAEd,mBAAmB;AAAA,IAAA,CACtB;AACD,WAAO;AAAA,EACX;AAAA,EACA,iBAAiB,OAAO,SAIlB;AACF,WAAO,YAAY,mBAAmB;AAAA,MAClC,KAAK,GAAG,QAAQ;AAAA,MAChB,QAAQ;AAAA,MACR;AAAA,MACA,mBAAmB;AAAA,IAAA,CACtB;AAAA,EACL;AAAA,EAEA,SAAS,OAAO,OAAgC;AAC5C,UAAM,WAAW,MAAM,YAAY,mBAA2B;AAAA,MAC1D,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AACD,WAAO;AAAA,EACX;AAAA,EAEA,qBAAqB,OAAO,OAAoE;AAC5F,UAAM,WAAW,MAAM,YAAY,mBAA+D;AAAA,MAC9F,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AACD,WAAO;AAAA,EACX;AAAA,EAEA,gBAAgB,OAAO,IAAY,eAAsC;AACrE,UAAM,YAAY,mBAAiD;AAAA,MAC/D,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,MAAM,EAAE,WAAA;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AAAA,EACL;AAAA,EACA,gBAAgB,OAAO,OAA8B;AACjD,UAAM,YAAY,mBAAyB;AAAA,MACvC,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AAAA,EACL;AAAA,EACA,oBAAoB,YAA2B;AAC3C,UAAM,YAAY,mBAAyB;AAAA,MACvC,KAAK,GAAG,QAAQ;AAAA,MAChB,QAAQ;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AAAA,EACL;AAAA,EACA,qBAAqB,OAAO,OAAiF;AACzG,UAAM,WAAW,MAAM,YAAY,mBAA4E;AAAA,MAC3G,KAAK,GAAG,QAAQ,IAAI,EAAE;AAAA,MACtB,QAAQ;AAAA,MACR,mBAAmB;AAAA,IAAA,CACtB;AACD,WAAO,YAAY,CAAA;AAAA,EACvB;AACJ;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ApiService from './ApiService'
|
|
2
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
3
|
+
|
|
4
|
+
const ApiServiceJ = {
|
|
5
|
+
fetchDataWithAxios<Response = unknown, Request = Record<string, unknown>>(
|
|
6
|
+
param: AxiosRequestConfig<Request> & { serviceKeyEnvName?: 'JURIDICO_API_KEY' | 'DOCUSIGN_API_KEY' },
|
|
7
|
+
) {
|
|
8
|
+
const { serviceKeyEnvName, headers: originalHeaders, ...rest } = param
|
|
9
|
+
|
|
10
|
+
const headers = { ...(originalHeaders || {}) }
|
|
11
|
+
|
|
12
|
+
if (serviceKeyEnvName) {
|
|
13
|
+
const rawSecret = (import.meta.env as any)[serviceKeyEnvName] ?? ''
|
|
14
|
+
|
|
15
|
+
if (rawSecret) {
|
|
16
|
+
headers['X-API-KEY'] = window.btoa(String(rawSecret))
|
|
17
|
+
} else {
|
|
18
|
+
console.warn(
|
|
19
|
+
`[ApiService] Variável de ambiente '${serviceKeyEnvName}' não encontrada em import.meta.env.`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return ApiService.fetchDataWithAxios<Response, Request>({
|
|
25
|
+
...rest,
|
|
26
|
+
headers,
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
export default ApiServiceJ
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type TTermo = {
|
|
2
|
+
id: number
|
|
3
|
+
ativo: boolean
|
|
4
|
+
tipoContrato: string
|
|
5
|
+
dataCadastro: string
|
|
6
|
+
usuarioCadastro: string
|
|
7
|
+
fornecedor: {
|
|
8
|
+
id: number
|
|
9
|
+
nome: string
|
|
10
|
+
cpfCnpj: string
|
|
11
|
+
endereco: {
|
|
12
|
+
ativo: boolean
|
|
13
|
+
bairro: string
|
|
14
|
+
rua: string
|
|
15
|
+
numero: string
|
|
16
|
+
cep: string
|
|
17
|
+
municipio: {
|
|
18
|
+
id: number
|
|
19
|
+
nome: string
|
|
20
|
+
uf: string
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
representante: {
|
|
25
|
+
ativo: boolean
|
|
26
|
+
nome: string
|
|
27
|
+
cpf: string
|
|
28
|
+
email: string
|
|
29
|
+
tipo: string
|
|
30
|
+
}
|
|
31
|
+
testemunhaCereal: {
|
|
32
|
+
ativo: boolean
|
|
33
|
+
nome: string
|
|
34
|
+
cpf: string
|
|
35
|
+
email: string
|
|
36
|
+
tipo: string
|
|
37
|
+
}
|
|
38
|
+
testemunhaFornecedor: {
|
|
39
|
+
ativo: boolean
|
|
40
|
+
nome: string
|
|
41
|
+
cpf: string
|
|
42
|
+
email: string
|
|
43
|
+
tipo: string
|
|
44
|
+
}
|
|
45
|
+
numeroTermo: string
|
|
46
|
+
dataTermo: string
|
|
47
|
+
arquivoPdf: string
|
|
48
|
+
envelopeId?: string
|
|
49
|
+
statusDocuSign?: string
|
|
50
|
+
dataUltimaSincronizacaoDocuSign?: string
|
|
51
|
+
status?: 'PENDENTE' | 'APROVADO' | 'REJEITADO'
|
|
52
|
+
justificativaRejeicao: string | null
|
|
53
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { TRoles } from '@base/@types/models/adm/user'
|
|
2
|
+
|
|
3
|
+
//TODO arrumar os anys
|
|
4
|
+
export type TGeneralFormFields = {
|
|
5
|
+
username: string
|
|
6
|
+
name: string
|
|
7
|
+
email: string
|
|
8
|
+
telefone?: string
|
|
9
|
+
celular?: string
|
|
10
|
+
empresa?: any
|
|
11
|
+
departamento?: any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type TRolesFormFields = {
|
|
15
|
+
roles?: TRoles[] | undefined
|
|
16
|
+
ativo?: boolean
|
|
17
|
+
primeiroLogin?: boolean
|
|
18
|
+
selecionaDeposito?: boolean
|
|
19
|
+
selecionaCentro?: boolean
|
|
20
|
+
pesagemManual?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum TipoContrato {
|
|
24
|
+
PRE_CONTRATUAL = 'PRE_CONTRATUAL',
|
|
25
|
+
CONTRATUAL = 'CONTRATUAL',
|
|
26
|
+
CADASTRO = 'CADASTRO'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum TipoAssinante {
|
|
30
|
+
REPRESENTANTE = 'REPRESENTANTE',
|
|
31
|
+
TESTEMUNHA_CEREAL = 'TESTEMUNHA_CEREAL',
|
|
32
|
+
TESTEMUNHA_FORNECEDOR = 'TESTEMUNHA_FORNECEDOR'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum UF {
|
|
36
|
+
AC = 'AC',
|
|
37
|
+
AL = 'AL',
|
|
38
|
+
AP = 'AP',
|
|
39
|
+
AM = 'AM',
|
|
40
|
+
BA = 'BA',
|
|
41
|
+
CE = 'CE',
|
|
42
|
+
DF = 'DF',
|
|
43
|
+
ES = 'ES',
|
|
44
|
+
GO = 'GO',
|
|
45
|
+
MA = 'MA',
|
|
46
|
+
MT = 'MT',
|
|
47
|
+
MS = 'MS',
|
|
48
|
+
MG = 'MG',
|
|
49
|
+
PA = 'PA',
|
|
50
|
+
PB = 'PB',
|
|
51
|
+
PR = 'PR',
|
|
52
|
+
PE = 'PE',
|
|
53
|
+
PI = 'PI',
|
|
54
|
+
RJ = 'RJ',
|
|
55
|
+
RN = 'RN',
|
|
56
|
+
RS = 'RS',
|
|
57
|
+
RO = 'RO',
|
|
58
|
+
RR = 'RR',
|
|
59
|
+
SC = 'SC',
|
|
60
|
+
SP = 'SP',
|
|
61
|
+
SE = 'SE',
|
|
62
|
+
TO = 'TO'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface TMunicipio {
|
|
66
|
+
id: number
|
|
67
|
+
nome: string
|
|
68
|
+
uf: UF
|
|
69
|
+
ativo?: boolean
|
|
70
|
+
codigo?: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type TEnderecoFornecedor = {
|
|
74
|
+
id?: number
|
|
75
|
+
ativo: boolean
|
|
76
|
+
bairro: string
|
|
77
|
+
rua: string
|
|
78
|
+
numero: string
|
|
79
|
+
cep: string
|
|
80
|
+
municipioId: number
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type TFornecedor = {
|
|
84
|
+
id?: number
|
|
85
|
+
nome: string
|
|
86
|
+
cpfCnpj: string
|
|
87
|
+
ativo: boolean
|
|
88
|
+
endereco: TEnderecoFornecedor
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type TAssinante = {
|
|
92
|
+
id?: number
|
|
93
|
+
nome: string
|
|
94
|
+
cpf: string
|
|
95
|
+
email: string
|
|
96
|
+
ativo: boolean
|
|
97
|
+
tipo: TipoAssinante
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type TTermoFormSchema = {
|
|
101
|
+
id?: number
|
|
102
|
+
ativo: boolean
|
|
103
|
+
tipoContrato: TipoContrato
|
|
104
|
+
dataCadastro: Date
|
|
105
|
+
usuarioCadastro: string
|
|
106
|
+
fornecedor: TFornecedor
|
|
107
|
+
representante: TAssinante
|
|
108
|
+
numeroTermo: string
|
|
109
|
+
testemunhaCereal: TAssinante
|
|
110
|
+
dataTermo: Date
|
|
111
|
+
testemunhaFornecedor: TAssinante
|
|
112
|
+
}
|
|
@@ -14,4 +14,12 @@ export async function apiGetPdf(id) {
|
|
|
14
14
|
url: nfeEndpointConfig.getPdf + id,
|
|
15
15
|
method: 'get',
|
|
16
16
|
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function apiAddObservacao(body) {
|
|
20
|
+
return ApiService.fetchDataWithAxios({
|
|
21
|
+
url: nfeEndpointConfig.addObservacao,
|
|
22
|
+
method: 'post',
|
|
23
|
+
data: body,
|
|
24
|
+
})
|
|
17
25
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IFilterParams, TQueryResponse } from '@base/@types/api'
|
|
2
|
+
import ApiServiceJ from '@/services/ApiServiceJ'
|
|
3
|
+
import { TTermo } from '@base/@types/api/request/juridico/termos/termo'
|
|
4
|
+
|
|
5
|
+
export async function apiGetTermos(body?: IFilterParams) {
|
|
6
|
+
const response = await ApiServiceJ.fetchDataWithAxios<TTermo[]>({
|
|
7
|
+
url: '/juridico/api/juridico/termos/listar',
|
|
8
|
+
method: 'get',
|
|
9
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
// Aplicar filtros no frontend (já que o backend não suporta filtros)
|
|
13
|
+
let filteredResponse = response || []
|
|
14
|
+
|
|
15
|
+
if (body) {
|
|
16
|
+
if (body.id) {
|
|
17
|
+
filteredResponse = filteredResponse.filter((termo: TTermo) =>
|
|
18
|
+
termo.id?.toString().includes(body.id as string)
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
if (body.fornecedor) {
|
|
22
|
+
const searchTerm = (body.fornecedor as string).toLowerCase()
|
|
23
|
+
filteredResponse = filteredResponse.filter((termo: TTermo) =>
|
|
24
|
+
termo.fornecedor?.nome?.toLowerCase().includes(searchTerm)
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
if (body.usuarioCadastro) {
|
|
28
|
+
const searchTerm = (body.usuarioCadastro as string).toLowerCase()
|
|
29
|
+
filteredResponse = filteredResponse.filter((termo: TTermo) =>
|
|
30
|
+
termo.usuarioCadastro?.toLowerCase().includes(searchTerm)
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
if (body.dataCadastro) {
|
|
34
|
+
const searchDate = body.dataCadastro as string
|
|
35
|
+
filteredResponse = filteredResponse.filter((termo: TTermo) => {
|
|
36
|
+
if (!termo.dataCadastro) return false
|
|
37
|
+
const termoDate = new Date(termo.dataCadastro).toISOString().split('T')[0]
|
|
38
|
+
return termoDate === searchDate
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const paginatedResponse = {
|
|
44
|
+
content: filteredResponse,
|
|
45
|
+
size: filteredResponse.length,
|
|
46
|
+
totalElements: filteredResponse.length,
|
|
47
|
+
totalPages: 1,
|
|
48
|
+
number: 0
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return paginatedResponse as TQueryResponse<TTermo>
|
|
52
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import ApiServiceJ from '@/services/ApiServiceJ'
|
|
2
|
+
|
|
3
|
+
export type TSignerUpdate = {
|
|
4
|
+
email: string
|
|
5
|
+
recipientId: string
|
|
6
|
+
name?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type TSendEnvelopeRequest = {
|
|
10
|
+
subject: string
|
|
11
|
+
signers: { email: string; name: string }[]
|
|
12
|
+
documentBase64: string
|
|
13
|
+
documentId?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TEnvelopeOutput = {
|
|
17
|
+
envelopeId: string
|
|
18
|
+
status?: string
|
|
19
|
+
updatedDateTime?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const docusignService = {
|
|
23
|
+
sendEnvelope: async (payload: TSendEnvelopeRequest): Promise<TEnvelopeOutput> => {
|
|
24
|
+
const request = {
|
|
25
|
+
brandId: '',
|
|
26
|
+
emailSubject: payload.subject,
|
|
27
|
+
status: 'sent',
|
|
28
|
+
createdDateTime: new Date().toISOString(),
|
|
29
|
+
completedDateTime: null,
|
|
30
|
+
deletedDateTime: null,
|
|
31
|
+
deliveredDateTime: null,
|
|
32
|
+
sentDateTime: null,
|
|
33
|
+
documents: [
|
|
34
|
+
{
|
|
35
|
+
documentId: payload.documentId,
|
|
36
|
+
name: 'Termo',
|
|
37
|
+
fileExtension: 'pdf',
|
|
38
|
+
documentBase64: payload.documentBase64,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
recipients: {
|
|
42
|
+
signers: payload.signers.map((s, idx) => ({
|
|
43
|
+
emailBody: '',
|
|
44
|
+
emailSubject: payload.subject,
|
|
45
|
+
email: s.email,
|
|
46
|
+
name: s.name,
|
|
47
|
+
recipientId: String(idx + 1),
|
|
48
|
+
routingOrder: String(idx + 1),
|
|
49
|
+
signHereTabs: [],
|
|
50
|
+
})),
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log('[DocuSign] POST /send-envelopeId — request:', request)
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{
|
|
58
|
+
status?: string
|
|
59
|
+
envelopeId: string
|
|
60
|
+
}, typeof request>({
|
|
61
|
+
url: '/docusign/api/docusign/send-envelopeId',
|
|
62
|
+
method: 'POST',
|
|
63
|
+
data: request,
|
|
64
|
+
headers: { 'Content-Type': 'application/json' },
|
|
65
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
console.log('[DocuSign] POST /send-envelopeId — response:', response)
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
envelopeId: response.envelopeId,
|
|
72
|
+
status: response.status,
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error('[DocuSign] POST /send-envelopeId — error:', err)
|
|
76
|
+
throw err
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
listEnvelopes: async (date: string, status: string): Promise<TEnvelopeOutput[]> => {
|
|
81
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{
|
|
82
|
+
resultSetSize: string
|
|
83
|
+
totalSetSize: string
|
|
84
|
+
envelopes: Array<{
|
|
85
|
+
createdDateTime: string
|
|
86
|
+
statusChangedDateTime?: string
|
|
87
|
+
envelopeId: string
|
|
88
|
+
status: string
|
|
89
|
+
}>
|
|
90
|
+
}, Record<string, unknown>>({
|
|
91
|
+
url: `/docusign/api/docusign/list-status-envelopeId/${date}`,
|
|
92
|
+
method: 'GET',
|
|
93
|
+
params: { status },
|
|
94
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
return (response.envelopes || []).map((e) => ({
|
|
98
|
+
envelopeId: e.envelopeId,
|
|
99
|
+
status: e.status,
|
|
100
|
+
updatedDateTime: e.statusChangedDateTime ?? e.createdDateTime,
|
|
101
|
+
}))
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
listRecipients: async (envelopeId: string) => {
|
|
105
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{
|
|
106
|
+
signers: Array<{ name: string; email: string; status?: string }>
|
|
107
|
+
}, Record<string, unknown>>({
|
|
108
|
+
url: `/docusign/api/docusign/list-status-recipients/${envelopeId}`,
|
|
109
|
+
method: 'GET',
|
|
110
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
return response.signers || []
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
voidEnvelope: async (envelopeId: string, reason: string) => {
|
|
117
|
+
await ApiServiceJ.fetchDataWithAxios<void, Record<string, unknown>>({
|
|
118
|
+
url: `/docusign/api/docusign/voided-envelope/${envelopeId}`,
|
|
119
|
+
method: 'PUT',
|
|
120
|
+
params: { voidedReason: reason },
|
|
121
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
updateRecipients: async (envelopeId: string, signers: TSignerUpdate[]) => {
|
|
126
|
+
const request = {
|
|
127
|
+
signers: signers.map((s) => ({
|
|
128
|
+
email: s.email,
|
|
129
|
+
recipientId: s.recipientId,
|
|
130
|
+
})),
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
await ApiServiceJ.fetchDataWithAxios<void, typeof request>({
|
|
134
|
+
url: `/docusign/api/docusign/update-email/${envelopeId}`,
|
|
135
|
+
method: 'PUT',
|
|
136
|
+
data: request,
|
|
137
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
downloadSignedPdf: async (envelopeId: string, documentId: string): Promise<ArrayBuffer> => {
|
|
142
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{ pdfBase64: string }>({
|
|
143
|
+
url: `/docusign/api/docusign/download-pdf/${envelopeId}/${documentId}`,
|
|
144
|
+
method: 'GET',
|
|
145
|
+
serviceKeyEnvName: 'DOCUSIGN_API_KEY',
|
|
146
|
+
})
|
|
147
|
+
const b64 = response?.pdfBase64 || ''
|
|
148
|
+
const binary = atob(b64)
|
|
149
|
+
const len = binary.length
|
|
150
|
+
const bytes = new Uint8Array(len)
|
|
151
|
+
for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i)
|
|
152
|
+
return bytes.buffer
|
|
153
|
+
},
|
|
154
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ApiService from '@/services/ApiService'
|
|
2
|
+
import { TQueryResponse } from '@base/@types/api'
|
|
3
|
+
|
|
4
|
+
export const municipiosService = {
|
|
5
|
+
getAll: async (): Promise<any[]> => {
|
|
6
|
+
try {
|
|
7
|
+
console.log('Fazendo requisição para /dados-mestres/api/municipio/find')
|
|
8
|
+
|
|
9
|
+
// Usando o ApiService padrão do projeto que já inclui o X-Service-Token
|
|
10
|
+
const response = await ApiService.fetchDataWithAxios<TQueryResponse<any>>({
|
|
11
|
+
url: '/dados-mestres/api/municipio/find',
|
|
12
|
+
method: 'POST',
|
|
13
|
+
data: {
|
|
14
|
+
id: null,
|
|
15
|
+
municipio: null,
|
|
16
|
+
codigo: null,
|
|
17
|
+
pageable: {
|
|
18
|
+
pageNumber: 1,
|
|
19
|
+
pageSize: 10000,
|
|
20
|
+
sort: [{
|
|
21
|
+
sortField: 'municipio',
|
|
22
|
+
sortOrder: 'asc'
|
|
23
|
+
}]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
console.log('Resposta da API:', response)
|
|
29
|
+
|
|
30
|
+
// A resposta é paginada, então pegamos o conteúdo
|
|
31
|
+
const municipios = response.content || []
|
|
32
|
+
|
|
33
|
+
// Mapear para o formato esperado pelo frontend
|
|
34
|
+
return municipios.map((municipio: any) => ({
|
|
35
|
+
id: municipio.id,
|
|
36
|
+
nome: municipio.municipio,
|
|
37
|
+
uf: municipio.uf,
|
|
38
|
+
codigo: municipio.codigo,
|
|
39
|
+
ativo: true // Assumindo que todos os retornados estão ativos
|
|
40
|
+
}))
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('Error fetching municipalities:', error)
|
|
43
|
+
return []
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|