account-lookup-service 17.7.0-snapshot.4 → 17.7.0-snapshot.5

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 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.7.0-snapshot.4",
4
+ "version": "17.7.0-snapshot.5",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -44,15 +44,17 @@ const Metrics = require('@mojaloop/central-services-metrics')
44
44
 
45
45
  const Participant = require('../../models/participantEndpoint/facade')
46
46
  const { ERROR_MESSAGES } = require('../../constants')
47
- const { timeoutCallbackDto } = require('./dto')
48
47
  const { logger } = require('../../lib')
49
- const util = require('../../lib/util')
48
+ const { countFspiopError } = require('../../lib/util')
49
+ const { timeoutCallbackDto } = require('./dto')
50
50
 
51
51
  const timeoutInterschemePartiesLookups = async ({ proxyCache, batchSize }) => {
52
+ logger.info('timeoutInterschemePartiesLookups start...', { batchSize })
52
53
  return proxyCache.processExpiredAlsKeys(sendTimeoutCallback, batchSize)
53
54
  }
54
55
 
55
56
  const timeoutProxyGetPartiesLookups = async ({ proxyCache, batchSize }) => {
57
+ logger.info('timeoutProxyGetPartiesLookups start...', { batchSize })
56
58
  return proxyCache.processExpiredProxyGetPartiesKeys(sendTimeoutCallback, batchSize)
57
59
  }
58
60
 
@@ -65,31 +67,32 @@ const sendTimeoutCallback = async (cacheKey) => {
65
67
  let step
66
68
  const [destination, partyType, partyId] = parseCacheKey(cacheKey)
67
69
  const { errorInformation, params, headers, endpointType, span } = await timeoutCallbackDto({ destination, partyId, partyType })
68
- logger.debug('sendTimeoutCallback details:', { destination, partyType, partyId, cacheKey })
70
+ const log = logger.child({ destination, partyId })
71
+ log.verbose('sendTimeoutCallback details:', { errorInformation, cacheKey, partyType })
69
72
 
70
73
  try {
71
74
  step = 'validateParticipant-1'
72
- await validateParticipant(destination)
75
+ await validateParticipant(destination, log)
73
76
  await span.audit({ headers, errorInformation }, AuditEventAction.start)
74
77
  step = 'sendErrorToParticipant-2'
75
78
  await Participant.sendErrorToParticipant(destination, endpointType, errorInformation, headers, params, undefined, span)
76
79
  histTimerEnd({ success: true })
77
80
  } catch (err) {
78
- logger.warn('error in sendTimeoutCallback: ', err)
81
+ log.warn('error in sendTimeoutCallback: ', err)
79
82
  histTimerEnd({ success: false })
80
83
  const fspiopError = reformatFSPIOPError(err)
81
- util.countFspiopError(fspiopError, { operation: 'sendTimeoutCallback', step })
84
+ countFspiopError(fspiopError, { operation: 'sendTimeoutCallback', step })
82
85
 
83
86
  await finishSpan(span, fspiopError)
84
87
  throw fspiopError
85
88
  }
86
89
  }
87
90
 
88
- const validateParticipant = async (fspId) => {
91
+ const validateParticipant = async (fspId, log) => {
89
92
  const participant = await Participant.validateParticipant(fspId)
90
93
  if (!participant) {
91
94
  const errMessage = ERROR_MESSAGES.partyDestinationFspNotFound
92
- logger.error(`error in validateParticipant: ${errMessage}`)
95
+ log.error(`error in validateParticipant: ${errMessage}`)
93
96
  throw createFSPIOPError(FSPIOPErrorCodes.DESTINATION_FSP_ERROR, errMessage)
94
97
  }
95
98
  return participant