account-lookup-service 17.13.0-snapshot.7 → 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 +1 -1
- package/src/domain/parties/services/BasePartiesService.js +2 -0
- package/src/domain/parties/services/PutPartiesErrorService.js +2 -4
- package/src/domain/parties/services/PutPartiesService.js +1 -1
- package/test/unit/domain/parties/parties.test.js +5 -6
- package/test/unit/domain/parties/services/PutPartiesErrorService.test.js +5 -5
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.
|
4
|
+
"version": "17.13.0-snapshot.9",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -205,9 +205,11 @@ class BasePartiesService {
|
|
205
205
|
async sendPartyResolutionErrorCallback () {
|
206
206
|
this.stepInProgress('sendPartyResolutionErrorCallback')
|
207
207
|
const { headers, params } = this.inputs
|
208
|
+
|
208
209
|
const error = this.createFspiopPartyResolutionError(ERROR_MESSAGES.externalPartyError)
|
209
210
|
const callbackHeaders = BasePartiesService.createErrorCallbackHeaders(headers, params)
|
210
211
|
const errorInfo = await this.deps.partiesUtils.makePutPartiesErrorPayload(this.deps.config, error, callbackHeaders, params)
|
212
|
+
this.state.destination = callbackHeaders[Headers.FSPIOP.DESTINATION]
|
211
213
|
|
212
214
|
await this.identifyDestinationForCallback()
|
213
215
|
await this.sendErrorCallback({
|
@@ -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('
|
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
|
}
|
@@ -104,7 +104,7 @@ class PutPartiesService extends BasePartiesService {
|
|
104
104
|
fspId: source
|
105
105
|
}
|
106
106
|
await this.deps.oracle.oracleRequest(headers, RestMethods.POST, params, null, mappingPayload, this.deps.cache)
|
107
|
-
this.log.info('oracle was updated with mappingPayload',
|
107
|
+
this.log.info('oracle was updated with mappingPayload: ', mappingPayload)
|
108
108
|
}
|
109
109
|
}
|
110
110
|
|
@@ -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
|
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({
|
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,
|
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(
|
976
|
-
expect(
|
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({
|
54
|
+
const headers = fixtures.partiesCallHeadersDto({ destination, proxy: 'proxyA' })
|
56
55
|
const params = fixtures.partiesParamsDto()
|
57
|
-
const
|
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(
|
69
|
-
expect(payload
|
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 () => {
|