account-lookup-service 17.5.0 → 17.6.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.
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
## [17.6.0](https://github.com/mojaloop/account-lookup-service/compare/v17.5.0...v17.6.0) (2025-03-19)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* **csi-1244:** add DELETE participants validation ([#539](https://github.com/mojaloop/account-lookup-service/issues/539)) ([773baa1](https://github.com/mojaloop/account-lookup-service/commit/773baa154acd38051c61b10201d6fca6a33e614e))
|
11
|
+
|
5
12
|
## [17.5.0](https://github.com/mojaloop/account-lookup-service/compare/v17.4.1...v17.5.0) (2025-03-18)
|
6
13
|
|
7
14
|
|
package/config/default.json
CHANGED
package/package.json
CHANGED
@@ -625,8 +625,7 @@ const deleteParticipants = async (headers, params, method, query, cache) => {
|
|
625
625
|
try {
|
626
626
|
const fspiopError = ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.DELETE_PARTY_INFO_ERROR)
|
627
627
|
const errorCallbackEndpointType = params.SubId ? Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_SUB_ID_PUT_ERROR : Enums.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR
|
628
|
-
await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType,
|
629
|
-
fspiopError.toApiErrorObject(Config.ERROR_HANDLING), headers, params)
|
628
|
+
await participant.sendErrorToParticipant(headers[Enums.Http.Headers.FSPIOP.SOURCE], errorCallbackEndpointType, fspiopError.toApiErrorObject(Config.ERROR_HANDLING), headers, params)
|
630
629
|
util.countFspiopError(fspiopError, { operation: 'deleteParticipants', step })
|
631
630
|
} catch (exc) {
|
632
631
|
// We can't do anything else here- we _must_ handle all errors _within_ this function because
|
package/src/lib/config.js
CHANGED
@@ -173,7 +173,8 @@ const config = {
|
|
173
173
|
API_DOC_ENDPOINTS_ENABLED: RC.API_DOC_ENDPOINTS_ENABLED || false,
|
174
174
|
FEATURE_ENABLE_EXTENDED_PARTY_ID_TYPE: RC.FEATURE_ENABLE_EXTENDED_PARTY_ID_TYPE || false,
|
175
175
|
PROTOCOL_VERSIONS: getProtocolVersions(DEFAULT_PROTOCOL_VERSION, RC.PROTOCOL_VERSIONS),
|
176
|
-
PROXY_CACHE_CONFIG: RC.PROXY_CACHE
|
176
|
+
PROXY_CACHE_CONFIG: RC.PROXY_CACHE,
|
177
|
+
DELETE_PARTICIPANT_VALIDATION_ENABLED: RC.DELETE_PARTICIPANT_VALIDATION_ENABLED || false
|
177
178
|
}
|
178
179
|
|
179
180
|
if (config.JWS_SIGN) {
|
@@ -59,6 +59,8 @@ exports.oracleRequest = async (headers, method, params = {}, query = {}, payload
|
|
59
59
|
const currency = (payload && payload.currency) ? payload.currency : (query && query.currency) ? query.currency : undefined
|
60
60
|
const partySubIdOrType = (params && params.SubId) ? params.SubId : (query && query.partySubIdOrType) ? query.partySubIdOrType : undefined
|
61
61
|
const isGetRequest = method.toUpperCase() === Enums.Http.RestMethods.GET
|
62
|
+
const isDeleteRequest = method.toUpperCase() === Enums.Http.RestMethods.DELETE
|
63
|
+
|
62
64
|
if (currency && partySubIdOrType && isGetRequest) {
|
63
65
|
url = await _getOracleEndpointByTypeCurrencyAndSubId(partyIdType, partyIdentifier, currency, partySubIdOrType, assertPendingAcquire)
|
64
66
|
} else if (currency && isGetRequest) {
|
@@ -110,6 +112,41 @@ exports.oracleRequest = async (headers, method, params = {}, query = {}, payload
|
|
110
112
|
return cachedOracleFspResponse
|
111
113
|
}
|
112
114
|
|
115
|
+
if (isDeleteRequest && Config.DELETE_PARTICIPANT_VALIDATION_ENABLED) {
|
116
|
+
// If the request is a DELETE request, we need to ensure that the participant belongs to the requesting FSP
|
117
|
+
const getOracleResponse = await request.sendRequest({
|
118
|
+
url,
|
119
|
+
headers,
|
120
|
+
source: headers[Enums.Http.Headers.FSPIOP.SOURCE],
|
121
|
+
destination: headers[Enums.Http.Headers.FSPIOP.DESTINATION] || Config.HUB_NAME,
|
122
|
+
method: Enums.Http.RestMethods.GET,
|
123
|
+
payload,
|
124
|
+
hubNameRegex
|
125
|
+
})
|
126
|
+
|
127
|
+
if (getOracleResponse.status === Enums.Http.ReturnCodes.OK.CODE) {
|
128
|
+
const participant = getOracleResponse.data
|
129
|
+
if (participant?.partyList?.length > 0) {
|
130
|
+
const party = participant.partyList[0]
|
131
|
+
if (party.fspId === headers[Enums.Http.Headers.FSPIOP.SOURCE]) {
|
132
|
+
return await request.sendRequest({
|
133
|
+
url,
|
134
|
+
headers,
|
135
|
+
source: headers[Enums.Http.Headers.FSPIOP.SOURCE],
|
136
|
+
destination: headers[Enums.Http.Headers.FSPIOP.DESTINATION] || Config.HUB_NAME,
|
137
|
+
method: method.toUpperCase(),
|
138
|
+
payload,
|
139
|
+
hubNameRegex
|
140
|
+
})
|
141
|
+
} else {
|
142
|
+
throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.DELETE_PARTY_INFO_ERROR, `The party ${partyIdType}:${partyIdentifier} does not belong to the requesting FSP`)
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND)
|
148
|
+
}
|
149
|
+
|
113
150
|
return await request.sendRequest({
|
114
151
|
url,
|
115
152
|
headers,
|