account-lookup-service 15.6.0-iso.4 → 15.6.0-iso.6

Sign up to get free protection for your applications and to get access to all the features.
package/.ncurc.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  reject: [
3
3
  # TODO: v6+ (ref: https://github.com/sindresorhus/get-port/releases/tag/v6.0.0) is an ESM library and thus not compatible with CommonJS. Future story needed to resolve.
4
4
  "get-port",
5
- "@mojaloop/central-services-shared" ## need to remove before merging proxyCache functionality to main
5
+ "@mojaloop/sdk-standard-components" ## version 19.1.0 caused lots of failed unit tests with the error - TypeError: Cannot read properties of undefined (reading 'createFSPIOPError')
6
6
  ]
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": "15.6.0-iso.4",
4
+ "version": "15.6.0-iso.6",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -95,12 +95,12 @@
95
95
  "@mojaloop/central-services-health": "15.0.0",
96
96
  "@mojaloop/central-services-logger": "11.5.1",
97
97
  "@mojaloop/central-services-metrics": "12.0.8",
98
- "@mojaloop/central-services-shared": "18.10.0-snapshot.4",
98
+ "@mojaloop/central-services-shared": "18.10.1-snapshot.3",
99
99
  "@mojaloop/central-services-stream": "11.3.1",
100
100
  "@mojaloop/database-lib": "11.0.6",
101
101
  "@mojaloop/event-sdk": "14.1.1",
102
102
  "@mojaloop/inter-scheme-proxy-cache-lib": "2.3.0",
103
- "@mojaloop/ml-schema-transformer-lib": "1.1.1",
103
+ "@mojaloop/ml-schema-transformer-lib": "1.1.3",
104
104
  "@mojaloop/sdk-standard-components": "19.0.0",
105
105
  "@now-ims/hapi-now-auth": "2.1.0",
106
106
  "ajv": "8.17.1",
@@ -33,7 +33,9 @@ const ErrorHandler = require('@mojaloop/central-services-error-handling')
33
33
  const JwsSigner = require('@mojaloop/sdk-standard-components').Jws.signer
34
34
  const Metrics = require('@mojaloop/central-services-metrics')
35
35
  const Config = require('../../lib/config')
36
+ const { logger } = require('../../lib')
36
37
  const { hubNameRegex } = require('../../lib/util').hubNameConfig
38
+
37
39
  const uriRegex = /(?:^.*)(\/(participants|parties|quotes|transfers)(\/.*)*)$/
38
40
 
39
41
  /**
@@ -47,7 +49,7 @@ const defineJwsSigner = (config, headers, requestedEndpoint) => {
47
49
  // We need below 2 headers for JWS
48
50
  headers[Enums.Http.Headers.FSPIOP.HTTP_METHOD] = headers[Enums.Http.Headers.FSPIOP.HTTP_METHOD] || Enums.Http.RestMethods.PUT
49
51
  headers[Enums.Http.Headers.FSPIOP.URI] = headers[Enums.Http.Headers.FSPIOP.URI] || uriRegex.exec(requestedEndpoint)[1]
50
- Logger.isDebugEnabled && Logger.debug('JWS is enabled, getting JwsSigner')
52
+ logger.debug('JWS is enabled, getting JwsSigner')
51
53
  jwsSigner = new JwsSigner({
52
54
  logger: Logger,
53
55
  signingKey: config.JWS_SIGNING_KEY
@@ -83,10 +85,10 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
83
85
  try {
84
86
  requestedEndpoint = await Util.Endpoints.getEndpoint(Config.SWITCH_ENDPOINT, requestedParticipant, endpointType, options || undefined)
85
87
  histTimerEndGetParticipantEndpoint({ success: true, endpointType, participantName: requestedParticipant })
86
- Logger.isDebugEnabled && Logger.debug(`participant endpoint url: ${requestedEndpoint} for endpoint type ${endpointType}`)
88
+ logger.debug('participant requestedEndpoint and endpointType: ', { requestedEndpoint, endpointType })
87
89
  } catch (err) {
88
90
  histTimerEndGetParticipantEndpoint({ success: false, endpointType, participantName: requestedParticipant })
89
- Logger.isErrorEnabled && Logger.error(`error in getEndpoint: ${err?.stack}`)
91
+ logger.warn('error in getEndpoint: ', err)
90
92
  throw ErrorHandler.Factory.reformatFSPIOPError(err)
91
93
  }
92
94
 
@@ -115,8 +117,7 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
115
117
  hubNameRegex,
116
118
  apiType: Config.API_TYPE
117
119
  }
118
- Logger.isDebugEnabled && Logger.debug(`participant - sendRequest params: ${JSON.stringify(params)}`)
119
-
120
+ logger.debug('participant - sendRequest params:', { params })
120
121
  params.jwsSigner = defineJwsSigner(Config, headers, requestedEndpoint)
121
122
 
122
123
  const resp = await Util.Request.sendRequest(params)
@@ -124,8 +125,7 @@ exports.sendRequest = async (headers, requestedParticipant, endpointType, method
124
125
  return resp
125
126
  } catch (err) {
126
127
  histTimerEndSendRequestToParticipant({ success: false, endpointType, participantName: requestedParticipant })
127
- Logger.isErrorEnabled && Logger.error(`error in sendRequest: ${err?.stack}`)
128
-
128
+ logger.warn('error in sendRequest: ', err)
129
129
  throw ErrorHandler.Factory.reformatFSPIOPError(err)
130
130
  }
131
131
  }
@@ -150,7 +150,7 @@ exports.validateParticipant = async (fsp) => {
150
150
  return resp
151
151
  } catch (err) {
152
152
  histTimerEnd({ success: false })
153
- Logger.isErrorEnabled && Logger.error(`error in validateParticipant: ${err?.stack}`)
153
+ logger.warn('error in validateParticipant: ', err)
154
154
  throw ErrorHandler.Factory.reformatFSPIOPError(err)
155
155
  }
156
156
  }
@@ -190,7 +190,7 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
190
190
  histTimerEndGetParticipantEndpoint({ success: true, endpointType, participantName })
191
191
  } catch (err) {
192
192
  histTimerEndGetParticipantEndpoint({ success: false, endpointType, participantName })
193
- Logger.isWarnEnabled && Logger.warn(`error in getEndpoint: ${err?.message}`)
193
+ logger.warn('error in getEndpoint: ', err)
194
194
  throw ErrorHandler.Factory.reformatFSPIOPError(err)
195
195
  }
196
196
 
@@ -227,15 +227,14 @@ exports.sendErrorToParticipant = async (participantName, endpointType, errorInfo
227
227
  protocolVersions,
228
228
  apiType: Config.API_TYPE
229
229
  }
230
- Logger.isDebugEnabled && Logger.debug(`participant - sendErrorToParticipant params: ${JSON.stringify(params)}`)
231
-
230
+ logger.debug('participant - sendErrorToParticipant params: ', { params })
232
231
  params.jwsSigner = defineJwsSigner(Config, clonedHeaders, requesterErrorEndpoint)
233
232
 
234
233
  await Util.Request.sendRequest(params)
235
234
  histTimerEndSendRequestToParticipant({ success: true, endpointType, participantName })
236
235
  } catch (err) {
237
236
  histTimerEndSendRequestToParticipant({ success: false, endpointType, participantName })
238
- Logger.isWarnEnabled && Logger.warn(`error in sendErrorToParticipant: ${err?.message}`)
237
+ logger.warn('error in sendErrorToParticipant: ', err)
239
238
  throw ErrorHandler.Factory.reformatFSPIOPError(err)
240
239
  }
241
240
  }
@@ -9,8 +9,7 @@ describe('timeoutCallbackDto Tests -->', () => {
9
9
  config.API_TYPE = realApiType
10
10
  })
11
11
 
12
- // todo: unskip after fixing transformLib SubId issue for parties.putError
13
- test.skip('should produce ISO payload', async () => {
12
+ test('should produce ISO payload', async () => {
14
13
  config.API_TYPE = API_TYPES.iso20022
15
14
  const destination = 'D1'
16
15
  const partyId = 'P1'