account-lookup-service 17.13.0-snapshot.6 → 17.13.0-snapshot.8
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 +3 -1
- package/src/domain/parties/services/PutPartiesErrorService.js +1 -1
- package/src/domain/parties/services/PutPartiesService.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.8",
|
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
|
-
const callbackHeaders = BasePartiesService.createErrorCallbackHeaders(headers, params
|
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({
|
@@ -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
|
}
|
@@ -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
|
|
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
|
|