account-lookup-service 17.13.0-snapshot.0 → 17.13.0-snapshot.3

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/.grype.yaml CHANGED
@@ -3,7 +3,6 @@ disabled: false
3
3
 
4
4
  ignore:
5
5
 
6
-
7
6
  # Set output format defaults
8
7
  output:
9
8
  - "table"
package/audit-ci.jsonc CHANGED
@@ -5,5 +5,6 @@
5
5
  "moderate": true,
6
6
  // NOTE: Please add as much information as possible to any items added to the allowList
7
7
  "allowlist": [
8
+ "GHSA-4hjh-wcwx-xvwj" // todo: update axios - https://github.com/advisories/GHSA-4hjh-wcwx-xvwj
8
9
  ]
9
10
  }
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.13.0-snapshot.0",
4
+ "version": "17.13.0-snapshot.3",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -91,22 +91,22 @@
91
91
  "@hapi/hapi": "21.4.3",
92
92
  "@hapi/inert": "7.1.0",
93
93
  "@hapi/vision": "7.0.3",
94
- "@mojaloop/central-services-error-handling": "13.1.1",
94
+ "@mojaloop/central-services-error-handling": "13.1.2-snapshot.0",
95
95
  "@mojaloop/central-services-health": "15.1.0",
96
96
  "@mojaloop/central-services-logger": "11.9.3",
97
97
  "@mojaloop/central-services-metrics": "12.7.1",
98
- "@mojaloop/central-services-shared": "18.32.0",
98
+ "@mojaloop/central-services-shared": "18.32.1",
99
99
  "@mojaloop/central-services-stream": "11.8.7",
100
100
  "@mojaloop/database-lib": "^11.3.2",
101
101
  "@mojaloop/event-sdk": "14.7.0",
102
102
  "@mojaloop/inter-scheme-proxy-cache-lib": "2.6.0",
103
- "@mojaloop/ml-schema-transformer-lib": "2.7.7",
104
- "@mojaloop/sdk-standard-components": "19.16.7",
103
+ "@mojaloop/ml-schema-transformer-lib": "2.7.8",
104
+ "@mojaloop/sdk-standard-components": "19.16.8",
105
105
  "@now-ims/hapi-now-auth": "2.1.0",
106
106
  "ajv": "8.17.1",
107
107
  "ajv-keywords": "5.1.0",
108
108
  "blipp": "4.0.2",
109
- "commander": "14.0.0",
109
+ "commander": "14.0.1",
110
110
  "cron": "4.3.3",
111
111
  "hapi-auth-bearer-token": "8.0.0",
112
112
  "joi": "18.0.1",
@@ -124,6 +124,7 @@
124
124
  "postcss": {
125
125
  "nanoid": "^3.3.8"
126
126
  },
127
+ "@mojaloop/central-services-error-handling": "13.1.2-snapshot.0",
127
128
  "@mojaloop/central-services-health": {
128
129
  "@mojaloop/central-services-logger": ">=11.4.0"
129
130
  },
@@ -165,7 +166,7 @@
165
166
  "devDependencies": {
166
167
  "@types/jest": "30.0.0",
167
168
  "audit-ci": "^7.1.0",
168
- "axios": "1.11.0",
169
+ "axios": "1.12.2",
169
170
  "axios-retry": "^4.5.0",
170
171
  "docdash": "2.0.2",
171
172
  "dotenv": "^17.2.2",
@@ -175,7 +176,7 @@
175
176
  "jest-junit": "16.0.0",
176
177
  "jsdoc": "4.0.4",
177
178
  "nodemon": "3.1.10",
178
- "npm-check-updates": "18.1.0",
179
+ "npm-check-updates": "18.1.1",
179
180
  "nyc": "17.1.0",
180
181
  "pre-commit": "1.2.2",
181
182
  "proxyquire": "2.1.3",
@@ -194,9 +194,9 @@ class BasePartiesService {
194
194
  return ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND, errMessage)
195
195
  }
196
196
 
197
- createFspiopServiceUnavailableError (errMessage, log = this.log) {
197
+ createFspiopPartyResolutionError (errMessage, log = this.log) {
198
198
  log.warn(errMessage)
199
- return ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.SERVICE_CURRENTLY_UNAVAILABLE, errMessage)
199
+ return ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_RESOLUTION_FAILURE, errMessage)
200
200
  }
201
201
 
202
202
  stepInProgress (stepName) {
@@ -46,7 +46,7 @@ class PutPartiesErrorService extends BasePartiesService {
46
46
  this.log.info('Need to cleanup oracle and forward SERVICE_CURRENTLY_UNAVAILABLE error')
47
47
  await this.cleanupOracle()
48
48
  await this.removeProxyGetPartiesTimeoutCache(alsReq)
49
- await this.forwardServiceUnavailableErrorCallback()
49
+ await this.#sendPartyResolutionErrorCallback()
50
50
  return
51
51
  }
52
52
  }
@@ -79,10 +79,10 @@ class PutPartiesErrorService extends BasePartiesService {
79
79
  return super.sendErrorCallback({ errorInfo, headers, params })
80
80
  }
81
81
 
82
- async forwardServiceUnavailableErrorCallback () {
83
- this.stepInProgress('forwardServiceUnavailableErrorCallback')
82
+ async #sendPartyResolutionErrorCallback () {
83
+ this.stepInProgress('#sendPartyResolutionErrorCallback')
84
84
  const { headers, params } = this.inputs
85
- const error = super.createFspiopServiceUnavailableError(ERROR_MESSAGES.externalPartyError)
85
+ const error = super.createFspiopPartyResolutionError(ERROR_MESSAGES.externalPartyError)
86
86
  const callbackHeaders = BasePartiesService.createErrorCallbackHeaders(headers, params, this.state.destination)
87
87
  const errorInfo = await this.deps.partiesUtils.makePutPartiesErrorPayload(this.deps.config, error, callbackHeaders, params)
88
88
 
@@ -92,7 +92,7 @@ class PutPartiesErrorService extends BasePartiesService {
92
92
  headers: callbackHeaders,
93
93
  params
94
94
  })
95
- this.log.verbose('#forwardServiceUnavailableErrorCallback is done', { callbackHeaders, errorInfo })
95
+ this.log.verbose('#sendPartyResolutionErrorCallback is done', { callbackHeaders, errorInfo })
96
96
  }
97
97
  }
98
98
 
@@ -970,7 +970,7 @@ describe('Parties Tests', () => {
970
970
  const [sentTo, _, data, cbHeaders] = participant.sendErrorToParticipant.lastCall.args
971
971
  expect(sentTo).toBe(proxy)
972
972
  expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(destination)
973
- expect(data.errorInformation.errorCode).toBe('2003')
973
+ expect(data.errorInformation.errorCode).toBe('2006')
974
974
  })
975
975
  })
976
976
  })
@@ -28,12 +28,12 @@
28
28
  const { setTimeout: sleep } = require('node:timers/promises')
29
29
  const {
30
30
  createMockDeps,
31
- createOracleFacadeMock, // use it instead of oracleMock
32
- createParticipantFacadeMock, // use it instead of participantMock
31
+ createOracleFacadeMock,
32
+ createParticipantFacadeMock,
33
33
  createProxyCacheMock,
34
34
  createProxiesUtilMock,
35
- oracleMock, // deprecated - use createOracleFacadeMock
36
- participantMock// deprecated - use createParticipantFacadeMock
35
+ oracleMock, // deprecated! use createOracleFacadeMock instead
36
+ participantMock // deprecated! use createParticipantFacadeMock instead
37
37
  } = require('./deps')
38
38
  // ↑ should be first require to mock external deps ↑
39
39
  const { GetPartiesService } = require('#src/domain/parties/services/index')
@@ -44,15 +44,14 @@ const { RestMethods, Headers } = GetPartiesService.enums()
44
44
 
45
45
  describe('GetPartiesService Tests -->', () => {
46
46
  const { config } = createMockDeps()
47
- let apiType
47
+ const { API_TYPE } = config
48
48
 
49
49
  beforeEach(() => {
50
50
  jest.clearAllMocks()
51
- apiType = config.API_TYPE
52
51
  })
53
52
 
54
53
  afterEach(() => {
55
- config.API_TYPE = apiType // to avoid side effects
54
+ config.API_TYPE = API_TYPE // to avoid side effects
56
55
  })
57
56
 
58
57
  describe('forwardRequestToDestination method', () => {
@@ -335,9 +334,10 @@ describe('GetPartiesService Tests -->', () => {
335
334
  }
336
335
  const headers = fixtures.partiesCallHeadersDto({ destination: '' })
337
336
  const params = fixtures.partiesParamsDto()
338
- const service = new GetPartiesService(deps, { headers, params })
339
337
 
338
+ const service = new GetPartiesService(deps, { headers, params })
340
339
  await service.handleRequest()
340
+
341
341
  expect(participantMock.sendErrorToParticipant).toHaveBeenCalledTimes(1)
342
342
  const isoPayload = participantMock.sendErrorToParticipant.mock.lastCall[2]
343
343
  expect(isoPayload.Assgnmt).toBeDefined()
@@ -353,13 +353,17 @@ describe('GetPartiesService Tests -->', () => {
353
353
  let deps
354
354
  let oracle // facade
355
355
  let participant // facade
356
+ let proxyCache
356
357
  let headers
357
358
  let params
358
359
 
359
360
  beforeEach(() => {
360
361
  oracle = createOracleFacadeMock()
361
362
  participant = createParticipantFacadeMock()
362
- deps = createMockDeps({ oracle, participant })
363
+ proxyCache = createProxyCacheMock({
364
+ addDfspIdToProxyMapping: jest.fn().mockResolvedValueOnce(true)
365
+ })
366
+ deps = createMockDeps({ oracle, participant, proxyCache })
363
367
  headers = fixtures.partiesCallHeadersDto({
364
368
  source: EXTERNAL_SOURCE_DFSP,
365
369
  destination: LOCAL_DESTINATION_DFSP,
@@ -369,17 +373,12 @@ describe('GetPartiesService Tests -->', () => {
369
373
  })
370
374
 
371
375
  test('should forward request when oracle DFSP matches destination DFSP', async () => {
372
- // Setup proxy cache to NOT find proxy mapping for local destination
373
- deps.proxyCache.addDfspIdToProxyMapping = jest.fn().mockResolvedValueOnce(true)
374
- deps.proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValueOnce(null)
375
-
376
376
  participant.validateParticipant = jest.fn()
377
377
  .mockResolvedValueOnce(null) // external source (validateRequester)
378
378
  .mockResolvedValueOnce({}) // proxy exists (validateRequester)
379
379
  .mockResolvedValueOnce({}) // local destination (forwardRequestToDestination)
380
380
  .mockResolvedValueOnce(null) // external source (shouldValidateViaOracle)
381
381
  .mockResolvedValueOnce({}) // local destination (shouldValidateViaOracle)
382
-
383
382
  oracle.oracleRequest = jest.fn().mockResolvedValueOnce(
384
383
  fixtures.oracleRequestResponseDto({
385
384
  partyList: [{ fspId: LOCAL_DESTINATION_DFSP }]
@@ -412,17 +411,12 @@ describe('GetPartiesService Tests -->', () => {
412
411
  })
413
412
 
414
413
  test('should send error callback when oracle DFSP differs from destination DFSP', async () => {
415
- // Setup proxy cache to NOT find proxy mapping for local destination
416
- deps.proxyCache.addDfspIdToProxyMapping = jest.fn().mockResolvedValueOnce(true)
417
- deps.proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValueOnce(null)
418
-
419
414
  participant.validateParticipant = jest.fn()
420
415
  .mockResolvedValueOnce(null) // external source (validateRequester)
421
416
  .mockResolvedValueOnce({}) // proxy exists (validateRequester)
422
417
  .mockResolvedValueOnce({}) // local destination (forwardRequestToDestination)
423
418
  .mockResolvedValueOnce(null) // external source (shouldValidateViaOracle)
424
419
  .mockResolvedValueOnce({})
425
-
426
420
  oracle.oracleRequest = jest.fn().mockResolvedValueOnce(
427
421
  fixtures.oracleRequestResponseDto({
428
422
  partyList: [{ fspId: ORACLE_DFSP_DIFFERENT }]
@@ -478,12 +472,11 @@ describe('GetPartiesService Tests -->', () => {
478
472
  destination: 'externalDestinationDfsp',
479
473
  proxy: PROXY_ID
480
474
  })
481
-
482
475
  participant.validateParticipant = jest.fn()
483
476
  .mockResolvedValueOnce(null) // external source
484
477
  .mockResolvedValueOnce({}) // proxy exists
485
478
  .mockResolvedValueOnce(null) // external destination
486
- deps.proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValueOnce(PROXY_ID)
479
+ proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValueOnce(PROXY_ID)
487
480
 
488
481
  const service = new GetPartiesService(deps, { headers: externalDestHeaders, params })
489
482
  await service.handleRequest()
@@ -502,7 +495,6 @@ describe('GetPartiesService Tests -->', () => {
502
495
  .mockResolvedValueOnce(null) // external source (shouldValidateViaOracle)
503
496
  .mockResolvedValueOnce({}) // local destination (shouldValidateViaOracle)
504
497
  .mockResolvedValueOnce({}) // local destination (forwardRequestToDestination)
505
-
506
498
  oracle.oracleRequest = jest.fn().mockResolvedValueOnce(
507
499
  fixtures.oracleRequestResponseDto({
508
500
  partyList: [{ fspId: ORACLE_DFSP_DIFFERENT }]
@@ -37,7 +37,7 @@ describe('PutPartiesErrorService Tests -->', () => {
37
37
  jest.clearAllMocks()
38
38
  })
39
39
 
40
- test('should cleanup oracle and forward SERVICE_CURRENTLY_UNAVAILABLE error for party from external dfsp', async () => {
40
+ test('should cleanup oracle and forward PARTY_RESOLUTION_FAILURE error for party from external dfsp', async () => {
41
41
  participantMock.validateParticipant = jest.fn().mockRejectedValue(new Error('No participant found')) // external participant
42
42
  const destination = 'externalDfsp'
43
43
  const proxyDest = 'proxyDest'
@@ -57,7 +57,7 @@ describe('PutPartiesErrorService Tests -->', () => {
57
57
  const [sentTo, _, payload, cbHeaders] = participantMock.sendErrorToParticipant.mock.lastCall
58
58
  expect(sentTo).toBe(proxyDest)
59
59
  expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(destination)
60
- expect(payload.errorInformation.errorCode).toBe('2003')
60
+ expect(payload.errorInformation.errorCode).toBe('2006')
61
61
  })
62
62
 
63
63
  test('should NOT cleanup oracle if destination is local', async () => {