account-lookup-service 17.13.0-snapshot.6 → 17.13.0-snapshot.7
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 +1 -1
- package/src/domain/parties/services/PutPartiesErrorService.js +1 -1
- package/src/lib/headers.js +1 -0
- package/test/unit/domain/parties/parties.test.js +4 -2
- package/test/unit/domain/parties/services/PutPartiesErrorService.test.js +4 -3
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.7",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -206,7 +206,7 @@ class BasePartiesService {
|
|
206
206
|
this.stepInProgress('sendPartyResolutionErrorCallback')
|
207
207
|
const { headers, params } = this.inputs
|
208
208
|
const error = this.createFspiopPartyResolutionError(ERROR_MESSAGES.externalPartyError)
|
209
|
-
const callbackHeaders = BasePartiesService.createErrorCallbackHeaders(headers, params
|
209
|
+
const callbackHeaders = BasePartiesService.createErrorCallbackHeaders(headers, params)
|
210
210
|
const errorInfo = await this.deps.partiesUtils.makePutPartiesErrorPayload(this.deps.config, error, callbackHeaders, params)
|
211
211
|
|
212
212
|
await this.identifyDestinationForCallback()
|
@@ -45,7 +45,7 @@ class PutPartiesErrorService extends BasePartiesService {
|
|
45
45
|
this.log.info('Need to cleanup oracle and forward PARTY_RESOLUTION_FAILURE error')
|
46
46
|
await this.cleanupOracle()
|
47
47
|
await this.removeProxyGetPartiesTimeoutCache(alsReq)
|
48
|
-
await this.sendPartyResolutionErrorCallback()
|
48
|
+
await this.sendPartyResolutionErrorCallback() // todo: think, if we need this?
|
49
49
|
return
|
50
50
|
}
|
51
51
|
}
|
package/src/lib/headers.js
CHANGED
@@ -41,6 +41,7 @@ const Config = require('../lib/config')
|
|
41
41
|
*/
|
42
42
|
exports.createCallbackHeaders = (params) => {
|
43
43
|
const callbackHeaders = { ...params.requestHeaders }
|
44
|
+
delete callbackHeaders[Enums.Http.Headers.FSPIOP.PROXY]
|
44
45
|
|
45
46
|
callbackHeaders[Enums.Http.Headers.FSPIOP.SOURCE] = Config.HUB_NAME
|
46
47
|
callbackHeaders[Enums.Http.Headers.FSPIOP.DESTINATION] = params.requestHeaders[Enums.Http.Headers.FSPIOP.SOURCE]
|
@@ -947,9 +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
951
|
const destination = `dest-${Date.now()}`
|
951
952
|
const proxy = `proxy-${Date.now()}`
|
952
|
-
const headers = fixtures.partiesCallHeadersDto({ destination, proxy })
|
953
|
+
const headers = fixtures.partiesCallHeadersDto({ source, destination, proxy })
|
953
954
|
const { params } = Helper.putByTypeIdRequest
|
954
955
|
participant.validateParticipant = sandbox.stub().resolves(null) // external participant
|
955
956
|
participant.sendRequest = sandbox.stub().resolves()
|
@@ -971,7 +972,8 @@ describe('Parties Tests', () => {
|
|
971
972
|
// eslint-disable-next-line no-unused-vars
|
972
973
|
const [sentTo, _, data, cbHeaders] = participant.sendErrorToParticipant.lastCall.args
|
973
974
|
expect(sentTo).toBe(proxy)
|
974
|
-
expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(
|
975
|
+
expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(source)
|
976
|
+
expect(cbHeaders[Headers.FSPIOP.PROXY]).toBeUndefined()
|
975
977
|
expect(data.errorInformation.errorCode).toBe('2006')
|
976
978
|
})
|
977
979
|
})
|
@@ -46,12 +46,13 @@ describe('PutPartiesErrorService Tests -->', () => {
|
|
46
46
|
oracle.oracleRequest = jest.fn().mockResolvedValue({
|
47
47
|
data: { partyList: [{ fspId: 'fspId' }] }
|
48
48
|
})
|
49
|
-
const
|
49
|
+
const source = 'externalSource'
|
50
|
+
const destination = 'externalDestination'
|
50
51
|
const proxyDest = 'proxyDest'
|
51
52
|
const deps = createMockDeps({ oracle, participant })
|
52
53
|
deps.proxyCache.lookupProxyByDfspId = jest.fn().mockResolvedValue(proxyDest)
|
53
54
|
|
54
|
-
const headers = fixtures.partiesCallHeadersDto({ destination, proxy: 'proxyA' })
|
55
|
+
const headers = fixtures.partiesCallHeadersDto({ source, destination, proxy: 'proxyA' })
|
55
56
|
const params = fixtures.partiesParamsDto()
|
56
57
|
const dataUri = fixtures.dataUriDto()
|
57
58
|
|
@@ -64,7 +65,7 @@ describe('PutPartiesErrorService Tests -->', () => {
|
|
64
65
|
|
65
66
|
const [sentTo, , payload, cbHeaders] = participant.sendErrorToParticipant.mock.lastCall
|
66
67
|
expect(sentTo).toBe(proxyDest)
|
67
|
-
expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(
|
68
|
+
expect(cbHeaders[Headers.FSPIOP.DESTINATION]).toBe(source)
|
68
69
|
expect(payload.errorInformation.errorCode).toBe('2006')
|
69
70
|
})
|
70
71
|
|