account-lookup-service 17.4.1-csi-1300.0 → 17.4.1-csi-1300.1
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/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "account-lookup-service",
|
3
3
|
"description": "Account Lookup Service is used to validate Party and Participant lookups.",
|
4
|
-
"version": "17.4.1-csi-1300.
|
4
|
+
"version": "17.4.1-csi-1300.1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/*****
|
2
|
+
License
|
3
|
+
--------------
|
4
|
+
Copyright © 2020-2025 Mojaloop Foundation
|
5
|
+
The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
10
|
+
|
11
|
+
Contributors
|
12
|
+
--------------
|
13
|
+
This is the official list of the Mojaloop project contributors for this file.
|
14
|
+
Names of the original copyright holders (individuals or organizations)
|
15
|
+
should be listed with a '*' in the first column. People who have
|
16
|
+
contributed from an organization can be listed under the organization
|
17
|
+
that actually holds the copyright for their contributions (see the
|
18
|
+
Mojaloop Foundation for an example). Those individuals should have
|
19
|
+
their names indented and be marked with a '-'. Email address can be added
|
20
|
+
optionally within square brackets <email>.
|
21
|
+
|
22
|
+
* Mojaloop Foundation
|
23
|
+
* Eugen Klymniuk <eugen.klymniuk@infitx.com>
|
24
|
+
|
25
|
+
--------------
|
26
|
+
******/
|
27
|
+
|
28
|
+
const { proxies } = require('@mojaloop/central-services-shared').Util
|
29
|
+
const oracle = require('../../models/oracle/facade')
|
30
|
+
const participant = require('../../models/participantEndpoint/facade')
|
31
|
+
const config = require('../../lib/config')
|
32
|
+
const partiesUtils = require('./partiesUtils')
|
33
|
+
|
34
|
+
const createDeps = ({ cache, proxyCache, childSpan, log, stepState }) => Object.freeze({
|
35
|
+
cache,
|
36
|
+
proxyCache,
|
37
|
+
childSpan,
|
38
|
+
log,
|
39
|
+
stepState,
|
40
|
+
config,
|
41
|
+
oracle,
|
42
|
+
participant,
|
43
|
+
proxies,
|
44
|
+
partiesUtils
|
45
|
+
})
|
46
|
+
|
47
|
+
module.exports = {
|
48
|
+
createDeps
|
49
|
+
}
|
@@ -23,38 +23,11 @@
|
|
23
23
|
--------------
|
24
24
|
**********/
|
25
25
|
|
26
|
-
const { Enum, Util } = require('@mojaloop/central-services-shared')
|
27
|
-
// const ErrorHandler = require('@mojaloop/central-services-error-handling')
|
28
26
|
const Metrics = require('@mojaloop/central-services-metrics')
|
29
|
-
|
30
|
-
const oracle = require('../../models/oracle/facade')
|
31
|
-
const participant = require('../../models/participantEndpoint/facade')
|
32
|
-
const config = require('../../lib/config')
|
33
27
|
const libUtil = require('../../lib/util')
|
34
28
|
const { logger } = require('../../lib')
|
35
|
-
// const { createCallbackHeaders } = require('../../lib/headers')
|
36
|
-
// const { ERROR_MESSAGES } = require('../../constants')
|
37
29
|
const { GetPartiesService } = require('./services')
|
38
|
-
const
|
39
|
-
|
40
|
-
// const { FspEndpointTypes, FspEndpointTemplates } = Enum.EndPoints
|
41
|
-
// const { Headers, RestMethods } = Enum.Http
|
42
|
-
const { Headers } = Enum.Http
|
43
|
-
|
44
|
-
// const proxyCacheTtlSec = 40 // todo: make configurable
|
45
|
-
|
46
|
-
const createDeps = ({ cache, proxyCache, childSpan, log, stepState }) => Object.freeze({
|
47
|
-
cache,
|
48
|
-
proxyCache,
|
49
|
-
childSpan,
|
50
|
-
log,
|
51
|
-
stepState,
|
52
|
-
config,
|
53
|
-
oracle,
|
54
|
-
participant,
|
55
|
-
proxies: Util.proxies,
|
56
|
-
partiesUtils
|
57
|
-
})
|
30
|
+
const { createDeps } = require('./deps')
|
58
31
|
|
59
32
|
/**
|
60
33
|
* @function getPartiesByTypeAndID
|
@@ -76,261 +49,27 @@ const getPartiesByTypeAndID = async (headers, params, method, query, span, cache
|
|
76
49
|
'Get party by Type and Id',
|
77
50
|
['success']
|
78
51
|
).startTimer()
|
52
|
+
const childSpan = span ? span.getChild(component) : undefined
|
79
53
|
const log = logger.child({ component, params })
|
80
54
|
const stepState = libUtil.initStepState()
|
81
|
-
const childSpan = span ? span.getChild(component) : undefined
|
82
55
|
|
83
|
-
const
|
84
|
-
|
85
|
-
}
|
86
|
-
|
87
|
-
const proxyEnabled = !!(config.PROXY_CACHE_CONFIG.enabled && proxyCache)
|
88
|
-
const source = headers[Headers.FSPIOP.SOURCE]
|
89
|
-
const proxy = proxyEnabled && headers[Headers.FSPIOP.PROXY]
|
90
|
-
const destination = headers[Headers.FSPIOP.DESTINATION]
|
91
|
-
// see https://github.com/mojaloop/design-authority/issues/79
|
92
|
-
// the requester has specified a destination routing header. We should respect that and forward the request directly to the destination
|
93
|
-
// without consulting any oracles.
|
94
|
-
|
95
|
-
log.info('parties::getPartiesByTypeAndID start', { source, destination, proxy })
|
96
|
-
|
97
|
-
let requester
|
98
|
-
let fspiopError
|
56
|
+
const deps = createDeps({ cache, proxyCache, childSpan, log, stepState })
|
57
|
+
const service = new GetPartiesService(deps)
|
58
|
+
const results = {}
|
99
59
|
|
100
60
|
try {
|
101
|
-
|
102
|
-
|
103
|
-
if (destination) {
|
104
|
-
await service.forwardRequestToDestination({ destination, headers, params })
|
105
|
-
// await forwardRequestToDestination({
|
106
|
-
// destination, headers, options, callbackEndpointType, childSpan, proxyEnabled, proxyCache, log, stepState
|
107
|
-
// })
|
108
|
-
histTimerEnd({ success: true })
|
109
|
-
return
|
110
|
-
}
|
111
|
-
|
112
|
-
const response = await service.sendOracleDiscoveryRequest({ headers, params, query })
|
113
|
-
|
114
|
-
if (Array.isArray(response?.data?.partyList) && response.data.partyList.length > 0) {
|
115
|
-
const partyList = service.filterOraclePartyList({ response, params })
|
116
|
-
await service.processOraclePartyList({ partyList, headers, params, destination })
|
117
|
-
// const partyList = filterOraclePartyList({ response, params, log, stepState })
|
118
|
-
// await processOraclePartyList({
|
119
|
-
// partyList, headers, params, destination, childSpan, proxyEnabled, proxyCache, log, stepState
|
120
|
-
// })
|
121
|
-
} else {
|
122
|
-
log.info('empty partyList form oracle, getting proxies list...', { proxyEnabled, params })
|
123
|
-
const proxyNames = await service.getFilteredProxyList(proxy)
|
124
|
-
// getFilteredProxyList({ config, proxy, proxyEnabled, stepState })
|
125
|
-
|
126
|
-
if (!proxyNames.length) {
|
127
|
-
fspiopError = await service.sendErrorCallback({ requester, headers, params })
|
128
|
-
// sendErrorCallback({
|
129
|
-
// headers, params, requester, childSpan, stepState
|
130
|
-
// })
|
131
|
-
} else {
|
132
|
-
await service.triggerSendToProxiesFlow({ proxyNames, headers, params, source })
|
133
|
-
// await triggerSendToProxiesFlow({
|
134
|
-
// proxyNames, headers, params, source, childSpan, proxyCache, log, stepState
|
135
|
-
// })
|
136
|
-
}
|
137
|
-
}
|
138
|
-
log.info('parties::getPartiesByTypeAndID is done')
|
61
|
+
await service.handleRequest({ headers, params, query, results })
|
62
|
+
log.info('getPartiesByTypeAndID is done')
|
139
63
|
histTimerEnd({ success: true })
|
140
64
|
} catch (err) {
|
141
|
-
fspiopError = await partiesUtils.createErrorHandlerOnSendingCallback(config, log)(err, headers, params, requester)
|
65
|
+
results.fspiopError = await deps.partiesUtils.createErrorHandlerOnSendingCallback(deps.config, log)(err, headers, params, results.requester)
|
142
66
|
histTimerEnd({ success: false })
|
143
|
-
if (fspiopError) {
|
144
|
-
libUtil.countFspiopError(fspiopError, { operation: component, step: stepState.step })
|
67
|
+
if (results.fspiopError) {
|
68
|
+
libUtil.countFspiopError(results.fspiopError, { operation: component, step: stepState.step })
|
145
69
|
}
|
146
70
|
} finally {
|
147
|
-
await libUtil.finishSpanWithError(childSpan, fspiopError)
|
71
|
+
await libUtil.finishSpanWithError(childSpan, results.fspiopError)
|
148
72
|
}
|
149
73
|
}
|
150
74
|
|
151
|
-
// const validateRequester = async ({ source, proxy, proxyCache, stepState }) => {
|
152
|
-
// stepState.inProgress('validateRequester-0')
|
153
|
-
// const log = logger.child({ source, method: 'validateRequester' })
|
154
|
-
// const sourceParticipant = await participant.validateParticipant(source)
|
155
|
-
// if (sourceParticipant) {
|
156
|
-
// log.debug('source is in scheme')
|
157
|
-
// return source
|
158
|
-
// }
|
159
|
-
//
|
160
|
-
// if (!proxy) {
|
161
|
-
// const errMessage = ERROR_MESSAGES.sourceFspNotFound
|
162
|
-
// log.warn(errMessage)
|
163
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, errMessage)
|
164
|
-
// }
|
165
|
-
//
|
166
|
-
// const proxyParticipant = await participant.validateParticipant(proxy)
|
167
|
-
// if (!proxyParticipant) {
|
168
|
-
// const errMessage = ERROR_MESSAGES.partyProxyNotFound
|
169
|
-
// log.warn(errMessage, { proxy })
|
170
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, errMessage)
|
171
|
-
// }
|
172
|
-
//
|
173
|
-
// const isCached = await proxyCache.addDfspIdToProxyMapping(source, proxy)
|
174
|
-
// // think, what if isCached !== true?
|
175
|
-
// log.info('source is added to proxyMapping cache:', { proxy, isCached })
|
176
|
-
// return proxy
|
177
|
-
// }
|
178
|
-
|
179
|
-
// const forwardRequestToDestination = async ({
|
180
|
-
// destination, headers, options, callbackEndpointType, childSpan, proxyEnabled, proxyCache, log, stepState
|
181
|
-
// }) => {
|
182
|
-
// let sendTo = destination
|
183
|
-
// stepState.inProgress('validateDestination-1')
|
184
|
-
//
|
185
|
-
// const destParticipantModel = await participant.validateParticipant(destination)
|
186
|
-
// if (!destParticipantModel) {
|
187
|
-
// stepState.inProgress('lookupProxyDestination-2')
|
188
|
-
// const proxyId = proxyEnabled && await proxyCache.lookupProxyByDfspId(destination)
|
189
|
-
//
|
190
|
-
// if (!proxyId) {
|
191
|
-
// log.warn('no destination participant, and no dfsp-to-proxy mapping', { destination })
|
192
|
-
// const errMessage = ERROR_MESSAGES.partyDestinationFspNotFound
|
193
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, errMessage)
|
194
|
-
// }
|
195
|
-
// sendTo = proxyId
|
196
|
-
// }
|
197
|
-
// // all ok, go ahead and forward the request
|
198
|
-
// stepState.inProgress('forwardRequest-3')
|
199
|
-
// await participant.sendRequest(headers, sendTo, callbackEndpointType, RestMethods.GET, undefined, options, childSpan)
|
200
|
-
// log.info('discovery getPartiesByTypeAndID request was sent', { sendTo })
|
201
|
-
// }
|
202
|
-
|
203
|
-
// const filterOraclePartyList = ({ response, params, log, stepState }) => {
|
204
|
-
// // Oracle's API is a standard rest-style end-point Thus a GET /party on the oracle will return all participant-party records. We must filter the results based on the callbackEndpointType to make sure we remove records containing partySubIdOrType when we are in FSPIOP_CALLBACK_URL_PARTIES_GET mode:
|
205
|
-
// stepState.inProgress('filterOraclePartyList-5')
|
206
|
-
// const callbackEndpointType = partiesUtils.getPartyCbType(params.SubId)
|
207
|
-
// let filteredResponsePartyList
|
208
|
-
//
|
209
|
-
// switch (callbackEndpointType) {
|
210
|
-
// case FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_GET:
|
211
|
-
// filteredResponsePartyList = response.data.partyList.filter(party => party.partySubIdOrType == null) // Filter records that DON'T contain a partySubIdOrType
|
212
|
-
// break
|
213
|
-
// case FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTIES_SUB_ID_GET:
|
214
|
-
// filteredResponsePartyList = response.data.partyList.filter(party => party.partySubIdOrType === params.SubId) // Filter records that match partySubIdOrType
|
215
|
-
// break
|
216
|
-
// default:
|
217
|
-
// filteredResponsePartyList = response // Fallback to providing the standard list
|
218
|
-
// }
|
219
|
-
//
|
220
|
-
// if (!Array.isArray(filteredResponsePartyList) || !filteredResponsePartyList.length) {
|
221
|
-
// const errMessage = 'Requested FSP/Party not found'
|
222
|
-
// log.warn(errMessage)
|
223
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, errMessage)
|
224
|
-
// }
|
225
|
-
//
|
226
|
-
// return filteredResponsePartyList
|
227
|
-
// }
|
228
|
-
|
229
|
-
// const processOraclePartyList = async ({
|
230
|
-
// partyList, headers, params, destination, childSpan, proxyEnabled, proxyCache, log, stepState
|
231
|
-
// }) => {
|
232
|
-
// const callbackEndpointType = partiesUtils.getPartyCbType(params.SubId)
|
233
|
-
// const options = partiesUtils.partiesRequestOptionsDto(params)
|
234
|
-
//
|
235
|
-
// let sentCount = 0 // if sentCount === 0 after sending, should we restart the whole process?
|
236
|
-
// const sending = partyList.map(async party => {
|
237
|
-
// const { fspId } = party
|
238
|
-
// const clonedHeaders = { ...headers }
|
239
|
-
// if (!destination) {
|
240
|
-
// clonedHeaders[Headers.FSPIOP.DESTINATION] = fspId
|
241
|
-
// }
|
242
|
-
// stepState.inProgress('validateParticipant-6')
|
243
|
-
// const schemeParticipant = await participant.validateParticipant(fspId)
|
244
|
-
// if (schemeParticipant) {
|
245
|
-
// sentCount++
|
246
|
-
// log.info('participant is in scheme', { fspId })
|
247
|
-
// return participant.sendRequest(clonedHeaders, fspId, callbackEndpointType, RestMethods.GET, undefined, options, childSpan)
|
248
|
-
// }
|
249
|
-
//
|
250
|
-
// // If the participant is not in the scheme and proxy routing is enabled,
|
251
|
-
// // we should check if there is a proxy for it and send the request to the proxy
|
252
|
-
// if (proxyEnabled) {
|
253
|
-
// stepState.inProgress('lookupProxyByDfspId-7')
|
254
|
-
// const proxyName = await proxyCache.lookupProxyByDfspId(fspId)
|
255
|
-
// if (!proxyName) {
|
256
|
-
// log.warn('no proxyMapping for participant! TODO: Delete reference in oracle...', { fspId })
|
257
|
-
// // todo: delete reference in oracle
|
258
|
-
// } else {
|
259
|
-
// sentCount++
|
260
|
-
// log.info('participant is NOT in scheme, use proxy name', { fspId, proxyName })
|
261
|
-
// return participant.sendRequest(clonedHeaders, proxyName, callbackEndpointType, RestMethods.GET, undefined, options, childSpan)
|
262
|
-
// }
|
263
|
-
// }
|
264
|
-
// })
|
265
|
-
// await Promise.all(sending)
|
266
|
-
// log.verbose('processOraclePartyList is done', { sentCount })
|
267
|
-
// // todo: think what if sentCount === 0 here
|
268
|
-
// }
|
269
|
-
|
270
|
-
// const getFilteredProxyList = async ({ config, proxy, proxyEnabled, stepState }) => {
|
271
|
-
// stepState.inProgress('getAllProxies-8')
|
272
|
-
// if (!proxyEnabled) return []
|
273
|
-
//
|
274
|
-
// const proxyNames = await Util.proxies.getAllProxiesNames(config.SWITCH_ENDPOINT)
|
275
|
-
// return proxyNames.filter(name => name !== proxy)
|
276
|
-
// }
|
277
|
-
|
278
|
-
// const sendErrorCallback = async ({
|
279
|
-
// headers, params, requester, childSpan, stepState
|
280
|
-
// }) => {
|
281
|
-
// stepState.inProgress('sendErrorToParticipant-9')
|
282
|
-
// const callbackHeaders = createCallbackHeaders({
|
283
|
-
// requestHeaders: headers,
|
284
|
-
// partyIdType: params.Type,
|
285
|
-
// partyIdentifier: params.ID,
|
286
|
-
// endpointTemplate: params.SubId
|
287
|
-
// ? FspEndpointTemplates.PARTIES_SUB_ID_PUT_ERROR
|
288
|
-
// : FspEndpointTemplates.PARTIES_PUT_ERROR
|
289
|
-
// })
|
290
|
-
// const fspiopError = ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND)
|
291
|
-
//
|
292
|
-
// await participant.sendErrorToParticipant(
|
293
|
-
// requester,
|
294
|
-
// partiesUtils.errorPartyCbType(params.SubId),
|
295
|
-
// fspiopError.toApiErrorObject(config.ERROR_HANDLING),
|
296
|
-
// callbackHeaders,
|
297
|
-
// params,
|
298
|
-
// childSpan
|
299
|
-
// )
|
300
|
-
// return fspiopError
|
301
|
-
// }
|
302
|
-
|
303
|
-
// const triggerSendToProxiesFlow = async ({
|
304
|
-
// proxyNames, headers, params, source, childSpan, proxyCache, log, stepState
|
305
|
-
// }) => {
|
306
|
-
// stepState.inProgress('setSendToProxiesList-10')
|
307
|
-
// const alsReq = partiesUtils.alsRequestDto(source, params)
|
308
|
-
// log.info('starting setSendToProxiesList flow: ', { proxyNames, alsReq, proxyCacheTtlSec })
|
309
|
-
//
|
310
|
-
// const isCached = await proxyCache.setSendToProxiesList(alsReq, proxyNames, proxyCacheTtlSec)
|
311
|
-
// if (!isCached) {
|
312
|
-
// log.warn('failed to setSendToProxiesList')
|
313
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, ERROR_MESSAGES.failedToCacheSendToProxiesList)
|
314
|
-
// }
|
315
|
-
//
|
316
|
-
// const callbackEndpointType = partiesUtils.getPartyCbType(params.SubId)
|
317
|
-
// const options = partiesUtils.partiesRequestOptionsDto(params)
|
318
|
-
// stepState.inProgress('sendingProxyRequests-11')
|
319
|
-
// const sending = proxyNames.map(
|
320
|
-
// proxyName => participant.sendRequest(headers, proxyName, callbackEndpointType, RestMethods.GET, undefined, options, childSpan)
|
321
|
-
// .then(({ status, data } = {}) => ({ status, data }))
|
322
|
-
// )
|
323
|
-
// const results = await Promise.allSettled(sending)
|
324
|
-
// const isOk = results.some(result => result.status === 'fulfilled')
|
325
|
-
// // If, at least, one request is sent to proxy, we treat the whole flow as successful.
|
326
|
-
// // Failed requests should be handled by TTL expired/timeout handler
|
327
|
-
// // todo: - think, if we should handle failed requests here (e.g., by calling receivedErrorResponse)
|
328
|
-
// log.info('triggerSendToProxiesFlow is done:', { isOk, results, proxyNames, alsReq })
|
329
|
-
// stepState.inProgress('allSent-12')
|
330
|
-
// if (!isOk) {
|
331
|
-
// log.warn('no successful requests sent to proxies')
|
332
|
-
// throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, ERROR_MESSAGES.proxyConnectionError)
|
333
|
-
// }
|
334
|
-
// }
|
335
|
-
|
336
75
|
module.exports = getPartiesByTypeAndID
|
@@ -44,8 +44,38 @@ class GetPartiesService {
|
|
44
44
|
this.proxyEnabled = !!(deps.config.PROXY_CACHE_CONFIG?.enabled && deps.proxyCache)
|
45
45
|
}
|
46
46
|
|
47
|
-
async handleRequest () {
|
48
|
-
|
47
|
+
async handleRequest ({ headers, params, query, results }) {
|
48
|
+
const source = headers[Headers.FSPIOP.SOURCE]
|
49
|
+
const proxy = headers[Headers.FSPIOP.PROXY]
|
50
|
+
const destination = headers[Headers.FSPIOP.DESTINATION]
|
51
|
+
// see https://github.com/mojaloop/design-authority/issues/79
|
52
|
+
// the requester has specified a destination routing header. We should respect that and forward the request directly to the destination
|
53
|
+
// without consulting any oracles.
|
54
|
+
this.log.info('handling getParties request', { source, destination, proxy })
|
55
|
+
|
56
|
+
const requester = await this.validateRequester({ source, proxy })
|
57
|
+
results.requester = requester
|
58
|
+
|
59
|
+
if (destination) {
|
60
|
+
await this.forwardRequestToDestination({ destination, headers, params })
|
61
|
+
return
|
62
|
+
}
|
63
|
+
const response = await this.sendOracleDiscoveryRequest({ headers, params, query })
|
64
|
+
|
65
|
+
if (Array.isArray(response?.data?.partyList) && response.data.partyList.length > 0) {
|
66
|
+
const partyList = this.filterOraclePartyList({ response, params })
|
67
|
+
await this.processOraclePartyList({ partyList, headers, params, destination })
|
68
|
+
return
|
69
|
+
}
|
70
|
+
|
71
|
+
this.log.info('empty partyList form oracle, getting proxyList...', { params })
|
72
|
+
const proxyNames = await this.getFilteredProxyList(proxy)
|
73
|
+
|
74
|
+
if (proxyNames.length) {
|
75
|
+
return this.triggerSendToProxiesFlow({ proxyNames, headers, params, source })
|
76
|
+
}
|
77
|
+
|
78
|
+
results.fspiopError = await this.sendErrorCallback({ requester, headers, params })
|
49
79
|
}
|
50
80
|
|
51
81
|
async validateRequester ({ source, proxy }) {
|
@@ -58,7 +88,7 @@ class GetPartiesService {
|
|
58
88
|
return source
|
59
89
|
}
|
60
90
|
|
61
|
-
if (!proxy) {
|
91
|
+
if (!this.proxyEnabled || !proxy) {
|
62
92
|
const errMessage = ERROR_MESSAGES.sourceFspNotFound
|
63
93
|
log.warn(errMessage)
|
64
94
|
throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ID_NOT_FOUND, errMessage)
|
@@ -173,7 +203,10 @@ class GetPartiesService {
|
|
173
203
|
|
174
204
|
async getFilteredProxyList (proxy) {
|
175
205
|
this.#deps.stepState.inProgress('getAllProxies-8')
|
176
|
-
if (!this.proxyEnabled)
|
206
|
+
if (!this.proxyEnabled) {
|
207
|
+
this.log.warn('proxyCache is not enabled')
|
208
|
+
return []
|
209
|
+
}
|
177
210
|
|
178
211
|
const proxyNames = await this.#deps.proxies.getAllProxiesNames(this.#deps.config.SWITCH_ENDPOINT)
|
179
212
|
this.log.debug('getAllProxiesNames is done', { proxyNames })
|