@orbe-agro/client-core 5.6.135 → 5.6.137
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/centralNfe/centralNfe.d.ts +14 -0
- package/dist/@types/base/configs/endpoints.config/centralNfe/centralNfe.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/centralNfe/config/recepcaoFisica.d.ts +16 -0
- package/dist/@types/base/configs/endpoints.config/centralNfe/config/recepcaoFisica.d.ts.map +1 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +14 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.d.ts.map +1 -1
- package/dist/@types/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.d.ts +4 -0
- package/dist/@types/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.d.ts.map +1 -0
- package/dist/@types/base/services/modules/centralNfe/index.d.ts +1 -0
- package/dist/@types/base/services/modules/centralNfe/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/centralNfe/recepcaoFisica/RecepcaoFisicaService.d.ts +7 -0
- package/dist/@types/base/services/modules/centralNfe/recepcaoFisica/RecepcaoFisicaService.d.ts.map +1 -0
- 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/centralNfe/centralNfe.js +3 -1
- package/dist/base/configs/endpoints.config/centralNfe/centralNfe.js.map +1 -1
- package/dist/base/configs/endpoints.config/centralNfe/config/recepcaoFisica.js +10 -0
- package/dist/base/configs/endpoints.config/centralNfe/config/recepcaoFisica.js.map +1 -0
- package/dist/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.js +2 -0
- package/dist/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.js.map +1 -1
- package/dist/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.js +16 -0
- package/dist/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.js.map +1 -0
- package/dist/base/services/modules/centralNfe/index.js +4 -0
- package/dist/base/services/modules/centralNfe/index.js.map +1 -1
- package/dist/base/services/modules/centralNfe/recepcaoFisica/RecepcaoFisicaService.js +31 -0
- package/dist/base/services/modules/centralNfe/recepcaoFisica/RecepcaoFisicaService.js.map +1 -0
- 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/centralNfe/centralNfe.ts +3 -1
- package/lib/base/configs/endpoints.config/centralNfe/config/recepcaoFisica.ts +9 -0
- package/lib/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.ts +2 -0
- package/lib/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.ts +16 -0
- package/lib/base/services/modules/centralNfe/index.ts +2 -1
- package/lib/base/services/modules/centralNfe/recepcaoFisica/RecepcaoFisicaService.ts +32 -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
|
@@ -3,6 +3,7 @@ import { ADMIN } from '@/constants/roles.constant'
|
|
|
3
3
|
import { NavigationTree } from '@/@types/navigation'
|
|
4
4
|
import cadastrosSubmenu from '../../submenu/centralNfe/cadastros.submenu'
|
|
5
5
|
import nfeSubmenu from '../../submenu/centralNfe/config/nfe.submenu'
|
|
6
|
+
import recepcaoFisicaSubmenu from '../../submenu/centralNfe/config/recepcaoFisica.submenu'
|
|
6
7
|
|
|
7
8
|
const subMenuCentralNfe: NavigationTree =
|
|
8
9
|
{
|
|
@@ -15,6 +16,7 @@ const subMenuCentralNfe: NavigationTree =
|
|
|
15
16
|
authority: [ADMIN],
|
|
16
17
|
subMenu: [
|
|
17
18
|
nfeSubmenu,
|
|
19
|
+
recepcaoFisicaSubmenu,
|
|
18
20
|
{
|
|
19
21
|
key: 'modules.centralNfe.cadastros',
|
|
20
22
|
path: '',
|
package/lib/base/configs/navigation.config/submenu/centralNfe/config/recepcaoFisica.submenu.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NAV_ITEM_TYPE_ITEM } from '@/constants/navigation.constant'
|
|
2
|
+
import { ADMIN } from '@/constants/roles.constant'
|
|
3
|
+
import { NavigationTree } from '@/@types/navigation'
|
|
4
|
+
|
|
5
|
+
const recepcaoFisicaSubmenu: NavigationTree = {
|
|
6
|
+
key: 'centralNfe.recepcaoFisica.table',
|
|
7
|
+
path: '/central-nfe/recepcao-fisica',
|
|
8
|
+
title: 'Monitor - Recepção Física',
|
|
9
|
+
translateKey: 'nav.modules.centralNfe.recepcaoFisica',
|
|
10
|
+
icon: 'recepcaoFisica',
|
|
11
|
+
type: NAV_ITEM_TYPE_ITEM,
|
|
12
|
+
authority: [ADMIN],
|
|
13
|
+
subMenu: [],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default recepcaoFisicaSubmenu
|
|
@@ -3,4 +3,5 @@ export * from './intervaloPrecoXml/IntervaloPrecoXmlService'
|
|
|
3
3
|
export * from './vinculoUnidadeMedida/VinculoUnidadeMedidaService'
|
|
4
4
|
export * from './cnpjLiberadoNota/CnpjLiberadoNotaService'
|
|
5
5
|
export * from './cnpjExcecaoNota/CnpjExcecaoNotaService'
|
|
6
|
-
export * from './nfe/NfeService'
|
|
6
|
+
export * from './nfe/NfeService'
|
|
7
|
+
export * from './recepcaoFisica/RecepcaoFisicaService'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ApiService from "@/services/ApiService";
|
|
2
|
+
import endpointConfig from "@base/configs/endpoints.config/endpoints.navigation";
|
|
3
|
+
|
|
4
|
+
const RECEPCAO_FISICA_ENDPOINT = endpointConfig.centralNfe.recepcaoFisica;
|
|
5
|
+
|
|
6
|
+
export async function apiCreateRecepcaoFisica(
|
|
7
|
+
body: { chaveAcesso: string; ordensCompraPrevisao: string[] },
|
|
8
|
+
userId: number,
|
|
9
|
+
) {
|
|
10
|
+
return ApiService.fetchDataWithAxios<void>({
|
|
11
|
+
url: RECEPCAO_FISICA_ENDPOINT.create.endpoint,
|
|
12
|
+
method: RECEPCAO_FISICA_ENDPOINT.create.httpMethod,
|
|
13
|
+
data: body,
|
|
14
|
+
headers: { 'X-User-Id': userId },
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function apiFindMonitorRecepcaoFisica(body: any) {
|
|
19
|
+
return ApiService.fetchDataWithAxios<any>({
|
|
20
|
+
url: RECEPCAO_FISICA_ENDPOINT.findMonitor.endpoint,
|
|
21
|
+
method: RECEPCAO_FISICA_ENDPOINT.findMonitor.httpMethod,
|
|
22
|
+
data: body,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function apiFindOrdensCompraRecepcaoFisica(cnpj: string) {
|
|
27
|
+
return ApiService.fetchDataWithAxios<any[]>({
|
|
28
|
+
url: RECEPCAO_FISICA_ENDPOINT.findOrdensCompra.endpoint,
|
|
29
|
+
method: RECEPCAO_FISICA_ENDPOINT.findOrdensCompra.httpMethod,
|
|
30
|
+
params: { cnpj },
|
|
31
|
+
})
|
|
32
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import ApiServiceJ from '@/services/ApiServiceJ'
|
|
2
|
+
import { TTermo } from '@base/@types/api/request/juridico/termos/termo'
|
|
3
|
+
import { TTermoFormSchema } from '@base/@types/api/request/juridico/termos/types'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const BASE_URL = '/juridico/api/juridico/termos'
|
|
7
|
+
|
|
8
|
+
export const termosService = {
|
|
9
|
+
create: async (termo: TTermoFormSchema): Promise<{ id: number }> => {
|
|
10
|
+
try {
|
|
11
|
+
console.log('Payload being sent:', termo)
|
|
12
|
+
|
|
13
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{ id: number }, TTermoFormSchema>({
|
|
14
|
+
url: BASE_URL,
|
|
15
|
+
method: 'POST',
|
|
16
|
+
data: termo,
|
|
17
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
18
|
+
})
|
|
19
|
+
return response
|
|
20
|
+
} catch (error: any) {
|
|
21
|
+
console.error('Detailed error:', error.response?.data)
|
|
22
|
+
throw error
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
downloadPdf: async (id: number): Promise<ArrayBuffer> => {
|
|
27
|
+
console.log('Chamando download com ID:', id)
|
|
28
|
+
try {
|
|
29
|
+
const response = await ApiServiceJ.fetchDataWithAxios<ArrayBuffer>({
|
|
30
|
+
url: `${BASE_URL}/download/${id}`,
|
|
31
|
+
method: 'GET',
|
|
32
|
+
responseType: 'arraybuffer',
|
|
33
|
+
headers: {
|
|
34
|
+
'Accept': 'application/pdf, application/json;q=0.9, */*;q=0.8'
|
|
35
|
+
},
|
|
36
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
37
|
+
})
|
|
38
|
+
console.log('Resposta recebida:', response)
|
|
39
|
+
return response
|
|
40
|
+
} catch (error: any) {
|
|
41
|
+
console.error('Erro completo:', error)
|
|
42
|
+
throw error
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
downloadPdfDocuSign: async (id: number): Promise<ArrayBuffer> => {
|
|
46
|
+
const response = await ApiServiceJ.fetchDataWithAxios<ArrayBuffer>({
|
|
47
|
+
url: `${BASE_URL}/${id}/docusign/download`,
|
|
48
|
+
method: 'GET',
|
|
49
|
+
responseType: 'arraybuffer',
|
|
50
|
+
headers: {
|
|
51
|
+
'Accept': 'application/pdf, application/json;q=0.9, */*;q=0.8'
|
|
52
|
+
},
|
|
53
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
54
|
+
})
|
|
55
|
+
return response
|
|
56
|
+
},
|
|
57
|
+
aprovarRejeitar: async (data: {
|
|
58
|
+
termoId: number;
|
|
59
|
+
status: 'APROVADO' | 'REJEITADO';
|
|
60
|
+
justificativaRejeicao?: string;
|
|
61
|
+
}) => {
|
|
62
|
+
return ApiServiceJ.fetchDataWithAxios({
|
|
63
|
+
url: `${BASE_URL}/aprovar-rejeitar`,
|
|
64
|
+
method: 'PUT',
|
|
65
|
+
data,
|
|
66
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
getById: async (id: number): Promise<TTermo> => {
|
|
71
|
+
const response = await ApiServiceJ.fetchDataWithAxios<TTermo>({
|
|
72
|
+
url: `${BASE_URL}/${id}`,
|
|
73
|
+
method: 'GET',
|
|
74
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
75
|
+
})
|
|
76
|
+
return response
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
getContratoDocusign: async (id: number): Promise<{ envelopeId: string; contratoId: number }> => {
|
|
80
|
+
const response = await ApiServiceJ.fetchDataWithAxios<{ envelopeId: string; contratoId: number }>({
|
|
81
|
+
url: `${BASE_URL}/${id}/contrato-docusign`,
|
|
82
|
+
method: 'GET',
|
|
83
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
84
|
+
})
|
|
85
|
+
return response
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
attachEnvelope: async (id: number, envelopeId: string): Promise<void> => {
|
|
89
|
+
await ApiServiceJ.fetchDataWithAxios<void, { envelopeId: string }>({
|
|
90
|
+
url: `${BASE_URL}/${id}/docusign/envelope`,
|
|
91
|
+
method: 'PUT',
|
|
92
|
+
data: { envelopeId },
|
|
93
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
94
|
+
})
|
|
95
|
+
},
|
|
96
|
+
enviarEnvelope: async (id: number): Promise<void> => {
|
|
97
|
+
await ApiServiceJ.fetchDataWithAxios<void>({
|
|
98
|
+
url: `${BASE_URL}/${id}/docusign/enviar`,
|
|
99
|
+
method: 'POST',
|
|
100
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
syncStatusDocuSign: async (): Promise<void> => {
|
|
104
|
+
await ApiServiceJ.fetchDataWithAxios<void>({
|
|
105
|
+
url: `${BASE_URL}/docusign/sync-status`,
|
|
106
|
+
method: 'PUT',
|
|
107
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
getRecipientsStatus: async (id: number): Promise<Array<{ name: string; email: string; status?: string }>> => {
|
|
111
|
+
const response = await ApiServiceJ.fetchDataWithAxios<Array<{ name: string; email: string; status?: string }>>({
|
|
112
|
+
url: `${BASE_URL}/${id}/docusign/recipients`,
|
|
113
|
+
method: 'GET',
|
|
114
|
+
serviceKeyEnvName: 'JURIDICO_API_KEY',
|
|
115
|
+
})
|
|
116
|
+
return response || []
|
|
117
|
+
},
|
|
118
|
+
}
|
package/package.json
CHANGED