account-lookup-service 15.6.0-iso.5 → 15.6.0-iso.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.ncurc.yaml +1 -1
- package/package.json +1 -1
- package/src/models/participantEndpoint/facade.js +11 -12
package/.ncurc.yaml
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
reject: [
|
3
3
|
# TODO: v6+ (ref: https://github.com/sindresorhus/get-port/releases/tag/v6.0.0) is an ESM library and thus not compatible with CommonJS. Future story needed to resolve.
|
4
4
|
"get-port",
|
5
|
-
"@mojaloop/
|
5
|
+
"@mojaloop/sdk-standard-components" ## version 19.1.0 caused lots of failed unit tests with the error - TypeError: Cannot read properties of undefined (reading 'createFSPIOPError')
|
6
6
|
]
|
package/package.json
CHANGED
@@ -33,7 +33,9 @@ const ErrorHandler = require('@mojaloop/central-services-error-handling')
|
|
33
33
|
const JwsSigner = require('@mojaloop/sdk-standard-components').Jws.signer
|
34
34
|
const Metrics = require('@mojaloop/central-services-metrics')
|
35
35
|
const Config = require('../../lib/config')
|
36
|
+
const { logger } = require('../../lib')
|
36
37
|
const { hubNameRegex } = require('../../lib/util').hubNameConfig
|
38
|
+
|
37
39
|
const uriRegex = /(?:^.*)(\/(participants|parties|quotes|transfers)(\/.*)*)$/
|
38
40
|
|
39
41
|
/**
|
@@ -47,7 +49,7 @@ const defineJwsSigner = (config, headers, requestedEndpoint) => {
|
|
47
49
|
// We need below 2 headers for JWS
|
48
50
|
headers[Enums.Http.Headers.FSPIOP.HTTP_METHOD] = headers[Enums.Http.Headers.FSPIOP.HTTP_METHOD] || Enums.Http.RestMethods.PUT
|
49
51
|
headers[Enums.Http.Headers.FSPIOP.URI] = headers[Enums.Http.Headers.FSPIOP.URI] || uriRegex.exec(requestedEndpoint)[1]
|
50
|
-
|
52
|
+
logger.debug('JWS is enabled, getting JwsSigner')
|
51
53
|
jwsSigner = new JwsSigner({
|
52
54
|
logger: Logger,
|
53
55
|
signingKey: config.JWS_SIGNING_KEY
|
@@ -83,10 +85,10 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
|
|
83
85
|
try {
|
84
86
|
requestedEndpoint = await Util.Endpoints.getEndpoint(Config.SWITCH_ENDPOINT, requestedParticipant, endpointType, options || undefined)
|
85
87
|
histTimerEndGetParticipantEndpoint({ success: true, endpointType, participantName: requestedParticipant })
|
86
|
-
|
88
|
+
logger.debug('participant requestedEndpoint and endpointType: ', { requestedEndpoint, endpointType })
|
87
89
|
} catch (err) {
|
88
90
|
histTimerEndGetParticipantEndpoint({ success: false, endpointType, participantName: requestedParticipant })
|
89
|
-
|
91
|
+
logger.warn('error in getEndpoint: ', err)
|
90
92
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
91
93
|
}
|
92
94
|
|
@@ -115,8 +117,7 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
|
|
115
117
|
hubNameRegex,
|
116
118
|
apiType: Config.API_TYPE
|
117
119
|
}
|
118
|
-
|
119
|
-
|
120
|
+
logger.debug('participant - sendRequest params:', { params })
|
120
121
|
params.jwsSigner = defineJwsSigner(Config, headers, requestedEndpoint)
|
121
122
|
|
122
123
|
const resp = await Util.Request.sendRequest(params)
|
@@ -124,8 +125,7 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
|
|
124
125
|
return resp
|
125
126
|
} catch (err) {
|
126
127
|
histTimerEndSendRequestToParticipant({ success: false, endpointType, participantName: requestedParticipant })
|
127
|
-
|
128
|
-
|
128
|
+
logger.warn('error in sendRequest: ', err)
|
129
129
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
130
130
|
}
|
131
131
|
}
|
@@ -150,7 +150,7 @@ exports.validateParticipant = async (fsp) => {
|
|
150
150
|
return resp
|
151
151
|
} catch (err) {
|
152
152
|
histTimerEnd({ success: false })
|
153
|
-
|
153
|
+
logger.warn('error in validateParticipant: ', err)
|
154
154
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
155
155
|
}
|
156
156
|
}
|
@@ -190,7 +190,7 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
|
|
190
190
|
histTimerEndGetParticipantEndpoint({ success: true, endpointType, participantName })
|
191
191
|
} catch (err) {
|
192
192
|
histTimerEndGetParticipantEndpoint({ success: false, endpointType, participantName })
|
193
|
-
|
193
|
+
logger.warn('error in getEndpoint: ', err)
|
194
194
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
195
195
|
}
|
196
196
|
|
@@ -227,15 +227,14 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
|
|
227
227
|
protocolVersions,
|
228
228
|
apiType: Config.API_TYPE
|
229
229
|
}
|
230
|
-
|
231
|
-
|
230
|
+
logger.debug('participant - sendErrorToParticipant params: ', { params })
|
232
231
|
params.jwsSigner = defineJwsSigner(Config, clonedHeaders, requesterErrorEndpoint)
|
233
232
|
|
234
233
|
await Util.Request.sendRequest(params)
|
235
234
|
histTimerEndSendRequestToParticipant({ success: true, endpointType, participantName })
|
236
235
|
} catch (err) {
|
237
236
|
histTimerEndSendRequestToParticipant({ success: false, endpointType, participantName })
|
238
|
-
|
237
|
+
logger.warn('error in sendErrorToParticipant: ', err)
|
239
238
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
240
239
|
}
|
241
240
|
}
|