account-lookup-service 17.13.0-snapshot.8 → 17.13.0-snapshot.9

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.13.0-snapshot.8",
4
+ "version": "17.13.0-snapshot.9",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -42,11 +42,9 @@ class PutPartiesErrorService extends BasePartiesService {
42
42
  } else {
43
43
  const isExternal = await this.#isPartyFromExternalDfsp()
44
44
  if (isExternal) {
45
- this.log.info('Need to cleanup oracle and forward PARTY_RESOLUTION_FAILURE error')
45
+ this.log.info('need to cleanup oracle coz party is from external DFSP')
46
46
  await this.cleanupOracle()
47
- await this.removeProxyGetPartiesTimeoutCache(alsReq)
48
- await this.sendPartyResolutionErrorCallback() // todo: think, if we need this?
49
- return
47
+ await this.removeProxyGetPartiesTimeoutCache(alsReq) // think if we need this
50
48
  }
51
49
  }
52
50
  }
@@ -947,10 +947,10 @@ describe('Parties Tests', () => {
947
947
  Config.PROXY_CACHE_CONFIG.enabled = true
948
948
  const errorCode = MojaloopApiErrorCodes.PAYEE_IDENTIFIER_NOT_VALID.code
949
949
  const payload = fixtures.errorCallbackResponseDto({ errorCode })
950
- const source = 'payerFsp'
950
+ const dataUri = encodePayload(JSON.stringify(payload), 'application/json')
951
951
  const destination = `dest-${Date.now()}`
952
952
  const proxy = `proxy-${Date.now()}`
953
- const headers = fixtures.partiesCallHeadersDto({ source, destination, proxy })
953
+ const headers = fixtures.partiesCallHeadersDto({ destination, proxy })
954
954
  const { params } = Helper.putByTypeIdRequest
955
955
  participant.validateParticipant = sandbox.stub().resolves(null) // external participant
956
956
  participant.sendRequest = sandbox.stub().resolves()
@@ -963,7 +963,7 @@ describe('Parties Tests', () => {
963
963
  data: { partyList: [{ fspId: 'fspId' }] }
964
964
  })
965
965
 
966
- await partiesDomain.putPartiesErrorByTypeAndID(headers, params, payload, '', null, null, proxyCache)
966
+ await partiesDomain.putPartiesErrorByTypeAndID(headers, params, payload, dataUri, null, null, proxyCache)
967
967
 
968
968
  expect(oracle.oracleRequest.callCount).toBe(2)
969
969
  expect(oracle.oracleRequest.lastCall.args[1]).toBe(RestMethods.DELETE)
@@ -972,9 +972,8 @@ describe('Parties Tests', () => {
972
972
  // eslint-disable-next-line no-unused-vars
973
973
  const [sentTo, _, data, cbHeaders] = participant.sendErrorToParticipant.lastCall.args
974
974
  expect(sentTo).toBe(proxy)
975
- expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(source)
976
- expect(cbHeaders[Headers.FSPIOP.PROXY]).toBeUndefined()
977
- expect(data.errorInformation.errorCode).toBe('2006')
975
+ expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(destination)
976
+ expect(JSON.parse(data).errorInformation.errorCode).toBe(errorCode)
978
977
  })
979
978
  })
980
979
  })
@@ -46,15 +46,15 @@ describe('PutPartiesErrorService Tests -->', () => {
46
46
  oracle.oracleRequest = jest.fn().mockResolvedValue({
47
47
  data: { partyList: [{ fspId: 'fspId' }] }
48
48
  })
49
- const source = 'externalSource'
50
49
  const destination = 'externalDestination'
51
50
  const proxyDest = 'proxyDest'
52
51
  const deps = createMockDeps({ oracle, participant })
53
52
  deps.proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValue(proxyDest)
54
53
 
55
- const headers = fixtures.partiesCallHeadersDto({ source, destination, proxy: 'proxyA' })
54
+ const headers = fixtures.partiesCallHeadersDto({ destination, proxy: 'proxyA' })
56
55
  const params = fixtures.partiesParamsDto()
57
- const dataUri = fixtures.dataUriDto()
56
+ const data = { test: true }
57
+ const dataUri = fixtures.dataUriDto(data)
58
58
 
59
59
  const service = new PutPartiesErrorService(deps, { headers, params, dataUri })
60
60
  await service.handleRequest()
@@ -65,8 +65,8 @@ describe('PutPartiesErrorService Tests -->', () => {
65
65
 
66
66
  const [sentTo, , payload, cbHeaders] = participant.sendErrorToParticipant.mock.lastCall
67
67
  expect(sentTo).toBe(proxyDest)
68
- expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(source)
69
- expect(payload.errorInformation.errorCode).toBe('2006')
68
+ expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(destination)
69
+ expect(payload).toBe(JSON.stringify(data))
70
70
  })
71
71
 
72
72
  test('should NOT cleanup oracle if destination is local', async () => {