account-lookup-service 17.9.0-snapshot.1 → 17.9.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.9.0](https://github.com/mojaloop/account-lookup-service/compare/v17.8.1...v17.9.0) (2025-04-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * **csi-1350:** refactored oracleRequest ([#546](https://github.com/mojaloop/account-lookup-service/issues/546)) ([3f76ef7](https://github.com/mojaloop/account-lookup-service/commit/3f76ef7f712590e82bcb5bf7e49a643b2aae63f3))
11
+
5
12
  ### [17.8.1](https://github.com/mojaloop/account-lookup-service/compare/v17.8.0...v17.8.1) (2025-04-07)
6
13
 
7
14
 
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.9.0-snapshot.1",
4
+ "version": "17.9.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -408,6 +408,7 @@ const _getOracleEndpointByTypeCurrencyAndSubId = async (partyIdType, partyIdenti
408
408
  * @returns {object} - response from the oracle
409
409
  */
410
410
  const oracleBatchRequest = async (headers, method, requestPayload, type, payload) => {
411
+ let step = 'getOracleEndpoint'
411
412
  try {
412
413
  let oracleEndpointModel
413
414
  let url
@@ -416,33 +417,37 @@ const oracleBatchRequest = async (headers, method, requestPayload, type, payload
416
417
  } else {
417
418
  oracleEndpointModel = await oracleEndpointCached.getOracleEndpointByType(type)
418
419
  }
419
- if (oracleEndpointModel.length > 0) {
420
- if (oracleEndpointModel.length > 1) {
421
- for (const record of oracleEndpointModel) {
422
- if (record.isDefault) {
423
- url = record.value + Enums.EndPoints.FspEndpointTemplates.ORACLE_PARTICIPANTS_BATCH
424
- break
425
- }
420
+
421
+ if (!Array.isArray(oracleEndpointModel) || oracleEndpointModel.length === 0) {
422
+ const errMessage = `Oracle type:${type} not found`
423
+ logger.warn(errMessage)
424
+ throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR, errMessage)
425
+ }
426
+
427
+ if (oracleEndpointModel.length > 1) {
428
+ for (const record of oracleEndpointModel) {
429
+ if (record.isDefault) {
430
+ url = record.value + Enums.EndPoints.FspEndpointTemplates.ORACLE_PARTICIPANTS_BATCH
431
+ break
426
432
  }
427
- } else {
428
- url = oracleEndpointModel[0].value + Enums.EndPoints.FspEndpointTemplates.ORACLE_PARTICIPANTS_BATCH
429
433
  }
430
- logger.debug(`Oracle endpoints: ${url}`)
431
- return await sendHttpRequest({
432
- url,
433
- headers,
434
- source: headers[Headers.FSPIOP.SOURCE],
435
- destination: headers[Headers.FSPIOP.DESTINATION] || Config.HUB_NAME,
436
- method,
437
- payload
438
- })
439
434
  } else {
440
- logger.error(`Oracle type:${type} not found`)
441
- throw ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.ADD_PARTY_INFO_ERROR, `Oracle type:${type} not found`)
435
+ url = oracleEndpointModel[0].value + Enums.EndPoints.FspEndpointTemplates.ORACLE_PARTICIPANTS_BATCH
442
436
  }
437
+ logger.verbose(`Oracle endpoint: ${url}`)
438
+
439
+ step = 'sendHttpRequest'
440
+ return await sendHttpRequest({
441
+ url,
442
+ headers,
443
+ source: headers[Headers.FSPIOP.SOURCE],
444
+ destination: headers[Headers.FSPIOP.DESTINATION] || Config.HUB_NAME,
445
+ method,
446
+ payload
447
+ })
443
448
  } catch (err) {
444
449
  logger.error('error in oracleBatchRequest: ', err)
445
- throw ErrorHandler.Factory.reformatFSPIOPError(err)
450
+ throw countFspiopError(err, { operation: 'oracleBatchRequest', step })
446
451
  }
447
452
  }
448
453