account-lookup-service 17.7.0-snapshot.1 → 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 +5 -5
- package/src/domain/parties/services/BasePartiesService.js +3 -3
- package/src/domain/parties/services/GetPartiesService.js +3 -4
- package/src/domain/parties/services/PutPartiesErrorService.js +1 -1
- package/src/domain/parties/services/PutPartiesService.js +1 -1
- package/test/unit/domain/participants/participants.test.js +1 -1
- package/test/unit/domain/parties/parties.test.js +3 -3
- package/test/unit/domain/parties/services/BasePartiesService.test.js +12 -0
- package/test/unit/domain/parties/services/GetPartiesService.test.js +3 -1
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.
|
4
|
+
"version": "17.7.0-snapshot.4",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -92,15 +92,15 @@
|
|
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.
|
95
|
+
"@mojaloop/central-services-logger": "11.8.0",
|
96
96
|
"@mojaloop/central-services-metrics": "12.5.0",
|
97
|
-
"@mojaloop/central-services-shared": "18.23.1
|
97
|
+
"@mojaloop/central-services-shared": "18.23.1",
|
98
98
|
"@mojaloop/central-services-stream": "11.5.2",
|
99
99
|
"@mojaloop/database-lib": "11.1.4",
|
100
100
|
"@mojaloop/event-sdk": "14.4.0",
|
101
|
-
"@mojaloop/inter-scheme-proxy-cache-lib": "2.4.0
|
101
|
+
"@mojaloop/inter-scheme-proxy-cache-lib": "2.4.0",
|
102
102
|
"@mojaloop/ml-schema-transformer-lib": "2.6.0",
|
103
|
-
"@mojaloop/sdk-standard-components": "19.11.
|
103
|
+
"@mojaloop/sdk-standard-components": "19.11.1",
|
104
104
|
"@now-ims/hapi-now-auth": "2.1.0",
|
105
105
|
"ajv": "8.17.1",
|
106
106
|
"ajv-keywords": "5.1.0",
|
@@ -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
|
146
|
-
const isRemoved = await this.deps.proxyCache.removeProxyGetPartiesTimeout(alsReq)
|
147
|
-
this.log.debug('
|
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
|
290
|
-
const
|
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.
|
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.
|
77
|
+
await this.removeProxyGetPartiesTimeoutCache(alsReq)
|
78
78
|
return
|
79
79
|
}
|
80
80
|
|
@@ -1369,7 +1369,7 @@ describe('participant Tests', () => {
|
|
1369
1369
|
|
1370
1370
|
// Assert
|
1371
1371
|
expect(logStub.getCall(0).firstArg).toBe(ERROR_MESSAGES.sourceFspNotFound)
|
1372
|
-
expect(logStub.getCall(
|
1372
|
+
expect(logStub.getCall(3).lastArg).toEqual(cbError)
|
1373
1373
|
})
|
1374
1374
|
|
1375
1375
|
it('handles error when `oracleBatchRequest` returns no result', async () => {
|
@@ -248,7 +248,7 @@ describe('Parties Tests', () => {
|
|
248
248
|
await partiesDomain.getPartiesByTypeAndID(Helper.getByTypeIdRequest.headers, Helper.getByTypeIdRequest.params, Helper.getByTypeIdRequest.method, Helper.getByTypeIdRequest.query)
|
249
249
|
|
250
250
|
// Assert
|
251
|
-
expect(loggerStub.callCount).toBe(
|
251
|
+
expect(loggerStub.callCount).toBe(2)
|
252
252
|
expect(participant.sendErrorToParticipant.callCount).toBe(1)
|
253
253
|
|
254
254
|
const { errorInformation } = participant.sendErrorToParticipant.getCall(0).args[2]
|
@@ -901,7 +901,7 @@ describe('Parties Tests', () => {
|
|
901
901
|
|
902
902
|
// Assert
|
903
903
|
expect(participant.sendErrorToParticipant.callCount).toBe(1)
|
904
|
-
expect(loggerStub.callCount).toBe(
|
904
|
+
expect(loggerStub.callCount).toBe(2)
|
905
905
|
const sendErrorCallArgs = participant.sendErrorToParticipant.getCall(0).args
|
906
906
|
expect(sendErrorCallArgs[1]).toBe(expectedCallbackEnpointType)
|
907
907
|
})
|
@@ -922,7 +922,7 @@ describe('Parties Tests', () => {
|
|
922
922
|
|
923
923
|
// Assert
|
924
924
|
expect(participant.sendErrorToParticipant.callCount).toBe(1)
|
925
|
-
expect(loggerStub.callCount).toBe(
|
925
|
+
expect(loggerStub.callCount).toBe(2)
|
926
926
|
const sendErrorCallArgs = participant.sendErrorToParticipant.getCall(0).args
|
927
927
|
expect(sendErrorCallArgs[1]).toBe(expectedCallbackEnpointType)
|
928
928
|
})
|
@@ -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(
|
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
|
|