account-lookup-service 17.5.0 → 17.7.0-snapshot.0

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.
@@ -1,3 +1,30 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
1
28
  const { randomUUID } = require('node:crypto')
2
29
  const { Enum } = require('@mojaloop/central-services-shared')
3
30
  const isoFixtures = require('./iso')
@@ -20,6 +47,16 @@ const headersDto = ({
20
47
  'content-type': contentType || accept
21
48
  })
22
49
 
50
+ const partiesParamsDto = ({
51
+ Type = 'MSISDN',
52
+ ID = String(Date.now()),
53
+ SubId
54
+ } = {}) => ({
55
+ Type,
56
+ ID,
57
+ ...(SubId && { SubId })
58
+ })
59
+
23
60
  const protocolVersionsDto = () => ({
24
61
  CONTENT: {
25
62
  DEFAULT: '2.1',
@@ -142,6 +179,7 @@ const mockHapiRequestDto = ({ // https://hapi.dev/api/?v=21.3.3#request-properti
142
179
  module.exports = {
143
180
  ...isoFixtures,
144
181
  partiesCallHeadersDto,
182
+ partiesParamsDto,
145
183
  participantsCallHeadersDto,
146
184
  oracleRequestResponseDto,
147
185
  putPartiesSuccessResponseDto,
@@ -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(3).lastArg).toEqual(cbError)
1372
+ expect(logStub.getCall(2).lastArg).toEqual(cbError)
1373
1373
  })
1374
1374
 
1375
1375
  it('handles error when `oracleBatchRequest` returns no result', async () => {
@@ -56,7 +56,7 @@ const fixtures = require('../../../fixtures')
56
56
  const { type: proxyCacheType, proxyConfig: proxyCacheConfig } = Config.PROXY_CACHE_CONFIG
57
57
 
58
58
  const { encodePayload } = Util.StreamingProtocol
59
- const { RestMethods } = Enum.Http
59
+ const { RestMethods, Headers } = Enum.Http
60
60
 
61
61
  Logger.isDebugEnabled = jest.fn(() => true)
62
62
  Logger.isErrorEnabled = jest.fn(() => true)
@@ -192,24 +192,26 @@ describe('Parties Tests', () => {
192
192
  expect(cached).toBe(proxy)
193
193
  })
194
194
 
195
- it('should send error callback if destination is not in the scheme, and not in proxyCache', async () => {
195
+ it('should cleanup oracle and trigger discovery flow, if destination is not in scheme and no dfsp-to-proxy mapping', async () => {
196
+ Config.PROXY_CACHE_CONFIG.enabled = true
196
197
  participant.validateParticipant = sandbox.stub()
197
198
  .onFirstCall().resolves({}) // source
198
199
  .onSecondCall().resolves(null) // destination
199
200
  participant.sendRequest = sandbox.stub().resolves()
200
201
  participant.sendErrorToParticipant = sandbox.stub().resolves()
201
202
  sandbox.stub(oracle, 'oracleRequest')
203
+ const proxy = 'some-proxy'
204
+ Util.proxies.getAllProxiesNames = sandbox.stub().resolves([proxy])
202
205
  const headers = fixtures.partiesCallHeadersDto()
203
206
 
204
207
  await partiesDomain.getPartiesByTypeAndID(headers, Helper.getByTypeIdRequest.params, Helper.getByTypeIdRequest.method, Helper.getByTypeIdRequest.query, Helper.mockSpan(), null, proxyCache)
205
208
 
206
- expect(participant.sendRequest.callCount).toBe(0)
207
- expect(oracle.oracleRequest.callCount).toBe(0)
208
- expect(participant.sendErrorToParticipant.callCount).toBe(1)
209
-
210
- const { errorInformation } = participant.sendErrorToParticipant.getCall(0).args[2]
211
- expect(errorInformation.errorCode).toBe('3200')
212
- expect(errorInformation.errorDescription).toContain(ERROR_MESSAGES.partyDestinationFspNotFound)
209
+ expect(oracle.oracleRequest.lastCall.args[1]).toBe(RestMethods.DELETE)
210
+ expect(participant.sendErrorToParticipant.callCount).toBe(0)
211
+ expect(participant.sendRequest.callCount).toBe(1)
212
+ // eslint-disable-next-line no-unused-vars
213
+ const [_, sendTo] = participant.sendRequest.lastCall.args
214
+ expect(sendTo).toBe(proxy)
213
215
  })
214
216
 
215
217
  it('should send request to proxy, if destination is not in the scheme, but has proxyMapping', async () => {
@@ -246,7 +248,7 @@ describe('Parties Tests', () => {
246
248
  await partiesDomain.getPartiesByTypeAndID(Helper.getByTypeIdRequest.headers, Helper.getByTypeIdRequest.params, Helper.getByTypeIdRequest.method, Helper.getByTypeIdRequest.query)
247
249
 
248
250
  // Assert
249
- expect(loggerStub.callCount).toBe(2)
251
+ expect(loggerStub.callCount).toBe(1)
250
252
  expect(participant.sendErrorToParticipant.callCount).toBe(1)
251
253
 
252
254
  const { errorInformation } = participant.sendErrorToParticipant.getCall(0).args[2]
@@ -470,7 +472,7 @@ describe('Parties Tests', () => {
470
472
  expect(firstCallArgs[2]).toBe(expectedCallbackEnpointType)
471
473
  })
472
474
 
473
- it('should send request to proxy if oracle returns dfsp NOT from the scheme', async () => {
475
+ it('should send errorCallback if oracle returns external dfsp, and source is external', async () => {
474
476
  Config.PROXY_CACHE_CONFIG.enabled = true
475
477
  const proxyName = `proxy-${Date.now()}`
476
478
  const fspId = `dfspNotFromScheme-${Date.now()}`
@@ -487,15 +489,20 @@ describe('Parties Tests', () => {
487
489
  const isAdded = await proxyCache.addDfspIdToProxyMapping(fspId, proxyName)
488
490
  expect(isAdded).toBe(true)
489
491
 
490
- const headers = fixtures.partiesCallHeadersDto({ destination: '' })
492
+ const source = `fromDfsp-${Date.now()}`
493
+ const headers = fixtures.partiesCallHeadersDto({ destination: '', source })
491
494
  const { params, method, query } = Helper.getByTypeIdRequest
492
495
 
493
496
  await partiesDomain.getPartiesByTypeAndID(headers, params, method, query, null, null, proxyCache)
494
497
 
495
- expect(participant.sendErrorToParticipant.callCount).toBe(0)
496
- expect(participant.sendRequest.callCount).toBe(1)
497
- const calledProxy = participant.sendRequest.getCall(0).args[1]
498
- expect(calledProxy).toBe(proxyName)
498
+ expect(participant.sendRequest.callCount).toBe(0)
499
+ expect(participant.sendErrorToParticipant.callCount).toBe(1)
500
+ // eslint-disable-next-line no-unused-vars
501
+ const [sentTo, _, payload, sentHeaders] = participant.sendErrorToParticipant.lastCall.args
502
+ expect(sentTo).toBe(source)
503
+ expect(payload.errorInformation.errorCode).toBe('3200')
504
+ expect(sentHeaders[Headers.FSPIOP.SOURCE]).toBe(Config.HUB_NAME)
505
+ expect(sentHeaders[Headers.FSPIOP.DESTINATION]).toBe(headers[Headers.FSPIOP.SOURCE])
499
506
  })
500
507
 
501
508
  it('handles error when `oracleRequest` returns no result', async () => {
@@ -554,13 +561,14 @@ describe('Parties Tests', () => {
554
561
  participant.sendRequest = sandbox.stub().rejects(new Error('Some network issue'))
555
562
  participant.sendErrorToParticipant = sandbox.stub().resolves()
556
563
  const headers = fixtures.partiesCallHeadersDto({ destination: '' })
564
+ const params = fixtures.partiesParamsDto()
557
565
 
558
- await partiesDomain.getPartiesByTypeAndID(headers, Helper.getByTypeIdRequest.params, Helper.getByTypeIdRequest.method, Helper.getByTypeIdRequest.query, Helper.mockSpan(), null, proxyCache)
566
+ await partiesDomain.getPartiesByTypeAndID(headers, params, Helper.getByTypeIdRequest.method, Helper.getByTypeIdRequest.query, Helper.mockSpan(), null, proxyCache)
559
567
 
560
568
  expect(participant.sendRequest.callCount).toBe(proxyNames.length)
561
569
  expect(participant.sendErrorToParticipant.callCount).toBe(1)
562
570
 
563
- const { errorInformation } = participant.sendErrorToParticipant.getCall(0).args[2]
571
+ const { errorInformation } = participant.sendErrorToParticipant.lastCall.args[2]
564
572
  expect(errorInformation.errorCode).toBe('3200')
565
573
  expect(errorInformation.errorDescription).toContain(ERROR_MESSAGES.proxyConnectionError)
566
574
  })
@@ -893,7 +901,7 @@ describe('Parties Tests', () => {
893
901
 
894
902
  // Assert
895
903
  expect(participant.sendErrorToParticipant.callCount).toBe(1)
896
- expect(loggerStub.callCount).toBe(2)
904
+ expect(loggerStub.callCount).toBe(1)
897
905
  const sendErrorCallArgs = participant.sendErrorToParticipant.getCall(0).args
898
906
  expect(sendErrorCallArgs[1]).toBe(expectedCallbackEnpointType)
899
907
  })
@@ -914,7 +922,7 @@ describe('Parties Tests', () => {
914
922
 
915
923
  // Assert
916
924
  expect(participant.sendErrorToParticipant.callCount).toBe(1)
917
- expect(loggerStub.callCount).toBe(2)
925
+ expect(loggerStub.callCount).toBe(1)
918
926
  const sendErrorCallArgs = participant.sendErrorToParticipant.getCall(0).args
919
927
  expect(sendErrorCallArgs[1]).toBe(expectedCallbackEnpointType)
920
928
  })
@@ -0,0 +1,142 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
28
+ jest.mock('#src/models/oracle/facade')
29
+ jest.mock('#src/models/participantEndpoint/facade')
30
+
31
+ const { GetPartiesService } = require('#src/domain/parties/services/index')
32
+ const { ERROR_MESSAGES } = require('#src/constants')
33
+ const oracle = require('#src/models/oracle/facade')
34
+ const participant = require('#src/models/participantEndpoint/facade')
35
+ const fixtures = require('#test/fixtures/index')
36
+ const { createMockDeps, createProxyCacheMock } = require('./deps')
37
+
38
+ const { RestMethods, Headers } = GetPartiesService.enums()
39
+
40
+ describe('GetPartiesService Tests -->', () => {
41
+ beforeEach(() => {
42
+ jest.clearAllMocks()
43
+ })
44
+
45
+ describe('forwardRequestToDestination method', () => {
46
+ test('should delete party info from oracle, if no destination DFSP in proxy mapping', async () => {
47
+ participant.validateParticipant = jest.fn().mockResolvedValueOnce(false)
48
+ const proxyCache = createProxyCacheMock({
49
+ lookupProxyByDfspId: jest.fn().mockResolvedValueOnce(null)
50
+ })
51
+ const deps = createMockDeps({ proxyCache })
52
+
53
+ const destination = 'dfsp'
54
+ const headers = fixtures.partiesCallHeadersDto({ destination, proxy: 'proxy' })
55
+ const params = fixtures.partiesParamsDto()
56
+ const service = new GetPartiesService(deps, { headers, params })
57
+ service.triggerInterSchemeDiscoveryFlow = jest.fn()
58
+
59
+ await service.forwardRequestToDestination()
60
+
61
+ expect(oracle.oracleRequest.mock.calls.length).toBe(1)
62
+ const [sentHeaders, method, sentParams] = oracle.oracleRequest.mock.lastCall
63
+ expect(method).toBe(RestMethods.DELETE)
64
+ expect(sentHeaders).toEqual(headers)
65
+ expect(sentParams).toEqual(params)
66
+
67
+ expect(service.triggerInterSchemeDiscoveryFlow.mock.calls.length).toBe(1)
68
+ expect(service.triggerInterSchemeDiscoveryFlow.mock.lastCall[0]).toEqual({
69
+ ...headers,
70
+ [Headers.FSPIOP.DESTINATION]: undefined
71
+ })
72
+ })
73
+ })
74
+
75
+ describe('processOraclePartyList for external participants', () => {
76
+ const EXTERNAL_DFSP_ID = 'externalFsp'
77
+ const PROXY_ID = 'externalProxy'
78
+ let deps
79
+ let proxyCache
80
+
81
+ beforeEach(async () => {
82
+ oracle.oracleRequest = jest.fn().mockResolvedValueOnce(
83
+ fixtures.oracleRequestResponseDto({ partyList: [{ fspId: EXTERNAL_DFSP_ID }] })
84
+ )
85
+ participant.validateParticipant = jest.fn()
86
+ .mockResolvedValueOnce(null) // source
87
+ .mockResolvedValueOnce({}) // proxy
88
+
89
+ proxyCache = createProxyCacheMock({
90
+ addDfspIdToProxyMapping: jest.fn().mockResolvedValueOnce(true),
91
+ lookupProxyByDfspId: jest.fn().mockResolvedValueOnce(PROXY_ID)
92
+ })
93
+ deps = createMockDeps({ proxyCache })
94
+ })
95
+
96
+ test('should throw ID_NOT_FOUND error and cleanup oracle, if no proxyMapping for external dfsp', async () => {
97
+ expect.hasAssertions()
98
+ proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValueOnce(null)
99
+ const headers = fixtures.partiesCallHeadersDto({
100
+ destination: '', proxy: 'proxyA'
101
+ })
102
+ const params = fixtures.partiesParamsDto()
103
+ const service = new GetPartiesService(deps, { headers, params })
104
+
105
+ await service.handleRequest()
106
+ .catch((err) => {
107
+ expect(err).toEqual(service.createFspiopIdNotFoundError(ERROR_MESSAGES.noDiscoveryRequestsForwarded))
108
+ })
109
+ expect(oracle.oracleRequest.mock.calls.length).toBe(2) // GET + DELETE
110
+ expect(oracle.oracleRequest.mock.lastCall[1]).toBe(RestMethods.DELETE)
111
+ })
112
+
113
+ test('should throw ID_NOT_FOUND error, if source is external', async () => {
114
+ expect.hasAssertions()
115
+ const headers = fixtures.partiesCallHeadersDto({
116
+ destination: '', proxy: 'proxyA'
117
+ })
118
+ const params = fixtures.partiesParamsDto()
119
+ const service = new GetPartiesService(deps, { headers, params })
120
+
121
+ await service.handleRequest()
122
+ .catch((err) => {
123
+ expect(err).toEqual(service.createFspiopIdNotFoundError(ERROR_MESSAGES.noDiscoveryRequestsForwarded))
124
+ })
125
+ })
126
+
127
+ test('should forward request, if source is in scheme', async () => {
128
+ participant.validateParticipant = jest.fn(async (fsp) => (fsp === EXTERNAL_DFSP_ID ? null : {}))
129
+ const headers = fixtures.partiesCallHeadersDto({
130
+ destination: '', proxy: 'proxyA'
131
+ })
132
+ const params = fixtures.partiesParamsDto()
133
+ const service = new GetPartiesService(deps, { headers, params })
134
+
135
+ await service.handleRequest()
136
+ expect(participant.sendRequest.mock.calls.length).toBe(1)
137
+ const [sentHeaders, sendTo] = participant.sendRequest.mock.lastCall
138
+ expect(sendTo).toEqual(PROXY_ID)
139
+ expect(sentHeaders[Headers.FSPIOP.DESTINATION]).toBe(EXTERNAL_DFSP_ID)
140
+ })
141
+ })
142
+ })
@@ -0,0 +1,53 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
28
+ jest.mock('#src/models/oracle/facade')
29
+ jest.mock('#src/models/participantEndpoint/facade')
30
+
31
+ const { PutPartiesErrorService } = require('#src/domain/parties/services/index')
32
+ const oracle = require('#src/models/oracle/facade')
33
+ const fixtures = require('#test/fixtures/index')
34
+ const { createMockDeps } = require('./deps')
35
+
36
+ const { RestMethods } = PutPartiesErrorService.enums()
37
+
38
+ describe('PutPartiesErrorService Tests -->', () => {
39
+ beforeEach(() => {
40
+ jest.clearAllMocks()
41
+ })
42
+
43
+ test('should cleanup oracle and trigger discovery flow for party from external dfsp', async () => {
44
+ const headers = fixtures.partiesCallHeadersDto({ proxy: 'proxyA' })
45
+ const params = fixtures.partiesParamsDto()
46
+ const service = new PutPartiesErrorService(createMockDeps(), { headers, params })
47
+
48
+ const needDiscovery = await service.handleRequest()
49
+ expect(needDiscovery).toBe(true)
50
+ expect(oracle.oracleRequest.mock.calls.length).toBe(1)
51
+ expect(oracle.oracleRequest.mock.lastCall[1]).toBe(RestMethods.DELETE)
52
+ })
53
+ })
@@ -0,0 +1,40 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
28
+ const { createDeps } = require('#src/domain/parties/deps')
29
+ const { logger } = require('#src/lib/index')
30
+ const { createProxyCacheMock } = require('#test/util/mockDeps')
31
+
32
+ const createMockDeps = ({
33
+ proxyCache = createProxyCacheMock(),
34
+ log = logger.child({ test: true })
35
+ } = {}) => createDeps({ proxyCache, log })
36
+
37
+ module.exports = {
38
+ createMockDeps,
39
+ createProxyCacheMock
40
+ }
@@ -1,11 +1,10 @@
1
+ const { AlsApiClient, ProxyApiClient } = require('./apiClients')
2
+ const mockDeps = require('./mockDeps')
1
3
  const onboarding = require('./onboarding')
2
- const {
3
- AlsApiClient,
4
- ProxyApiClient
5
- } = require('./apiClients')
6
4
 
7
5
  module.exports = {
8
- onboarding,
9
6
  AlsApiClient,
10
- ProxyApiClient
7
+ ProxyApiClient,
8
+ mockDeps,
9
+ onboarding
11
10
  }
@@ -0,0 +1,48 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
28
+ const createProxyCacheMock = ({
29
+ addDfspIdToProxyMapping = jest.fn(async () => true),
30
+ isPendingCallback = jest.fn(async () => false),
31
+ lookupProxyByDfspId = jest.fn(async () => null),
32
+ receivedErrorResponse = jest.fn(async () => false),
33
+ receivedSuccessResponse = jest.fn(async () => true),
34
+ removeDfspIdFromProxyMapping = jest.fn(async () => true),
35
+ setSendToProxiesList = jest.fn(async () => true)
36
+ } = {}) => ({
37
+ addDfspIdToProxyMapping,
38
+ isPendingCallback,
39
+ lookupProxyByDfspId,
40
+ receivedErrorResponse,
41
+ receivedSuccessResponse,
42
+ removeDfspIdFromProxyMapping,
43
+ setSendToProxiesList
44
+ })
45
+
46
+ module.exports = {
47
+ createProxyCacheMock
48
+ }