account-lookup-service 15.6.0-iso.1 → 15.6.0-iso.3
Sign up to get free protection for your applications and to get access to all the features.
package/.circleci/config.yml
CHANGED
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": "15.6.0-iso.
|
4
|
+
"version": "15.6.0-iso.3",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -100,7 +100,7 @@
|
|
100
100
|
"@mojaloop/database-lib": "11.0.6",
|
101
101
|
"@mojaloop/event-sdk": "14.1.1",
|
102
102
|
"@mojaloop/inter-scheme-proxy-cache-lib": "2.3.0",
|
103
|
-
"@mojaloop/ml-schema-transformer-lib": "
|
103
|
+
"@mojaloop/ml-schema-transformer-lib": "1.1.1",
|
104
104
|
"@mojaloop/sdk-standard-components": "19.0.0",
|
105
105
|
"@now-ims/hapi-now-auth": "2.1.0",
|
106
106
|
"ajv": "8.17.1",
|
@@ -157,9 +157,9 @@
|
|
157
157
|
"ioredis-mock": "^8.9.0",
|
158
158
|
"jest": "29.7.0",
|
159
159
|
"jest-junit": "16.0.0",
|
160
|
-
"jsdoc": "4.0.
|
160
|
+
"jsdoc": "4.0.4",
|
161
161
|
"nodemon": "3.1.7",
|
162
|
-
"npm-check-updates": "17.1.
|
162
|
+
"npm-check-updates": "17.1.4",
|
163
163
|
"nyc": "17.1.0",
|
164
164
|
"pre-commit": "1.2.2",
|
165
165
|
"proxyquire": "2.1.3",
|
@@ -222,7 +222,9 @@ const putParticipantsErrorByTypeAndID = async (headers, params, payload, dataUri
|
|
222
222
|
).startTimer()
|
223
223
|
try {
|
224
224
|
const partySubIdOrType = params.SubId || undefined
|
225
|
-
const callbackEndpointType = partySubIdOrType
|
225
|
+
const callbackEndpointType = partySubIdOrType
|
226
|
+
? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR
|
227
|
+
: Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR
|
226
228
|
const destinationParticipant = await participant.validateParticipant(headers[Enums.Http.Headers.FSPIOP.DESTINATION])
|
227
229
|
if (destinationParticipant) {
|
228
230
|
const decodedPayload = decodePayload(dataUri, { asParsed: false })
|
@@ -231,7 +233,8 @@ const putParticipantsErrorByTypeAndID = async (headers, params, payload, dataUri
|
|
231
233
|
callbackEndpointType,
|
232
234
|
decodedPayload.body.toString(),
|
233
235
|
headers,
|
234
|
-
params
|
236
|
+
params
|
237
|
+
)
|
235
238
|
} else {
|
236
239
|
await participant.sendErrorToParticipant(
|
237
240
|
headers[Enums.Http.Headers.FSPIOP.SOURCE],
|
@@ -239,15 +242,21 @@ const putParticipantsErrorByTypeAndID = async (headers, params, payload, dataUri
|
|
239
242
|
ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DESTINATION_FSP_ERROR).toApiErrorObject(),
|
240
243
|
headers,
|
241
244
|
params,
|
242
|
-
payload
|
245
|
+
payload
|
246
|
+
)
|
243
247
|
}
|
244
248
|
histTimerEnd({ success: true })
|
245
249
|
} catch (err) {
|
246
250
|
Logger.isErrorEnabled && Logger.error(err)
|
247
251
|
try {
|
248
252
|
const callbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR
|
249
|
-
await participant.sendErrorToParticipant(
|
250
|
-
|
253
|
+
await participant.sendErrorToParticipant(
|
254
|
+
headers[Enums.Http.Headers.FSPIOP.SOURCE],
|
255
|
+
callbackEndpointType,
|
256
|
+
ErrorHandler.Factory.reformatFSPIOPError(err).toApiErrorObject(),
|
257
|
+
headers,
|
258
|
+
params
|
259
|
+
)
|
251
260
|
} catch (exc) {
|
252
261
|
// We can't do anything else here- we _must_ handle all errors _within_ this function because
|
253
262
|
// we've already sent a sync response- we cannot throw.
|
@@ -102,9 +102,7 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
|
|
102
102
|
content: Config.PROTOCOL_VERSIONS.CONTENT.DEFAULT.toString(),
|
103
103
|
accept: Config.PROTOCOL_VERSIONS.ACCEPT.DEFAULT.toString()
|
104
104
|
}
|
105
|
-
const
|
106
|
-
|
107
|
-
const resp = await Util.Request.sendRequest({
|
105
|
+
const params = {
|
108
106
|
url: requestedEndpoint,
|
109
107
|
headers,
|
110
108
|
source: headers[Enums.Http.Headers.FSPIOP.SOURCE],
|
@@ -113,11 +111,15 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
|
|
113
111
|
payload,
|
114
112
|
responseType: Enums.Http.ResponseTypes.JSON,
|
115
113
|
span,
|
116
|
-
jwsSigner,
|
117
114
|
protocolVersions,
|
118
115
|
hubNameRegex,
|
119
116
|
apiType: Config.API_TYPE
|
120
|
-
}
|
117
|
+
}
|
118
|
+
Logger.isDebugEnabled && Logger.debug(`participant - sendRequest params: ${JSON.stringify(params)}`)
|
119
|
+
|
120
|
+
params.jwsSigner = defineJwsSigner(Config, headers, requestedEndpoint)
|
121
|
+
|
122
|
+
const resp = await Util.Request.sendRequest(params)
|
121
123
|
histTimerEndSendRequestToParticipant({ success: true, endpointType, participantName: requestedParticipant })
|
122
124
|
return resp
|
123
125
|
} catch (err) {
|
@@ -212,10 +214,7 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
|
|
212
214
|
clonedHeaders[Enums.Http.Headers.FSPIOP.SOURCE] = Config.HUB_NAME
|
213
215
|
}
|
214
216
|
|
215
|
-
|
216
|
-
const jwsSigner = defineJwsSigner(Config, clonedHeaders, requesterErrorEndpoint)
|
217
|
-
|
218
|
-
await Util.Request.sendRequest({
|
217
|
+
const params = {
|
219
218
|
url: requesterErrorEndpoint,
|
220
219
|
headers: clonedHeaders,
|
221
220
|
source: clonedHeaders[Enums.Http.Headers.FSPIOP.SOURCE],
|
@@ -225,10 +224,14 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
|
|
225
224
|
responseType: Enums.Http.ResponseTypes.JSON,
|
226
225
|
hubNameRegex,
|
227
226
|
span,
|
228
|
-
jwsSigner,
|
229
227
|
protocolVersions,
|
230
228
|
apiType: Config.API_TYPE
|
231
|
-
}
|
229
|
+
}
|
230
|
+
Logger.isDebugEnabled && Logger.debug(`participant - sendErrorToParticipant params: ${JSON.stringify(params)}`)
|
231
|
+
|
232
|
+
params.jwsSigner = defineJwsSigner(Config, clonedHeaders, requesterErrorEndpoint)
|
233
|
+
|
234
|
+
await Util.Request.sendRequest(params)
|
232
235
|
histTimerEndSendRequestToParticipant({ success: true, endpointType, participantName })
|
233
236
|
} catch (err) {
|
234
237
|
histTimerEndSendRequestToParticipant({ success: false, endpointType, participantName })
|
@@ -5,15 +5,12 @@ const config = require('../../../../src/lib/config')
|
|
5
5
|
const realApiType = config.API_TYPE
|
6
6
|
|
7
7
|
describe('timeoutCallbackDto Tests -->', () => {
|
8
|
-
// test('dummy', () => {
|
9
|
-
// expect(1).toBe(1)
|
10
|
-
// })
|
11
|
-
|
12
8
|
afterAll(() => {
|
13
9
|
config.API_TYPE = realApiType
|
14
10
|
})
|
15
11
|
|
16
|
-
|
12
|
+
// todo: unskip after fixing transformLib SubId issue for parties.putError
|
13
|
+
test.skip('should produce ISO payload', async () => {
|
17
14
|
config.API_TYPE = API_TYPES.iso20022
|
18
15
|
const destination = 'D1'
|
19
16
|
const partyId = 'P1'
|
@@ -2,13 +2,14 @@ const { TransformFacades } = require('../../../src/lib')
|
|
2
2
|
const { errorCallbackResponseDto, partiesCallHeadersDto } = require('../../fixtures')
|
3
3
|
|
4
4
|
describe('TransformFacades Tests -->', () => {
|
5
|
-
// test('dummy', () => {
|
6
|
-
// expect(1).toBe(1)
|
7
|
-
// })
|
8
5
|
test('should transform PUT /parties error callback payload to ISO format', async () => {
|
9
6
|
const body = errorCallbackResponseDto()
|
10
7
|
const headers = partiesCallHeadersDto()
|
11
|
-
const isoPayload = await TransformFacades.FSPIOP.parties.putError({
|
8
|
+
const isoPayload = await TransformFacades.FSPIOP.parties.putError({
|
9
|
+
body,
|
10
|
+
headers,
|
11
|
+
params: { Type: 'MSISDN', ID: '123456789' }
|
12
|
+
})
|
12
13
|
expect(isoPayload.body).toBeTruthy()
|
13
14
|
expect(isoPayload.body.Assgnmt).toBeTruthy()
|
14
15
|
expect(isoPayload.body.Assgnmt.Assgnr).toBeTruthy()
|