account-lookup-service 17.12.5 → 17.12.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.
@@ -25,7 +25,8 @@
25
25
  /* istanbul ignore file */
26
26
  'use strict'
27
27
 
28
- const ErrorHandler = require('@mojaloop/central-services-error-handling')
28
+ const { Factory, Enums } = require('@mojaloop/central-services-error-handling')
29
+ const { errorInfoDto } = require('../../lib/dto')
29
30
 
30
31
  /**
31
32
  * Operations on /participants/{ID}
@@ -39,6 +40,8 @@ module.exports = {
39
40
  * responses: 200, 400, 401, 403, 404, 405, 406, 501, 503
40
41
  */
41
42
  put: function (context, request, h) {
42
- return h.response(ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.NOT_IMPLEMENTED))
43
+ const { code, message, httpStatusCode } = Factory.createFSPIOPError(Enums.FSPIOPErrorCodes.NOT_IMPLEMENTED).apiErrorCode
44
+ return h.response(errorInfoDto(code, message))
45
+ .code(httpStatusCode)
43
46
  }
44
47
  }
package/src/lib/dto.js ADDED
@@ -0,0 +1,38 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ Contributors
12
+ --------------
13
+ This is the official list of the Mojaloop project contributors for this file.
14
+ Names of the original copyright holders (individuals or organizations)
15
+ should be listed with a '*' in the first column. People who have
16
+ contributed from an organization can be listed under the organization
17
+ that actually holds the copyright for their contributions (see the
18
+ Mojaloop Foundation for an example). Those individuals should have
19
+ their names indented and be marked with a '-'. Email address can be added
20
+ optionally within square brackets <email>.
21
+
22
+ * Mojaloop Foundation
23
+ * Eugen Klymniuk <eugen.klymniuk@infitx.com>
24
+
25
+ --------------
26
+ ******/
27
+
28
+ const errorInfoDto = (errorCode, errorDescription, extensionList = null) => ({
29
+ errorInformation: {
30
+ errorCode,
31
+ errorDescription,
32
+ ...(extensionList && { extensionList })
33
+ }
34
+ })
35
+
36
+ module.exports = {
37
+ errorInfoDto
38
+ }
@@ -112,4 +112,25 @@ describe('/participants', () => {
112
112
  expect(response.statusCode).toBe(500)
113
113
  participants.postParticipantsBatch.restore()
114
114
  })
115
+
116
+ it('should return 501 error on PUT /participants/{ID} call [CSI-1694]', async () => {
117
+ // Arrange
118
+ const options = {
119
+ method: 'put',
120
+ url: '/participants/123',
121
+ headers: Helper.defaultSwitchHeaders,
122
+ payload: {
123
+ partyList: [
124
+ { partyId: mock.partyList[0] }
125
+ ]
126
+ }
127
+ }
128
+
129
+ // Act
130
+ const response = await server.inject(options)
131
+
132
+ // Assert
133
+ expect(response.statusCode).toBe(501)
134
+ expect(response.result.errorInformation).toBeDefined()
135
+ })
115
136
  })