account-lookup-service 17.7.0-snapshot.2 → 17.7.0-snapshot.4

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.7.0-snapshot.2",
4
+ "version": "17.7.0-snapshot.4",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -92,7 +92,7 @@
92
92
  "@hapi/vision": "7.0.3",
93
93
  "@mojaloop/central-services-error-handling": "13.0.7",
94
94
  "@mojaloop/central-services-health": "15.0.4",
95
- "@mojaloop/central-services-logger": "11.7.0",
95
+ "@mojaloop/central-services-logger": "11.8.0",
96
96
  "@mojaloop/central-services-metrics": "12.5.0",
97
97
  "@mojaloop/central-services-shared": "18.23.1",
98
98
  "@mojaloop/central-services-stream": "11.5.2",
@@ -142,9 +142,9 @@ class BasePartiesService {
142
142
  return this.deps.oracle.oracleRequest(headers, RestMethods.DELETE, params, null, null, this.deps.cache)
143
143
  }
144
144
 
145
- async removeProxyGetPartiesTimeout (alsReq) {
146
- const isRemoved = await this.deps.proxyCache.removeProxyGetPartiesTimeout(alsReq)
147
- this.log.debug('removeProxyGetPartiesTimeout is done', { isRemoved, alsReq })
145
+ async removeProxyGetPartiesTimeoutCache (alsReq) {
146
+ const isRemoved = await this.deps.proxyCache.removeProxyGetPartiesTimeout(alsReq, this.state.proxy)
147
+ this.log.debug('removeProxyGetPartiesTimeoutCache is done', { isRemoved, alsReq })
148
148
  return isRemoved
149
149
  }
150
150
 
@@ -282,13 +282,12 @@ class GetPartiesService extends BasePartiesService {
282
282
  async #setProxyGetPartiesTimeout (sendTo) {
283
283
  const isLocalSource = this.isLocalSource()
284
284
  const isSentToProxy = this.state.destination !== sendTo
285
- this.log.verbose('isLocalSource and isSentToProxy: ', { isLocalSource, isSentToProxy })
285
+ this.log.verbose('isLocalSource and isSentToProxy: ', { isLocalSource, isSentToProxy, sendTo })
286
286
 
287
287
  if (isSentToProxy && isLocalSource) {
288
288
  this.stepInProgress('#setProxyGetPartiesTimeout')
289
- const { source, proxy } = this.state
290
- const alsReq = this.deps.partiesUtils.alsRequestDto(source, this.inputs.params)
291
- const isSet = await this.deps.proxyCache.setProxyGetPartiesTimeout(alsReq, proxy)
289
+ const alsReq = this.deps.partiesUtils.alsRequestDto(this.state.source, this.inputs.params)
290
+ const isSet = await this.deps.proxyCache.setProxyGetPartiesTimeout(alsReq, sendTo)
292
291
  this.log.info('#setProxyGetPartiesTimeout is done', { isSet })
293
292
  return isSet
294
293
  }
@@ -39,7 +39,7 @@ class PutPartiesErrorService extends BasePartiesService {
39
39
  // not initial inter-scheme discovery case. Cleanup oracle and trigger inter-scheme discovery
40
40
  this.log.warn('Need to cleanup oracle and trigger new inter-scheme discovery flow')
41
41
  await this.cleanupOracle()
42
- await this.removeProxyGetPartiesTimeout(alsReq)
42
+ await this.removeProxyGetPartiesTimeoutCache(alsReq)
43
43
  return true // need to trigger inter-scheme discovery
44
44
  }
45
45
 
@@ -74,7 +74,7 @@ class PutPartiesService extends BasePartiesService {
74
74
  const isExists = await this.deps.proxyCache.receivedSuccessResponse(alsReq)
75
75
  if (!isExists) {
76
76
  this.log.verbose('NOT inter-scheme receivedSuccessResponse case')
77
- await this.removeProxyGetPartiesTimeout(alsReq)
77
+ await this.removeProxyGetPartiesTimeoutCache(alsReq)
78
78
  return
79
79
  }
80
80
 
@@ -56,4 +56,16 @@ describe('BasePartiesService Tests -->', () => {
56
56
  expect(payload.Rpt.OrgnlId).toBe(`${params.Type}/${params.ID}`)
57
57
  expect(payload.Assgnmt.Assgnr.Agt.FinInstnId.Othr.Id).toBe(source)
58
58
  })
59
+
60
+ test('should remove proxy getParties timeout cache key', async () => {
61
+ const deps = createMockDeps()
62
+ const proxy = 'proxyAB'
63
+ const headers = fixtures.partiesCallHeadersDto({ proxy })
64
+ const params = fixtures.partiesParamsDto()
65
+ const alsReq = {}
66
+ const service = new BasePartiesService(deps, { headers, params })
67
+
68
+ await service.removeProxyGetPartiesTimeoutCache(alsReq)
69
+ expect(deps.proxyCache.removeProxyGetPartiesTimeout).toHaveBeenCalledWith(alsReq, proxy)
70
+ })
59
71
  })
@@ -156,8 +156,9 @@ describe('GetPartiesService Tests -->', () => {
156
156
  participantMock.validateParticipant = jest.fn()
157
157
  .mockResolvedValueOnce({}) // source
158
158
  .mockResolvedValueOnce(null) // destination
159
+ const proxyId = 'proxy-destination'
159
160
  const proxyCache = createProxyCacheMock({
160
- lookupProxyByDfspId: jest.fn().mockResolvedValueOnce('proxy-dest')
161
+ lookupProxyByDfspId: jest.fn().mockResolvedValueOnce(proxyId)
161
162
  })
162
163
  const deps = createMockDeps({ proxyCache })
163
164
  const headers = fixtures.partiesCallHeadersDto()
@@ -166,6 +167,7 @@ describe('GetPartiesService Tests -->', () => {
166
167
 
167
168
  await service.handleRequest()
168
169
  expect(proxyCache.setProxyGetPartiesTimeout).toHaveBeenCalledTimes(1)
170
+ expect(proxyCache.setProxyGetPartiesTimeout.mock.lastCall[1]).toBe(proxyId)
169
171
  expect(participantMock.sendRequest).toHaveBeenCalledTimes(1)
170
172
  })
171
173