{"version":3,"sources":["../src/lib/transformer.ts","../src/lib/utils/index.ts","../src/types/type-guards.ts","../src/types/index.ts","../src/lib/transforms/index.ts","../src/lib/createTransformer.ts","../src/lib/logger.ts","../src/mappings/fspiopiso20022/index.ts","../src/mappings/fspiopiso20022/discovery.ts","../src/mappings/fspiopiso20022/quotes.ts","../src/mappings/fspiopiso20022/fxQuotes.ts","../src/mappings/fspiopiso20022/transfers.ts","../src/mappings/fspiopiso20022/fxTransfers.ts","../src/lib/transforms/pipeline.ts","../src/lib/transforms/extensions.ts","../src/lib/validation/index.ts","../src/lib/validation/validator.ts","../src/facades/fspiop.ts","../src/facades/fspiopiso20022.ts","../src/index.ts"],"sourcesContent":["/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { ITransformer, Source, Target, TransformFunctionOptions } from '../types';\nimport { DataMapper, State } from '../types/map-transform';\nimport { createTransformer } from './createTransformer';\n\nexport const transformFn = async (source: Partial<Source>, options: TransformFunctionOptions): Promise<Partial<Target>> => {\n  const { mapping, mapTransformOptions, mapperOptions, logger } = options;\n  try {\n    const transformer = createTransformer(mapping, { mapTransformOptions });\n    return transformer.transform(source, { mapperOptions });\n  } catch (error) {\n    logger.error('Error transforming payload with supplied mapping', { error, source, mapping });\n    throw error;\n  }\n};\n\nexport class Transformer implements ITransformer {\n  mapper: DataMapper;\n  \n  constructor(mapper: DataMapper) {\n    this.mapper = mapper;\n  }\n\n  async transform(source: Partial<Source>, { mapperOptions }: { mapperOptions?: State } = {}): Promise<Partial<Target>> {\n    return this.mapper(source, mapperOptions) as Promise<Partial<Target>>;\n  }\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nconst idGenerator = require('@mojaloop/central-services-shared').Util.id;\nconst { CreateFSPIOPErrorFromErrorCode } = require('@mojaloop/central-services-error-handling')\nimport * as ilpPacket from 'ilp-packet';\nimport { ConfigOptions, GenericObject, ID_GENERATOR_TYPE, Primitive, isContextLogger } from '../../types';\nimport { TransformDefinition } from '../../types/map-transform';\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\n\n// improve: use enums from cs-shared\n// We only cover the states that are externally visible\nconst fspiopToIsoTransferStateMap: GenericObject = {\n  COMMITTED: 'COMM',\n  RESERVED: 'RESV',\n  RECEIVED: 'RECV',\n  ABORTED: 'ABOR'\n}\n\n// Generates a unique ID\nexport const generateID = (idGenType: ID_GENERATOR_TYPE = ID_GENERATOR_TYPE.ulid, config: GenericObject = {}): string => {\n  switch (idGenType) {\n    case ID_GENERATOR_TYPE.ulid:\n    case ID_GENERATOR_TYPE.uuid:\n      return idGenerator({ ...config, type: idGenType })();\n    default:\n      return idGenerator({ ...config, type: ID_GENERATOR_TYPE.ulid })();\n  }\n}\n\n// improve: import enums from cs-shared\nexport const isPersonPartyIdType = (partyIdType: string) => partyIdType && !['BUSINESS', 'ALIAS', 'DEVICE'].includes(partyIdType);\n\nexport const isEmptyObject = (data: unknown) => {\n  return typeof data === 'object' && data !== null && Object.keys(data as object).length === 0;\n}\n\n// Safely sets nested property in an object\nexport const setProp = (obj: unknown, path: string, value: unknown) => {\n  const pathParts = path.split('.');\n  let current = obj as GenericObject;\n  for (let i = 0; i < pathParts.length - 1; i++) {\n    const part = pathParts[i] as string;\n    if (!current[part]) {\n      current[part] = {};\n    }\n    current = current[part];\n  }\n  current[pathParts[pathParts.length - 1] as string] = value;\n}\n\n// Safely gets nested property from an object\nexport const getProp = (obj: unknown, path: string): unknown  => {\n  const pathParts = path.split('.');\n  let current = obj;\n  for (const part of pathParts) {\n    if (typeof current === 'object' && current !== null && part in current) {\n      current = (current as GenericObject)[part];\n    } else {\n      return undefined;\n    }\n  }\n  return current;\n}\n\n// Safely checks if nested property exists in an object\nexport const hasProp = (obj: unknown, path: string): boolean => {\n  const pathParts = path.split('.');\n  let current = obj;\n  for (const part of pathParts) {\n    if (typeof current === 'object' && current !== null && part in current) {\n      current = (current as GenericObject)[part];\n    } else {\n      return false;\n    }\n  }\n\n  return true;\n}\n\n// Merges deeply nested objects\n// e.g { a: { b: 1 } } and { a: { c: 2 } } => { a: { b: 1, c: 2 } }\nexport const deepMerge = (target: GenericObject, source: GenericObject): GenericObject => {\n  for (const key in source) {\n    if (source[key] instanceof Object && key in target) {\n      Object.assign(source[key], deepMerge(target[key], source[key]));\n    }\n  }\n  Object.assign(target, source);\n  return target;\n}\n\n// Gets the description for an error code\nexport const getDescrForErrCode = (code: string | number): string => {\n  try {\n    const errorCode = Number.parseInt(code as string);\n    const errorCreated = CreateFSPIOPErrorFromErrorCode(errorCode);\n    return errorCreated?.apiErrorCode?.type?.description;\n  } catch (error) {\n    return 'Unknown error';\n  }\n}\n\n// Gets the ILP packet condition from an ILP packet\nexport const getIlpPacketCondition = (inputIlpPacket: string): string => {\n  const binaryPacket = Buffer.from(inputIlpPacket, 'base64');\n  const decoded = ilpPacket.deserializeIlpPrepare(binaryPacket);\n  return decoded?.executionCondition?.toString('base64url');\n}\n\n// Converts FSPIOP transfer state to FSPIOP ISO20022 transfer state\nexport const toIsoTransferState = (fspiopState: string): string | undefined => {\n  if (!fspiopState) return undefined;\n  const isoState = fspiopToIsoTransferStateMap[fspiopState] as string;\n  if (!isoState) throw new Error(`toIsoTransferState: Unknown FSPIOP transfer state: ${fspiopState}`);\n  return isoState;\n}\n\n// Converts FSPIOP ISO20022 transfer state to FSPIOP transfer state\nexport const toFspiopTransferState = (isoState: string): string | undefined => {\n  if (!isoState) return undefined;\n  for (const [key, value] of Object.entries(fspiopToIsoTransferStateMap)) {\n    if (value === isoState) return key;\n  }\n  throw new Error(`toFspiopTransferState: Unknown ISO20022 transfer state: ${isoState}`);\n}\n\n// Validates configuration options\nexport const validateConfig = (config: ConfigOptions): void => {\n  if (hasProp(config, 'logger') && !isContextLogger(config.logger as ContextLogger)) {\n    throw new Error('Invalid logger provided');\n  }\n}\n\n// Unrolls extensions array into an object\n// e.g [ { key: 'key1', value: 'value1' }, { key: 'key2', value: 'value2' } ] => { key1: 'value1', key2: 'value2' }\nexport const unrollExtensions = (extensions: Array<{ key: string, value: unknown }>): GenericObject => {\n  const unrolled: GenericObject = {};\n  for (const { key, value } of extensions) {\n    setProp(unrolled, key, value);\n  }\n  return unrolled;\n}\n\n// Rolls up unmapped properties (i.e properties in source object not found in the mapping values - r.h.s) into extensions array\n// e.g { a: 1, b: 2 } => [ { key: 'a', value: 1 }, { key: 'b', value: 2 } ]\nexport const rollUpUnmappedAsExtensions = (source: GenericObject, mapping: TransformDefinition): Array<{ key: string, value: unknown }> => {\n  const extensions = [];\n  const mappingObj = mapping = typeof mapping === 'string' ? JSON.parse(mapping) : mapping;\n  // we are only interested in body and $context mappings\n  const mappingValues = extractValues(mappingObj)\n    .map((value) => String(value))\n    .filter((value) => value.startsWith('body.') || value.startsWith('$context.'))\n    .map((value) => value.replace('body.', ''))\n    .map((value) => value.replace(/\\$context\\.[a-zA-Z0-9]+./, ''));\n  // for the source, we are only interested in body\n  const sourcePaths = getObjectPaths(source.body);\n\n  for (const path of sourcePaths) {\n    if (!mappingValues.includes(path)) {\n      const value = getProp(source.body, path);\n      extensions.push({ key: path, value });\n    }\n  }\n\n  return extensions;\n}\n\n// Extracts all leaf values from an object including values nested in arrays and objects\n// e.g { a: { b: 1, c: { d: 2, e: [ 3, 4 ] } } } => [1, 2, 3, 4]\nexport const extractValues = (obj: GenericObject) => {\n  const values: Primitive[] = [];\n\n  function recurse(current: GenericObject | Primitive | null) {\n    if (Array.isArray(current)) {\n      current.forEach(item => recurse(item));\n    } else if (typeof current === 'object' && current !== null) {\n      Object.values(current).forEach(value => recurse(value));\n    } else { \n      values.push((current as Primitive));\n    }\n  }\n\n  recurse(obj);\n  return values;\n}\n\n// Gets all paths to leaf nodes in an object\n// e.g { a: { b: 1, c: { d: 2 } } } => ['a.b', 'a.c.d']\nexport const getObjectPaths = (obj: GenericObject, prefix = '') => {\n  let paths: string[] = [];\n\n  for (const key in obj) {\n    if (obj.hasOwnProperty(key)) {\n      const path = prefix ? `${prefix}.${key}` : key;\n      if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n        paths = paths.concat(getObjectPaths(obj[key], path));\n      } else {\n        paths.push(path);\n      }\n    }\n  }\n\n  return paths;\n}\n\n// Removes duplicates from an array of objects based on a unique key\n// e.g [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }, { id: 1, name: 'Alice' } ] => [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob' } ]\nexport const deduplicateObjectsArray = (arr: GenericObject[], uniqueKey: string): GenericObject[] => {\n  const seen = new Set();\n  return arr.reduce((acc: GenericObject[], obj) => {\n    if (!seen.has(obj[uniqueKey])) {\n      seen.add(obj[uniqueKey]);\n      acc.push(obj);\n    }\n    return acc;\n  }, []);\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { FspiopPutQuotesSource, FspiopSource, IsoSource, FspiopPutPartiesSource, FspiopPutPartiesErrorSource } from '.';\n\nexport const isContextLogger = (logger: ContextLogger): logger is ContextLogger => {\n  return (\n    'info' in logger &&\n    'error' in logger &&\n    'warn' in logger &&\n    'verbose' in logger &&\n    'debug' in logger &&\n    'silly' in logger &&\n    'audit' in logger &&\n    'trace' in logger\n  );\n};\n\nconst baseFspiopGuards = {\n  isSource: (source: FspiopSource): source is FspiopSource => {\n    return !!(source.body);\n  }\n};\n\nconst baseIsoGuards = {\n  isSource: (source: IsoSource): source is IsoSource => {\n    return !!(source.body);\n  }\n};\n\nconst FSPIOP = {\n  parties: {\n    put: {\n      isSource: (source: FspiopPutPartiesSource): source is FspiopPutPartiesSource => {\n        return !!(source.body && (source.headers?.['fspiop-source'] && source.headers['fspiop-destination']) && (source.params.IdPath || (source.params?.Type && source.params.ID)));\n      }\n    },\n    putError: {\n      isSource: (source: FspiopPutPartiesErrorSource): source is FspiopPutPartiesErrorSource => {\n        return !!(source.body && (source.headers?.['fspiop-source'] && source.headers['fspiop-destination']) && (source.params.IdPath || (source.params?.Type && source.params.ID)));\n      }\n    }\n  },\n  quotes: {\n    post: baseFspiopGuards,\n    put: {\n      isSource: (source: FspiopPutQuotesSource): source is FspiopPutQuotesSource => {\n        return !!(source.body && source.params?.ID &&  ((source.$context?.isoPostQuote) || (source.headers?.['fspiop-source'] && source.headers['fspiop-destination'])));\n      }\n    },\n    putError: baseFspiopGuards\n  },\n  transfers: {\n    post: baseFspiopGuards,\n    patch: baseFspiopGuards,\n    put: baseFspiopGuards,\n    putError: baseFspiopGuards\n  },\n  fxQuotes: {\n    post: baseFspiopGuards,\n    put: baseFspiopGuards,\n    putError: baseFspiopGuards\n  },\n  fxTransfers: {\n    post: baseFspiopGuards,\n    patch: baseFspiopGuards,\n    put: baseFspiopGuards,\n    putError: baseFspiopGuards\n  }\n};\n\nconst FSPIOPISO20022 = {\n  parties: {\n    put: baseIsoGuards,\n    putError: baseIsoGuards\n  },\n  quotes: {\n    post: baseIsoGuards,\n    put: baseIsoGuards,\n    putError: baseIsoGuards\n  },\n  transfers: {\n    post: baseIsoGuards,\n    patch: baseIsoGuards,\n    put: baseIsoGuards,\n    putError: baseIsoGuards\n  },\n  fxQuotes: {\n    post: baseIsoGuards,\n    put: baseIsoGuards,\n    putError: baseIsoGuards\n  },\n  fxTransfers: {\n    post: baseIsoGuards,\n    patch: baseIsoGuards,\n    put: baseIsoGuards,\n    putError: baseIsoGuards\n  }\n};\n\nexport const TypeGuards = { FSPIOP, FSPIOPISO20022 };\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { AsyncTransformer, Options, State, TransformDefinition, Transformer } from './map-transform';\n\nexport enum HTTP_METHOD {\n  GET = 'GET',\n  PUT = 'PUT',\n  POST = 'POST',\n  DELETE = 'DELETE',\n  PATCH = 'PATCH'\n}\n\nexport enum API_NAME {\n  FSPIOP = 'fspiop',\n  ISO20022 = 'iso'\n}\n\nexport interface ITransformer {\n  transform(source: Partial<Source>, { mapperOptions }: { mapperOptions?: State }): Promise<Partial<Target>>;\n}\n\nexport type FacadeOptions = { overrideMapping?: TransformDefinition, mapTransformOptions?: Options, mapperOptions?: State, validateTarget?: boolean };\n\nexport type FspiopFacadeOptions = FacadeOptions & { unrollExtensions?: boolean };\nexport type FspiopFacadeFunction = (source: Source, options: FacadeOptions) => Promise<IsoTarget>;\nexport type IsoFacadeOptions = FacadeOptions & { rollUpUnmappedAsExtensions?: boolean };\nexport type IsoFacadeFunction = (source: IsoSource, options: FacadeOptions) => Promise<Partial<Target>>;\n\nexport type TransformFunctionOptions = { mapping: TransformDefinition, mapperOptions?: State, mapTransformOptions?: Options, logger: ContextLogger };\nexport type CreateTransformerOptions = { mapTransformOptions?: Options };\n\nexport enum ID_GENERATOR_TYPE {\n  ulid = 'ulid',\n  uuid = 'uuid'\n}\n\nexport interface ICustomTransforms {\n  [key: string | symbol]: Transformer | AsyncTransformer\n}\n\nexport type ConfigOptions = {\n  logger?: ContextLogger;\n  isTestingMode?: boolean;\n  unrollExtensions?: boolean;\n  rollUpUnmappedAsExtensions?: boolean;\n  validateTarget?: boolean;\n}\n\nexport type Headers = {\n  'fspiop-source': string;\n  'fspiop-destination': string;\n}\n\nexport type Params = {\n  Type?: string;\n  ID?: string;\n  SubId?: string;\n}\n\nexport type PartyIdParamsSource = {\n  Type: string;\n  ID: string;\n  SubId?: string;\n  IdPath?: string; // format: IdType/IdValue or IdType/IdValue/SubIdValue\n} | {\n  Type?: string;\n  ID?: string;\n  SubId?: string;\n  IdPath: string; // format: IdType/IdValue or IdType/IdValue/SubIdValue\n}\n\nexport type PartyIdParamsTarget = {\n  Type: string;\n  ID: string;\n  SubId?: string;\n}\n\nexport type Source = {\n  body: GenericObject;\n  headers?: Headers;\n  params?: Partial<Params>;\n}\n\nexport type Target = {\n  body: GenericObject;\n  headers: Headers;\n  params: Params;\n};\n\nexport type FspiopSource = Pick<Source, 'body'>;\nexport type FspiopTarget = Pick<Target, 'body'>;\nexport type FspiopPutQuotesSource = { body: GenericObject, params: Pick<Params, 'ID'>,  $context?: { isoPostQuote: GenericObject }, headers?: Headers } | {body: GenericObject, params: Pick<Params, 'ID'>, headers: Headers, $context?: { isoPostQuote: GenericObject } };\nexport type FspiopPutQuotesTarget = { body: GenericObject, headers: Headers, params: Pick<Params, 'ID'> };\nexport type FspiopPutPartiesSource = { body: GenericObject, headers: Headers, params: PartyIdParamsSource };\nexport type FspiopPutPartiesTarget = { body: GenericObject, headers: Headers, params: PartyIdParamsTarget };\nexport type FspiopPutPartiesErrorSource = { body: GenericObject, headers: Headers, params: PartyIdParamsSource };\nexport type FspiopPutPartiesErrorTarget = { body: GenericObject, headers: Headers, params: PartyIdParamsTarget };\nexport type FspiopPostTransfersSource = { body: GenericObject,  $context?: { isoPostQuoteResponse: GenericObject }, headers?: Headers } | {body: GenericObject, params: Pick<Params, 'ID'>, headers: Headers, $context?: { isoPostQuoteResponse: GenericObject } };\n\nexport type IsoSource = Pick<Source, 'body'>;\nexport type IsoTarget = Pick<Target, 'body'>;\n\n/* eslint-disable  @typescript-eslint/no-explicit-any */\nexport type GenericObject =  Record<string, any>;\nexport type Primitive = string | number | boolean;\n\n// Pipeline types\nexport type PipelineStep = ({ source, target, options, logger }: { source: GenericObject, target: GenericObject, options: GenericObject, logger: ContextLogger }) => GenericObject;\nexport type PipelineStepsConfig = { [key: string]: GenericObject };\nexport type PipelineOptions = {\n  pipelineSteps: PipelineStep[];\n  logger: ContextLogger;\n  [key: string]: any;\n}\n\n\nexport type Json = string | number | boolean | Json[] | { [key: string]: Json };\nexport type LogContext = Json | string | null;\nexport const logLevelsMap = {\n  error: 'error',\n  warn: 'warn',\n  info: 'info',\n  verbose: 'verbose',\n  debug: 'debug',\n  silly: 'silly',\n  audit: 'audit',\n  trace: 'trace',\n  perf: 'perf',\n} as const;\n\nexport const logLevelValues = Object.values(logLevelsMap);\nexport type LogLevel = (typeof logLevelValues)[number];\nexport * from './type-guards';\n\nexport type Request = {\n  path: string;\n  method: HTTP_METHOD;\n  headers: GenericObject;\n  body: GenericObject;\n  query: GenericObject;\n}\n\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { ICustomTransforms } from '../../types';\nimport { Options, State } from '../../types/map-transform';\nimport { generateID as genID, getDescrForErrCode, getIlpPacketCondition, isEmptyObject, isPersonPartyIdType, toFspiopTransferState, toIsoTransferState } from '../utils';\n\nexport const CustomTransforms: ICustomTransforms = {\n  generateID: (options: Options) => () => (data: unknown, state: State) => {\n    return genID();\n  },\n\n  datetimeNow: (options: Options) => () => (data: unknown, state: State) => {\n    return new Date().toISOString(); // Not sure if this is the correct format\n  },\n\n  isPersonParty: (options: Options) => () => (data: unknown, state: State) => {\n    return isPersonPartyIdType(data as string);\n  },\n\n  isNotPersonParty: (options: Options) => () => (data: unknown, state: State) => {\n    return !isPersonPartyIdType(data as string);\n  },\n\n  isNotEmpty: (options: Options) => () => (data: unknown, state: State) => {\n    return data && !isEmptyObject(data);\n  },\n\n  fspiopErrorDescrForCode: (options: Options) => () => (data: unknown, state: State) => {\n    return getDescrForErrCode(data as string);\n  },\n\n  ilpPacketToCondition: (options: Options) => () => (data: unknown, state: State) => {\n    return getIlpPacketCondition(data as string);\n  },\n\n  toFspiopTransferState: (options: Options) => () => (data: unknown, state: State) => {\n    return toFspiopTransferState(data as string);\n  },\n\n  toIsoTransferState: (options: Options) => () => (data: unknown, state: State) => {\n    return toIsoTransferState(data as string);\n  },\n\n  toIsoErrorDescription: (options: Options) => () => (data: unknown, state: State) => {\n    // In ISO20022, error descriptions are limited to 105 characters\n    const dataStr = data as string;\n    return dataStr.length > 105 ? dataStr.substring(0, 105) : dataStr;\n  },\n\n  supportedCurrenciesToString: (options: Options) => () => (data: unknown, state: State) => {\n    return data && Array.isArray(data) && data.length > 0 ? data[0] : data;\n  },\n\n  toArray: (options: Options) => () => (data: unknown, state: State) => {\n    if (data) {\n      return Array.isArray(data) ? data : [data];\n    }\n\n    return undefined;\n  }\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n/* eslint-disable  @typescript-eslint/no-require-imports */\nconst mapTransform = require('map-transform-cjs').default;\nimport { TransformDefinition } from '../types/map-transform';\nimport { CreateTransformerOptions, ITransformer } from '../types';\nimport { Transformer } from './transformer';\nimport { CustomTransforms } from './transforms';\n\nexport const createTransformer = (mapping: TransformDefinition, options: CreateTransformerOptions = {}): ITransformer => {\n  const { mapTransformOptions } = options;\n  const mergedOptions = { ...mapTransformOptions, transformers: { ...mapTransformOptions?.transformers, ...CustomTransforms } };\n  mapping = typeof mapping === 'string' ? JSON.parse(mapping) : mapping;\n  return new Transformer(mapTransform(mapping, mergedOptions));\n};\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { loggerFactory } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { LogContext, LogLevel, logLevelsMap } from '../types';\n\nexport const createLogger = (context: LogContext, logLevel: LogLevel) => {\n  const log = loggerFactory(context);\n  log.setLevel(logLevel);\n  return log;\n};\n\nexport const logger = createLogger('MLST', process.env.MLST_LOG_LEVEL as LogLevel || logLevelsMap.warn);\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO 20022 to FSPIOP mappings\n\nexport * from './discovery'\nexport * from './quotes'\nexport * from './fxQuotes'\nexport * from './transfers'\nexport * from './fxTransfers'\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO220022 to FSPIOP mappings\n\nexport const discovery = {\n  parties: {\n    put: `{\n      \"$noDefaults\": true,\n      \"headers.fspiop-source\": \"body.Assgnmt.Assgnr.Agt.FinInstnId.Othr.Id\",\n      \"headers.fspiop-destination\": \"body.Assgnmt.Assgne.Agt.FinInstnId.Othr.Id\",\n      \"params.IdPath\": \"body.Rpt.OrgnlId\",\n      \"body.party.partyIdInfo.partyIdType\": { \"$alt\": [ \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.OrgId.Othr.SchmeNm.Prtry\", \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.PrvtId.Othr.SchmeNm.Prtry\", \"body.Rpt.UpdtdPtyAndAcctId.Pty.PrvtId.Othr.Id\" ] },\n      \"body.party.partyIdInfo.partyIdentifier\": { \"$alt\": [\"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.OrgId.Othr.Id\", \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.PrvtId.Othr.Id\"] },\n      \"body.party.partyIdInfo.fspId\": \"body.Rpt.UpdtdPtyAndAcctId.Agt.FinInstnId.Othr.Id\",\n      \"body.party.name\": \"body.Rpt.UpdtdPtyAndAcctId.Pty.Nm\",\n      \"body.party.supportedCurrencies\": [\"body.Rpt.UpdtdPtyAndAcctId.Acct.Ccy\", { \"$transform\": \"toArray\" }]\n    }`,\n    putError: `{\n      \"$noDefaults\": true,\n      \"body.errorInformation.errorDescription\": [\"body.Rpt.Rsn.Cd\", { \"$transform\": \"fspiopErrorDescrForCode\" }],\n      \"body.errorInformation.errorCode\": \"body.Rpt.Rsn.Cd\",\n      \"headers.fspiop-source\": \"body.Assgnmt.Assgnr.Agt.FinInstnId.Othr.Id\",\n      \"headers.fspiop-destination\": \"body.Assgnmt.Assgne.Agt.FinInstnId.Othr.Id\",\n      \"params.IdPath\": \"body.Rpt.OrgnlId\"\n    }`\n  }\n}\n\n// FSPIOP to FSPIOP ISO220022 mappings\n\nexport const discovery_reverse = {\n  parties: {\n    put: `{\n      \"$noDefaults\": true,\n      \"body.Assgnmt.MsgId\": { \"$transform\": \"generateID\" },\n      \"body.Assgnmt.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n      \"body.Rpt.Vrfctn\": [{ \"$transform\": \"fixed\", \"value\": true }],\n      \"body.Assgnmt.Assgnr.Agt.FinInstnId.Othr.Id\": \"headers.fspiop-source\",\n      \"body.Assgnmt.Assgne.Agt.FinInstnId.Othr.Id\": \"headers.fspiop-destination\",\n      \"body.Rpt.OrgnlId\": \"params.IdPath\",\n      \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.OrgId.Othr.SchmeNm.Prtry\": [\"body.party.partyIdInfo.partyIdType\", { \"$filter\": \"isNotPersonParty\" }],\n      \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.PrvtId.Othr.SchmeNm.Prtry\": [\"body.party.partyIdInfo.partyIdType\", { \"$filter\": \"isPersonParty\" }],\n      \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.OrgId.Othr.Id\": [\"body.party.partyIdInfo.partyIdentifier\", { \"$filter\": \"isNotPersonParty\" }],\n      \"body.Rpt.UpdtdPtyAndAcctId.Pty.Id.PrvtId.Othr.Id\": [\"body.party.partyIdInfo.partyIdentifier\", { \"$filter\": \"isPersonParty\" }],\n      \"body.Rpt.UpdtdPtyAndAcctId.Agt.FinInstnId.Othr.Id\": \"body.party.partyIdInfo.fspId\",\n      \"body.Rpt.UpdtdPtyAndAcctId.Pty.Nm\": \"body.party.name\",\n      \"body.Rpt.UpdtdPtyAndAcctId.Acct.Ccy\": [\"body.party.supportedCurrencies\", { \"$transform\": \"supportedCurrenciesToString\" }]\n    }`,\n    putError: `{\n      \"$noDefaults\": true,\n      \"body.Rpt.Rsn.Cd\": \"body.errorInformation.errorCode\",\n      \"body.Assgnmt.MsgId\": { \"$transform\": \"generateID\" },\n      \"body.Assgnmt.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n      \"body.Assgnmt.Assgnr.Agt.FinInstnId.Othr.Id\": \"headers.fspiop-source\",\n      \"body.Assgnmt.Assgne.Agt.FinInstnId.Othr.Id\": \"headers.fspiop-destination\",\n      \"body.Rpt.OrgnlId\": \"params.IdPath\",\n      \"body.Rpt.Vrfctn\": [{ \"$transform\": \"fixed\", \"value\": false }]\n    }`\n  }\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO 20022 to FSPIOP mappings\n\nexport const quotes = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.quoteId\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"body.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.transactionId\": \"body.CdtTrfTxInf.PmtId.EndToEndId\",\n    \"body.transactionRequestId\": \"body.CdtTrfTxInf.PmtId.InstrId\",\n    \"body.payee.partyIdInfo.partyIdType\": { \"$alt\": [ \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.SchmeNm.Prtry\", \"body.CdtTrfTxInf.Cdtr.Id.PrvtId.Othr.SchmeNm.Prtry\" ] },\n    \"body.payee.partyIdInfo.partyIdentifier\": { \"$alt\": [ \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\", \"body.CdtTrfTxInf.Cdtr.Id.PrvtId.Othr.Id\" ] },\n    \"body.payee.partyIdInfo.fspId\": \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\",\n    \"body.payee.name\": \"body.CdtTrfTxInf.Cdtr.Name\",\n    \"body.payee.supportedCurrencies\": [\"body.CdtTrfTxInf.CdtrAcct.Ccy\", { \"$transform\": \"toArray\" }],\n    \"body.payer.partyIdInfo.partyIdType\": { \"$alt\": [ \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.SchmeNm.Prtry\", \"body.CdtTrfTxInf.Dbtr.Id.PrvtId.Othr.SchmeNm.Prtry\" ] },\n    \"body.payer.partyIdInfo.partyIdentifier\": { \"$alt\": [ \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\", \"body.CdtTrfTxInf.Dbtr.Id.PrvtId.Othr.Id\" ] },\n    \"body.payer.partyIdInfo.fspId\": \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\",\n    \"body.payer.name\": \"body.CdtTrfTxInf.Dbtr.Name\",\n    \"body.payer.supportedCurrencies\": [\"body.CdtTrfTxInf.DbtrAcct.Ccy\", { \"$transform\": \"toArray\" }],\n    \"body.amount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.amount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.transactionType.scenario\": \"body.CdtTrfTxInf.Purp.Prtry\",\n    \"body.transactionType.refundInfo.originalTransactionId\": \"body.CdtTrfTxInf.PmtId.InstrId\"\n  }`,\n  // TODO: Support payeeFspCommission.currency and payeeFspCommission.amount\n  //       when CdtTrfTxInf.IntrBkSttlmAmt.ChrgsInf.Tp.Cd is \"COMM\"\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"params.ID\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"headers.fspiop-destination\": \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\",\n    \"headers.fspiop-source\": \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\",\n    \"body.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.transferAmount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.transferAmount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.payeeReceiveAmount.currency\": \"body.CdtTrfTxInf.InstdAmt.Ccy\",\n    \"body.payeeReceiveAmount.amount\": \"body.CdtTrfTxInf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\",\n    \"body.payeeFspFee.currency\": \"body.CdtTrfTxInf.ChrgsInf.Amt.Ccy\",\n    \"body.payeeFspFee.amount\": \"body.CdtTrfTxInf.ChrgsInf.Amt.ActiveOrHistoricCurrencyAndAmount\",\n    \"body.ilpPacket\": \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\",\n    \"body.condition\": [ \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\", { \"$transform\": \"ilpPacketToCondition\" }]\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.errorInformation.errorCode\": \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\",\n    \"body.errorInformation.errorDescription\": \"body.TxInfAndSts.StsRsnInf.AddtlInf\"\n  }`\n}\n\n// FSPIOP to FSPIOP ISO 20022 mappings\n\nexport const quotes_reverse = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"body.quoteId\",\n    \"body.CdtTrfTxInf.PmtId.EndToEndId\": \"body.transactionId\",\n    \"body.CdtTrfTxInf.PmtId.InstrId\": \"body.transactionRequestId\",\n    \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.SchmeNm.Prtry\": [\"body.payee.partyIdInfo.partyIdType\", { \"$filter\": \"isNotPersonParty\" }],\n    \"body.CdtTrfTxInf.Cdtr.Id.PrvtId.Othr.SchmeNm.Prtry\": [\"body.payee.partyIdInfo.partyIdType\", { \"$filter\": \"isPersonParty\" }],\n    \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\": [\"body.payee.partyIdInfo.partyIdentifier\", { \"$filter\": \"isNotPersonParty\" }],\n    \"body.CdtTrfTxInf.Cdtr.Id.PrvtId.Othr.Id\": [\"body.payee.partyIdInfo.partyIdentifier\", { \"$filter\": \"isPersonParty\" }],\n    \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\": \"body.payee.partyIdInfo.fspId\",\n    \"body.CdtTrfTxInf.Cdtr.Name\": \"body.payee.name\",\n    \"body.CdtTrfTxInf.CdtrAcct.Ccy\": [\"body.payee.supportedCurrencies\", { \"$transform\": \"supportedCurrenciesToString\" }],\n    \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.SchmeNm.Prtry\": [\"body.payer.partyIdInfo.partyIdType\", { \"$filter\": \"isNotPersonParty\" }],\n    \"body.CdtTrfTxInf.Dbtr.Id.PrvtId.Othr.SchmeNm.Prtry\": [\"body.payer.partyIdInfo.partyIdType\", { \"$filter\": \"isPersonParty\" }],\n    \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\": [\"body.payer.partyIdInfo.partyIdentifier\", { \"$filter\": \"isNotPersonParty\" }],\n    \"body.CdtTrfTxInf.Dbtr.Id.PrvtId.Othr.Id\": [\"body.payer.partyIdInfo.partyIdentifier\", { \"$filter\": \"isPersonParty\" }],\n    \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\": \"body.payer.partyIdInfo.fspId\",\n    \"body.CdtTrfTxInf.Dbtr.Name\": \"body.payer.name\",\n    \"body.CdtTrfTxInf.DbtrAcct.Ccy\": [\"body.payer.supportedCurrencies\", { \"$transform\": \"supportedCurrenciesToString\" }],\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.amount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.amount.amount\",\n    \"body.CdtTrfTxInf.Purp.Prtry\": \"body.transactionType.scenario\",\n    \"body.CdtTrfTxInf.PmtId.InstrId\": \"body.transactionType.refundInfo.originalTransactionId\"\n  }`,\n  // TODO: Support payeeFspCommission.currency and payeeFspCommission.amount\n  //       when CdtTrfTxInf.IntrBkSttlmAmt.ChrgsInf.Tp.Cd is \"COMM\"\n  putTesting: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"params.ID\",\n    \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\", \"headers.fspiop-destination\" ]},\n    \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\", \"headers.fspiop-destination\" ]},\n    \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\", \"headers.fspiop-source\" ] },\n    \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\", \"headers.fspiop-source\" ]},\n    \"body.CdtTrfTxInf.ChrgBr\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.ChrgBr\", { \"$transform\": \"fixed\", \"value\": \"SHAR\" } ] },\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.transferAmount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.transferAmount.amount\",\n    \"body.CdtTrfTxInf.InstdAmt.Ccy\": \"body.payeeReceiveAmount.currency\",\n    \"body.CdtTrfTxInf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\": \"body.payeeReceiveAmount.amount\",\n    \"body.CdtTrfTxInf.ChrgsInf.Amt.Ccy\": \"body.payeeFspFee.currency\",\n    \"body.CdtTrfTxInf.ChrgsInf.Amt.ActiveOrHistoricCurrencyAndAmount\": \"body.payeeFspFee.amount\",\n    \"body.CdtTrfTxInf.ChrgsInf.Agt.FinInstnId.Othr.Id\": { \"$alt\": [ \"$context.isoPostQuote.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\", { \"$transform\": \"fixed\", \"value\": \"Testing\" } ] },\n    \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\": \"body.ilpPacket\"\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"params.ID\",\n    \"body.CdtTrfTxInf.Dbtr\": \"$context.isoPostQuote.CdtTrfTxInf.Dbtr\",\n    \"body.CdtTrfTxInf.DbtrAgt\": \"$context.isoPostQuote.CdtTrfTxInf.DbtrAgt\",\n    \"body.CdtTrfTxInf.Cdtr\": \"$context.isoPostQuote.CdtTrfTxInf.Cdtr\",\n    \"body.CdtTrfTxInf.CdtrAgt\": \"$context.isoPostQuote.CdtTrfTxInf.CdtrAgt\",\n    \"body.CdtTrfTxInf.ChrgBr\": \"$context.isoPostQuote.CdtTrfTxInf.ChrgBr\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.transferAmount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.transferAmount.amount\",\n    \"body.CdtTrfTxInf.InstdAmt.Ccy\": \"body.payeeReceiveAmount.currency\",\n    \"body.CdtTrfTxInf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\": \"body.payeeReceiveAmount.amount\",\n    \"body.CdtTrfTxInf.ChrgsInf.Amt.Ccy\": \"body.payeeFspFee.currency\",\n    \"body.CdtTrfTxInf.ChrgsInf.Amt.ActiveOrHistoricCurrencyAndAmount\": \"body.payeeFspFee.amount\",\n    \"body.CdtTrfTxInf.ChrgsInf.Agt\": \"$context.isoPostQuote.CdtTrfTxInf.CdtrAgt\",\n    \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\": \"body.ilpPacket\"\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\": \"body.errorInformation.errorCode\",\n    \"body.TxInfAndSts.StsRsnInf.AddtlInf\": [ \"body.errorInformation.errorDescription\", { \"$transform\": \"toIsoErrorDescription\" } ]\n  }`\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO20022 to FSPIOP mappings\n\nexport const fxQuotes = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.conversionTerms.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.conversionRequestId\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"body.conversionTerms.conversionId\": \"body.CdtTrfTxInf.PmtId.InstrId\",\n    \"body.conversionTerms.determiningTransferId\": \"body.CdtTrfTxInf.PmtId.EndToEndId\",\n    \"body.conversionTerms.initiatingFsp\": \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\",\n    \"body.conversionTerms.counterPartyFsp\": \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\",\n    \"body.conversionTerms.sourceAmount.currency\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\",\n    \"body.conversionTerms.sourceAmount.amount\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\",\n    \"body.conversionTerms.targetAmount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.conversionTerms.targetAmount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.conversionTerms.amountType\": \"body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf\"\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"params.ID\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"body.condition\": \"body.CdtTrfTxInf.VrfctnOfTerms.Sh256Sgntr\", \n    \"body.conversionTerms.conversionId\": \"body.CdtTrfTxInf.PmtId.InstrId\",\n    \"body.conversionTerms.determiningTransferId\": \"body.CdtTrfTxInf.PmtId.EndToEndId\",\n    \"body.conversionTerms.initiatingFsp\": \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\",\n    \"body.conversionTerms.counterPartyFsp\": \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\",\n    \"body.conversionTerms.sourceAmount.currency\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\",\n    \"body.conversionTerms.sourceAmount.amount\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\",\n    \"body.conversionTerms.targetAmount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.conversionTerms.targetAmount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.conversionTerms.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.conversionTerms.amountType\": \"body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf\"\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.errorInformation.errorCode\": \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\",\n    \"body.errorInformation.errorDescription\": \"body.TxInfAndSts.StsRsnInf.AddtlInf\"\n  }`\n}\n\n// FSPIOP to FSPIOP ISO20022 mappings\n\nexport const fxQuotes_reverse = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.conversionTerms.expiration\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"body.conversionRequestId\",\n    \"body.CdtTrfTxInf.PmtId.InstrId\": \"body.conversionTerms.conversionId\",\n    \"body.CdtTrfTxInf.PmtId.EndToEndId\": \"body.conversionTerms.determiningTransferId\",\n    \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr.Id.OrgId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",  \n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.Id.OrgId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\": \"body.conversionTerms.sourceAmount.currency\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\": { \"$alt\": [ \"body.conversionTerms.sourceAmount.amount\", { \"$transform\": \"fixed\", \"value\": \"0\" } ] },\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.conversionTerms.targetAmount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": { \"$alt\": [ \"body.conversionTerms.targetAmount.amount\", { \"$transform\": \"fixed\", \"value\": \"0\" } ] },\n    \"body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf\": \"body.conversionTerms.amountType\"\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.conversionTerms.expiration\",\n    \"body.CdtTrfTxInf.VrfctnOfTerms.Sh256Sgntr\": \"body.condition\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"params.ID\",\n    \"body.CdtTrfTxInf.PmtId.InstrId\": \"body.conversionTerms.conversionId\",\n    \"body.CdtTrfTxInf.PmtId.EndToEndId\": \"body.conversionTerms.determiningTransferId\",\n    \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr.Id.OrgId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.Othr.Id\": \"body.conversionTerms.initiatingFsp\",\n    \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",  \n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.Id.OrgId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.Othr.Id\": \"body.conversionTerms.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\": \"body.conversionTerms.sourceAmount.currency\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\": \"body.conversionTerms.sourceAmount.amount\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.conversionTerms.targetAmount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.conversionTerms.targetAmount.amount\",\n    \"body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf\": \"body.conversionTerms.amountType\"\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\": \"body.errorInformation.errorCode\",\n    \"body.TxInfAndSts.StsRsnInf.AddtlInf\": [ \"body.errorInformation.errorDescription\", { \"$transform\": \"toIsoErrorDescription\" } ]\n  }`\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO220022 to FSPIOP mappings\n\nexport const transfers = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.transferId\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"body.payeeFsp\": \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\",\n    \"body.payerFsp\": \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\",\n    \"body.amount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.amount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.ilpPacket\": \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\",\n    \"body.condition\": [\"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\", { \"$transform\": \"ilpPacketToCondition\" }]\n  }`,\n  patch: `{\n    \"$noDefaults\": \"true\",\n    \"body.completedTimestamp\": \"body.TxInfAndSts.PrcgDt.DtTm\",\n    \"body.transferState\": [\"body.TxInfAndSts.TxSts\", { \"$transform\": \"toFspiopTransferState\" }]\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.fulfilment\": \"body.TxInfAndSts.ExctnConf\",\n    \"body.completedTimestamp\": \"body.TxInfAndSts.PrcgDt.DtTm\",\n    \"body.transferState\": [\"body.TxInfAndSts.TxSts\", { \"$transform\": \"toFspiopTransferState\" }]\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.errorInformation.errorCode\": \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\",\n    \"body.errorInformation.errorDescription\": \"body.TxInfAndSts.StsRsnInf.AddtlInf\"\n  }`\n}\n\n// FSPIOP to FSPIOP ISO20022 mappings\n\nexport const transfers_reverse = {\n  postTesting: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"body.transferId\",\n    \"body.CdtTrfTxInf.ChrgBr\": { \"$alt\": [ \"$context.isoPostQuoteResponse.CdtTrfTxInf.ChrgBr\", { \"$transform\": \"fixed\", \"value\": \"SHAR\" } ] },\n    \"body.CdtTrfTxInf.Cdtr.Id.OrgId.Othr.Id\": \"body.payeeFsp\",\n    \"body.CdtTrfTxInf.Dbtr.Id.OrgId.Othr.Id\": \"body.payerFsp\",\n    \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\": \"body.payeeFsp\",\n    \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\": \"body.payerFsp\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.amount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.amount.amount\",\n    \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\": \"body.ilpPacket\"\n  }`,\n  post: `{\n      \"$noDefaults\": \"true\",\n      \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n      \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n      \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n      \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n      \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n      \"body.CdtTrfTxInf.PmtId.TxId\": \"body.transferId\",\n      \"body.CdtTrfTxInf.ChrgBr\": \"$context.isoPostQuoteResponse.CdtTrfTxInf.ChrgBr\",\n      \"body.CdtTrfTxInf.Cdtr\": \"$context.isoPostQuoteResponse.CdtTrfTxInf.Cdtr\",\n      \"body.CdtTrfTxInf.Dbtr\": \"$context.isoPostQuoteResponse.CdtTrfTxInf.Dbtr\",\n      \"body.CdtTrfTxInf.CdtrAgt.FinInstnId.Othr.Id\": \"body.payeeFsp\",\n      \"body.CdtTrfTxInf.DbtrAgt.FinInstnId.Othr.Id\": \"body.payerFsp\",\n      \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.amount.currency\",\n      \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.amount.amount\",\n      \"body.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket\": \"body.ilpPacket\"\n  }`,\n  patch: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.PrcgDt.DtTm\": \"body.completedTimestamp\",\n    \"body.TxInfAndSts.TxSts\": [\"body.transferState\", { \"$transform\": \"toIsoTransferState\" }]\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.ExctnConf\": \"body.fulfilment\",\n    \"body.TxInfAndSts.PrcgDt.DtTm\": \"body.completedTimestamp\",\n    \"body.TxInfAndSts.TxSts\": [\"body.transferState\", { \"$transform\": \"toIsoTransferState\" }]\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\": \"body.errorInformation.errorCode\",\n    \"body.TxInfAndSts.StsRsnInf.AddtlInf\": [ \"body.errorInformation.errorDescription\", { \"$transform\": \"toIsoErrorDescription\" } ]\n  }`\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\n// FSPIOP ISO20022 to FSPIOP mappings\n\nexport const fxTransfers = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.expiration\": \"body.GrpHdr.PmtInstrXpryDtTm\",\n    \"body.commitRequestId\": \"body.CdtTrfTxInf.PmtId.TxId\",\n    \"body.determiningTransferId\": \"body.CdtTrfTxInf.PmtId.EndToEndId\",\n    \"body.initiatingFsp\": \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\",\n    \"body.counterPartyFsp\": \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\",\n    \"body.sourceAmount.currency\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\",\n    \"body.sourceAmount.amount\": \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\",\n    \"body.targetAmount.currency\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\",\n    \"body.targetAmount.amount\": \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\",\n    \"body.condition\": \"body.CdtTrfTxInf.VrfctnOfTerms.Sh256Sgntr\"\n  }`,\n  patch: `{\n    \"$noDefaults\": \"true\",\n    \"body.completedTimestamp\": \"body.TxInfAndSts.PrcgDt.DtTm\",\n    \"body.conversionState\": [\"body.TxInfAndSts.TxSts\", { \"$transform\": \"toFspiopTransferState\" }]\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.fulfilment\": \"body.TxInfAndSts.ExctnConf\",\n    \"body.completedTimestamp\": \"body.TxInfAndSts.PrcgDt.DtTm\",\n    \"body.conversionState\": [\"body.TxInfAndSts.TxSts\", { \"$transform\": \"toFspiopTransferState\" }]\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.errorInformation.errorCode\": \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\",\n    \"body.errorInformation.errorDescription\": \"body.TxInfAndSts.StsRsnInf.AddtlInf\"\n  }`\n}\n\n// FSPIOP to FSPIOP ISO20022 mappings\n\nexport const fxTransfers_reverse = {\n  post: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.GrpHdr.NbOfTxs\": { \"$transform\": \"fixed\", \"value\": \"1\" },\n    \"body.GrpHdr.SttlmInf.SttlmMtd\": { \"$transform\": \"fixed\", \"value\": \"CLRG\" },\n    \"body.GrpHdr.PmtInstrXpryDtTm\": \"body.expiration\",\n    \"body.CdtTrfTxInf.PmtId.TxId\": \"body.commitRequestId\",\n    \"body.CdtTrfTxInf.PmtId.EndToEndId\": \"body.determiningTransferId\",\n    \"body.CdtTrfTxInf.Dbtr.FinInstnId.Othr.Id\": \"body.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr.Id.OrgId.Othr.Id\": \"body.initiatingFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt.FinInstnId.Othr.Id\": \"body.initiatingFsp\",\n    \"body.CdtTrfTxInf.Cdtr.FinInstnId.Othr.Id\": \"body.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr.Id.OrgId.Othr.Id\": \"body.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt.FinInstnId.Othr.Id\": \"body.counterPartyFsp\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.Ccy\": \"body.sourceAmount.currency\",\n    \"body.CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt.ActiveOrHistoricCurrencyAndAmount\": \"body.sourceAmount.amount\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.Ccy\": \"body.targetAmount.currency\",\n    \"body.CdtTrfTxInf.IntrBkSttlmAmt.ActiveCurrencyAndAmount\": \"body.targetAmount.amount\",\n    \"body.CdtTrfTxInf.VrfctnOfTerms.Sh256Sgntr\": \"body.condition\"\n  }`,\n  patch: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.PrcgDt.DtTm\": \"body.completedTimestamp\",\n    \"body.TxInfAndSts.TxSts\": [\"body.conversionState\", { \"$transform\": \"toIsoTransferState\" }]\n  }`,\n  put: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.ExctnConf\": \"body.fulfilment\",\n    \"body.TxInfAndSts.PrcgDt.DtTm\": \"body.completedTimestamp\",\n    \"body.TxInfAndSts.TxSts\": [\"body.conversionState\", { \"$transform\": \"toIsoTransferState\" }]\n  }`,\n  putError: `{\n    \"$noDefaults\": \"true\",\n    \"body.GrpHdr.MsgId\": { \"$transform\": \"generateID\" },\n    \"body.GrpHdr.CreDtTm\": { \"$transform\": \"datetimeNow\" },\n    \"body.TxInfAndSts.StsRsnInf.Rsn.Prtry\": \"body.errorInformation.errorCode\",\n    \"body.TxInfAndSts.StsRsnInf.AddtlInf\": [ \"body.errorInformation.errorDescription\", { \"$transform\": \"toIsoErrorDescription\" } ]\n  }`\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { GenericObject, PipelineOptions } from '../../types';\n\n// Runs a pipeline of transformation steps on the source object and returns the target object\nexport const runPipeline = async (source: GenericObject, target: GenericObject, options: PipelineOptions): Promise<GenericObject> => {\n  if (!options.hasOwnProperty('pipelineSteps') || !Array.isArray(options.pipelineSteps)) {\n    throw new Error('runPipeline: options.pipelineSteps must be an array');\n  }\n  const { pipelineSteps, logger, ...stepOptions } = options;\n  for (const step of pipelineSteps) {\n    target = await step({ source, target, options: stepOptions, logger });\n  }\n  return target;\n};\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { GenericObject } from '../../types';\nimport { deepMerge, unrollExtensions, rollUpUnmappedAsExtensions, setProp, deduplicateObjectsArray, getProp, hasProp } from '../utils';\n\n// Unrolls extensions from the source object and merges them with the target object\nexport const applyUnrollExtensions = (params: { source: GenericObject, target: GenericObject, options: GenericObject, logger: ContextLogger }) => {\n  const { source, target, options, logger } = params;\n  let extensionListProperty; \n  // determine the property path to the extension list\n  if (options.applyUnrollExtensions?.extensionListProperty) {\n    extensionListProperty = options.applyUnrollExtensions?.extensionListProperty;\n  } else if (source.body?.errorInformation) {\n    extensionListProperty = 'body.errorInformation.extensionList';\n  } else {\n    extensionListProperty = 'body.extensionList';\n  }\n  const extension = getProp(source, `${extensionListProperty}.extension`);\n  if (!options.unrollExtensions || !extension) {\n    logger.debug('Skipping unrollExtensions', { source, target, options });\n    return target;\n  }\n  \n  const unrolled = unrollExtensions(extension as any);\n  logger.debug('Unrolled extensions', { source, unrolled });\n  // we merge the unrolled extensions into the target's body only\n  target.body = deepMerge(target.body, unrolled);\n  return target;\n}\n\n// Rolls up unmapped properties from the source object into extensions and adds them to the target object's extensionList\nexport const applyRollUpUnmappedAsExtensions = (params: { source: GenericObject, target: GenericObject, options: GenericObject, logger: ContextLogger }) => {\n  const { source, target, options: { mapping },  options, logger } = params;\n  \n  if (!options.rollUpUnmappedAsExtensions) {\n    logger.debug('Skipping rollUpUnmappedAsExtensions', { source, target, mapping, options });\n    return target;\n  }\n  const extensions = rollUpUnmappedAsExtensions(source, mapping);\n  logger.debug('Rolled up unmapped properties into extensions', { source, mapping, extensions });\n\n  if (extensions.length === 0) {\n    logger.debug('No unmapped properties to roll up', { source, mapping });\n    return target;\n  }\n\n  // determine the property path for the extension list\n  let extensionListProperty; \n  if (options.applyRollUpUnmappedAsExtensions?.extensionListProperty) {\n    extensionListProperty = options.applyRollUpUnmappedAsExtensions?.extensionListProperty;\n  } else if (target.body?.errorInformation) {\n    extensionListProperty = 'body.errorInformation.extensionList';\n  } else {\n    extensionListProperty = 'body.extensionList';\n  }\n  const extensionProperty = `${extensionListProperty}.extension`;\n\n  if (!hasProp(target, extensionProperty)) {\n    setProp(target, extensionProperty, []);\n  }\n  \n  let allExtensions = getProp(target, extensionProperty) as GenericObject[];\n  allExtensions.push(...extensions);\n  allExtensions = deduplicateObjectsArray(allExtensions, 'key');\n  setProp(target, extensionProperty, allExtensions);\n\n  logger.debug('Rolled up unmapped properties into extensions', { source, target, mapping, extensions });\n\n  return target;\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport path from 'path';\nimport NodeCache from 'node-cache';\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { API_NAME, GenericObject, HTTP_METHOD } from '../../types';\nimport { Validator } from './validator';\n\nconst validatorsCache = new NodeCache();\n\nexport const getApiSpecPath = (apiName: API_NAME, version: string): string => {\n  let specFile: string;\n\n  switch (apiName) {\n    case API_NAME.FSPIOP:\n      specFile = `../docs/fspiop-rest-v${version}-openapi3-snippets.yaml`;\n      break;\n    case API_NAME.ISO20022:\n      specFile = `../docs/fspiop-rest-v${version}-ISO20022-openapi3-snippets.yaml`;\n      break;\n    default:\n      throw new Error(`Invalid API name: ${apiName} in getApiSpecPath`);\n  }\n\n  const specPath = path.join(path.dirname(require.resolve('@mojaloop/api-snippets')), specFile);\n  return specPath;\n}\n\n/**\n * Returns true or throws if the target object fails validation against the API spec\n */\nexport const validateBody = async (body: GenericObject, spec: { name: API_NAME, version: string, path: string, method: HTTP_METHOD }): Promise<boolean> => {\n  const apiSpecPath = getApiSpecPath(spec.name, spec.version);\n\n  let validator: Validator = validatorsCache.get(apiSpecPath) as Validator;\n  if (!validator) {\n    validator = new Validator(apiSpecPath);\n    await validator.initialize();\n    validatorsCache.set(apiSpecPath, validator);\n  }\n\n  return validator.validateBody({ body, path: spec.path, method: spec.method }) as boolean;\n}\n \nexport const applyTargetValidation = async (params: { source: GenericObject, target: GenericObject, options: GenericObject, logger: ContextLogger }) => {\n  const { target, options, logger } = params;\n\n  if (!options.validateTarget) {\n    logger.debug('Skipping target validation', { target, options });\n    return target;\n  }\n\n  const targetSpec = options.applyTargetValidation?.targetSpec;\n  if (!targetSpec || !targetSpec.name || !targetSpec.path || !targetSpec.method) {\n    logger.error('Missing or invalid targetSpec in applyTargetValidation options', { target, targetSpec });\n    throw new Error('Missing or invalid targetSpec in applyTargetValidation options');\n  }\n\n  await validateBody(target.body, targetSpec);\n\n  return target;\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n\n * Infitx\n - Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport SwaggerParser from '@apidevtools/swagger-parser';\nimport { OpenAPIValidator, Document } from 'openapi-backend';\nimport { ErrorObject, Options } from 'ajv';\nimport stringify from 'fast-safe-stringify';\nimport { Request } from '../../types';\n\nexport class Validator {\n  apiDoc: string;\n  apiSpec: Document;\n  apiValidator: OpenAPIValidator;\n  ajvOpts: Options = { allErrors: true, coerceTypes: true, strict: false }\n\n  /**\n   * @param apiDoc - The path to the OpenAPI document or the document itself\n   */\n  constructor(apiDoc: string) {\n    this.apiDoc = apiDoc;\n    this.apiSpec = {} as Document;\n    this.apiValidator = {} as OpenAPIValidator;\n  }\n\n  async initialize() {\n    this.apiSpec = await SwaggerParser.validate(this.apiDoc) as Document;\n    this.apiValidator = new OpenAPIValidator({ definition: this.apiSpec, ajvOpts: this.ajvOpts });\n  }\n\n  validateRequest(request: Request, returnErrors: boolean = false): boolean | ErrorObject[] {\n    const validation = this.apiValidator.validateRequest(request);\n\n    if (validation.errors && validation.errors.length > 0) {\n      if (returnErrors) return validation.errors;\n      throw new Error(`Validation errors: ${stringify(validation.errors)}`);\n    }\n\n    return true;\n  }\n\n  validateBody(partialRequest: Pick<Request, 'body' | 'path' | 'method'>, returnErrors: boolean = false): boolean | ErrorObject[] {\n    const { body, path, method } = partialRequest;\n    const validation = this.apiValidator.validateRequest({ path, method, body, headers: {} });\n\n    if (validation.errors) {\n      const bodyErrors = validation.errors.filter((error: any) => error.instancePath === '/requestBody');\n      if (bodyErrors && bodyErrors.length > 0) {\n        if (returnErrors) return bodyErrors;\n        throw new Error(`Validation errors: ${stringify(bodyErrors)}`);\n      }\n    }\n\n    return true;\n  }\n\n  validateHeaders(partialRequest: Pick<Request, 'headers' | 'path' | 'method'>, returnErrors: boolean = false): boolean | ErrorObject[] {\n    const { headers, path, method } = partialRequest;\n    const validation = this.apiValidator.validateRequest({ path, method, headers, body: {} });\n\n    if (validation.errors) {\n      const headersErrors = validation.errors.filter((error: any) => error.instancePath === '/header');\n      if (headersErrors && headersErrors.length > 0) {\n        if (returnErrors) return headersErrors;\n        throw new Error(`Validation errors: ${stringify(headersErrors)}`);\n      }\n    }\n\n    return true;\n  }\n}\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport { logger as defaultLogger, transformFn } from '../lib';\nimport { getProp, hasProp, setProp, validateConfig } from '../lib/utils';\nimport { FSPIO20022PMappings } from '../mappings';\nimport { fxTransfers_reverse } from '../mappings/fspiopiso20022';\nimport {\n  ConfigOptions,\n  FspiopPutPartiesErrorSource,\n  FspiopPutPartiesSource,\n  FspiopPutQuotesSource,\n  FspiopSource,\n  FspiopPostTransfersSource,\n  IsoTarget,\n  FspiopFacadeOptions,\n  TypeGuards,\n  isContextLogger,\n  API_NAME\n} from '../types';\nimport { runPipeline } from '../lib/transforms/pipeline';\nimport { applyUnrollExtensions } from '../lib/transforms/extensions';\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { TransformDefinition } from '../types/map-transform';\nimport { applyTargetValidation } from '../lib/validation';\n\nconst ISO20022Version = '2.0';\nconst { discovery_reverse, quotes_reverse, transfers_reverse, fxQuotes_reverse } = FSPIO20022PMappings;\nconst Config: ConfigOptions = { logger: defaultLogger, isTestingMode: false, unrollExtensions: false, validateTarget: false }; \nconst afterTransformSteps = [ applyUnrollExtensions, applyTargetValidation ];\n\nconst targetValidationConfig = (params: { path: string, method: string }) => ({\n  applyTargetValidation: { targetSpec: { name: API_NAME.ISO20022, version: ISO20022Version, path: params.path, method: params.method } }\n});\nconst createPipelineOptions = (options: FspiopFacadeOptions, mapping: TransformDefinition) => {\n  return {\n    ...options,\n    mapping,\n    pipelineSteps: afterTransformSteps,\n    logger: Config.logger as ContextLogger,\n    unrollExtensions: hasProp(options, 'unrollExtensions') ? !!options.unrollExtensions : Config.unrollExtensions,\n    validateTarget: hasProp(options, 'validateTarget') ? !!options.validateTarget : Config.validateTarget,\n  };\n};\n\n// Facades for transforming FSPIOP payloads to FSPIOP ISO 20022 payloads\nexport const FspiopTransformFacade = {\n  configure: (config: ConfigOptions) => {\n    validateConfig(config);\n    if (config.logger && isContextLogger(config.logger)) Config.logger = config.logger;\n    if (hasProp(config, 'isTestingMode')) Config.isTestingMode = !!config.isTestingMode;\n    if (hasProp(config, 'unrollExtensions')) Config.unrollExtensions = !!config.unrollExtensions;\n    if (hasProp(config, 'validateTarget')) Config.validateTarget = !!config.validateTarget;\n  },\n  parties: {\n    put: async (source: FspiopPutPartiesSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.parties.put.isSource(source)) {\n        throw new Error('Invalid source object for put parties');\n      }\n      // construct source.params.IdPath if not present\n      if (!source.params.IdPath) {\n        source.params.IdPath = `${source.params.Type}/${source.params.ID}`;\n        if (source.params.SubId) {\n          source.params.IdPath += `/${source.params.SubId}`;\n        }\n      }\n      const mapping = options.overrideMapping || discovery_reverse.parties.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger as ContextLogger,\n        mapping,\n      });\n      // step-specific configuration\n      const stepsConfig = {\n        applyUnrollExtensions: { extensionListProperty: 'body.party.partyIdInfo.extensionList' },\n        ...targetValidationConfig({ path: '/parties/{Type}/{ID}/{SubId}', method: 'put' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    putError: async (source: FspiopPutPartiesErrorSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.parties.putError.isSource(source)) {\n        throw new Error('Invalid source object for put parties error');\n      }\n      // construct source.params.IdPath if not present\n      if (!source.params.IdPath) {\n        source.params.IdPath = `${source.params.Type}/${source.params.ID}`;\n        if (source.params.SubId) {\n          source.params.IdPath += `/${source.params.SubId}`;\n        }\n      }\n      const mapping = options.overrideMapping || discovery_reverse.parties.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping,\n      });\n      const stepsConfig = targetValidationConfig({ path: '/parties/{Type}/{ID}/{SubId}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n  },\n  quotes: {\n    post: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.quotes.post.isSource(source)) {\n        throw new Error('Invalid source object for post quotes');\n      }\n      const mapping = options.overrideMapping || quotes_reverse.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      /**\n       * Mutate the target object here if necessary e.g complex scenarios that cannot be mapped directly in the mappings,\n       * e.g one-sided mappings, or where the mappings are not sufficient to cover all scenarios.\n       * We do not apply these mutations if there is mapping override.\n       */\n      if (!options.overrideMapping) {\n        setProp(target, 'body.CdtTrfTxInf.ChrgBr', getProp(source, 'body.amountType') === 'SEND' ? 'CRED' : 'DEBT');\n\n        if (getProp(source, 'body.transactionType.refundInfo')) {\n          setProp(target, 'body.CdtTrfTxInf.InstrForCdtrAgt.Cd', 'REFD');\n          setProp(target, 'body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf', getProp(source, 'body.transactionType.refundInfo.reason'));\n        }\n      }\n      const stepsConfig = targetValidationConfig({ path: '/quotes', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline     \n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    put: async (source: FspiopPutQuotesSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.quotes.put.isSource(source)) throw new Error('Invalid source object for put quotes');\n      if (!Config.isTestingMode && !source.$context) throw new Error('Invalid source object for put quotes, missing $context');\n      const defaultMapping = Config.isTestingMode ? quotes_reverse.putTesting : quotes_reverse.put;\n      const mapping = options.overrideMapping || defaultMapping;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping,\n      }) as IsoTarget;\n      if (!source.body.payeeFspFee && hasProp(target, 'body.CdtTrfTxInf.ChrgsInf.Agt.FinInstnId.Othr.Id')) {\n        delete target.body.CdtTrfTxInf.ChrgsInf;\n      }\n      const stepsConfig = targetValidationConfig({ path: '/quotes/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline     \n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    putError: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.quotes.putError.isSource(source)) {\n        throw new Error('Invalid source object for put quotes error');\n      }\n      const mapping = options.overrideMapping || quotes_reverse.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping,\n      });\n      const stepsConfig = targetValidationConfig({ path: '/quotes/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n  },\n  transfers: {\n    post: async (source: FspiopPostTransfersSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.transfers.post.isSource(source)) {\n        throw new Error('Invalid source object for post transfers');\n      }\n      if (!Config.isTestingMode && !source.$context) {\n        throw new Error('Invalid source object for post transfers, missing $context');\n      }\n      const defaultMapping = Config.isTestingMode ? transfers_reverse.postTesting : transfers_reverse.post;\n      const mapping = options.overrideMapping || defaultMapping;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping,\n      });\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    patch: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.transfers.patch.isSource(source)) {\n        throw new Error('Invalid source object for patch transfers');\n      }\n      const mapping = options.overrideMapping || transfers_reverse.patch;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}', method: 'patch' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    put: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.transfers.put.isSource(source)) {\n        throw new Error('Invalid source object for put transfers');\n      }\n      const mapping = options.overrideMapping || transfers_reverse.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    putError: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.transfers.putError.isSource(source)) {\n        throw new Error('Invalid source object for put transfers error');\n      }\n      const mapping = options.overrideMapping || transfers_reverse.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n  },\n  fxQuotes: {\n    post: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxQuotes.post.isSource(source)) {\n        throw new Error('Invalid source object for post fxQuotes');\n      }\n      const mapping = options.overrideMapping || fxQuotes_reverse.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = {\n        applyUnrollExtensions: { extensionListProperty: 'body.conversionTerms.extensionList' },\n        ...targetValidationConfig({ path: '/fxQuotes/{ID}', method: 'post' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    put: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxQuotes.put.isSource(source)) {\n        throw new Error('Invalid source object for put fxQuotes');\n      }\n      const mapping = options.overrideMapping || fxQuotes_reverse.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = {\n        applyUnrollExtensions: { extensionListProperty: 'body.conversionTerms.extensionList' },\n        ...targetValidationConfig({ path: '/fxQuotes/{ID}', method: 'put' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    putError: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxQuotes.putError.isSource(source)) {\n        throw new Error('Invalid source object for put fxQuotes error');\n      }\n      const mapping = options.overrideMapping || fxQuotes_reverse.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/fxQuotes/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n  },\n  fxTransfers: {\n    post: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxTransfers.post.isSource(source)) {\n        throw new Error('Invalid source object for post fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers_reverse.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    patch: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxTransfers.patch.isSource(source)) {\n        throw new Error('Invalid source object for patch fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers_reverse.patch;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}', method: 'patch' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    put: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxTransfers.put.isSource(source)) {\n        throw new Error('Invalid source object for put fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers_reverse.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n    putError: async (source: FspiopSource, options: FspiopFacadeOptions = {}): Promise<IsoTarget> => {\n      if (!TypeGuards.FSPIOP.fxTransfers.putError.isSource(source)) {\n        throw new Error('Invalid source object for put fxTransfers error');\n      }\n      const mapping = options.overrideMapping || fxTransfers_reverse.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<IsoTarget>;\n    },\n  },\n};\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\n\nimport {\n  ConfigOptions,\n  FspiopTarget,\n  IsoSource,\n  FspiopPutQuotesTarget,\n  FspiopPutPartiesTarget,\n  FspiopPutPartiesErrorTarget,\n  IsoFacadeOptions,\n  TypeGuards,\n  PartyIdParamsSource,\n  isContextLogger,\n  API_NAME\n} from '../types';\nimport { logger as defaultLogger, transformFn } from '../lib';\nimport { FSPIO20022PMappings } from '../mappings';\nimport { getProp, hasProp, setProp, validateConfig } from '../lib/utils';\nimport { runPipeline } from '../lib/transforms/pipeline';\nimport { applyRollUpUnmappedAsExtensions } from '../lib/transforms/extensions';\nimport { ContextLogger } from '@mojaloop/central-services-logger/src/contextLogger';\nimport { TransformDefinition } from '../types/map-transform';\nimport { applyTargetValidation } from '../lib/validation';\n\nconst { discovery, quotes, fxQuotes, transfers, fxTransfers } = FSPIO20022PMappings;\nconst Config: ConfigOptions = { logger: defaultLogger, rollUpUnmappedAsExtensions: false, validateTarget: false };\nconst afterTransformSteps = [ applyRollUpUnmappedAsExtensions, applyTargetValidation ];\nconst FSPIOPVersion = '2.0';\n\nconst targetValidationConfig = (params: { path: string, method: string }) => ({\n  applyTargetValidation: { targetSpec: { name: API_NAME.FSPIOP, version: FSPIOPVersion, path: params.path, method: params.method } }\n});\n\nconst createPipelineOptions = (options: IsoFacadeOptions, mapping: TransformDefinition) => {\n  return {\n    ...options,\n    mapping,\n    pipelineSteps: afterTransformSteps,\n    logger: Config.logger as ContextLogger,\n    rollUpUnmappedAsExtensions: hasProp(options, 'rollUpUnmappedAsExtensions') ? !!options.rollUpUnmappedAsExtensions : Config.rollUpUnmappedAsExtensions,\n    validateTarget: hasProp(options, 'validateTarget') ? !!options.validateTarget : Config.validateTarget,\n  };\n};\n\n// Facades for transforming FSPIOP ISO 20022 payloads to FSPIOP payloads\nexport const FspiopIso20022TransformFacade = {\n  configure: (config: ConfigOptions) => {\n    validateConfig(config);\n    if (config.logger && isContextLogger(config.logger)) Config.logger = config.logger;\n    if (hasProp(config, 'rollUpUnmappedAsExtensions')) Config.rollUpUnmappedAsExtensions = !!config.rollUpUnmappedAsExtensions;\n    if (hasProp(config, 'validateTarget')) Config.validateTarget = !!config.validateTarget;\n  },\n  parties: {\n    put: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopPutPartiesTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.parties.put.isSource(source)) {\n        throw new Error('Invalid source object for put parties');\n      }\n      const mapping = options.overrideMapping || discovery.parties.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping,\n      });\n      // split up IdPath\n      const IdPath = getProp(target, 'params.IdPath') as string;\n      if (IdPath) {\n        const [Type, ID, SubId] = IdPath.split('/');\n        setProp(target, 'params.Type', Type);\n        setProp(target, 'params.ID', ID);\n        if (SubId) setProp(target, 'params.SubId', SubId);\n        delete (target.params as PartyIdParamsSource).IdPath;\n      }\n      // step-specific configuration\n      const stepsConfig = {\n        applyRollUpUnmappedAsExtensions: { extensionListProperty: 'body.party.partyIdInfo.extensionList' },\n        ...targetValidationConfig({ path: 'parties/{Type}/{ID}', method: 'put' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopPutPartiesTarget>;\n    },\n    putError: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopPutPartiesErrorTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.parties.putError.isSource(source)) {\n        throw new Error('Invalid source object for put parties error');\n      }\n      const mapping = options.overrideMapping || discovery.parties.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n\n      // split up IdPath\n      const IdPath = getProp(target, 'params.IdPath') as string;\n      if (IdPath) {\n        const [Type, ID, SubId] = IdPath.split('/');\n        setProp(target, 'params.Type', Type);\n        setProp(target, 'params.ID', ID);\n        if (SubId) setProp(target, 'params.SubId', SubId);\n        delete (target.params as PartyIdParamsSource).IdPath;\n      }\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/parties/{Type}/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopPutPartiesErrorTarget>;\n    },\n  },\n  quotes: {\n    post: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.quotes.post.isSource(source)) {\n        throw new Error('Invalid source object for post quotes');\n      }\n      const mapping = options.overrideMapping || quotes.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n\n      /**\n       * Mutate the target object here if necessary e.g complex scenarios that cannot be mapped directly in the mappings,\n       * e.g one-sided mappings, or where the mappings are not sufficient to cover all scenarios.\n       * We do not apply these mutations if there is mapping override.\n       */\n      if (!options.overrideMapping) {\n        setProp(target, 'body.amountType', getProp(source, 'body.CdtTrfTxInf.ChrgBr') === 'DEBT' ? 'RECEIVE' : 'SEND');\n        if (getProp(source, 'body.CdtTrfTxInf.InstrForCdtrAgt.Cd') === 'REFD') {\n          setProp(target, 'body.transactionType.refundInfo.reason', getProp(source, 'body.CdtTrfTxInf.InstrForCdtrAgt.InstrInf'));\n        }\n        if (getProp(source, 'body.CdtTrfTxInf.PmtId.InstrId')) {\n          setProp(target, 'body.transactionType.initiator', 'PAYEE');\n        } else {\n          setProp(target, 'body.transactionType.initiator', 'PAYER');\n        }\n        if (getProp(source, 'body.CdtTrfTxInf.PmtId.InstrId')) {\n          if (getProp(source, 'body.CdtTrfTxInf.Cdr.Id.Pty')) {\n            setProp(target, 'body.transactionType.initiatorType', 'CONSUMER');\n          } else {\n            setProp(target, 'body.transactionType.initiatorType', 'BUSINESS');\n          }\n        } else {\n          if (getProp(source, 'body.CdtTrfTxInf.Dtr.Id.Pty')) {\n            setProp(target, 'body.transactionType.initiatorType', 'CONSUMER');\n          } else {\n            setProp(target, 'body.transactionType.initiatorType', 'BUSINESS');\n          }\n        }\n      }\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/quotes', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    put: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopPutQuotesTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.quotes.put.isSource(source)) {\n        throw new Error('Invalid source object for put quotes');\n      }\n      const mapping = options.overrideMapping || quotes.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/quotes/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopPutQuotesTarget>;\n    },\n    putError: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.quotes.putError.isSource(source)) {\n        throw new Error('Invalid source object for put quotes error');\n      }\n      const mapping = options.overrideMapping || quotes.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/quotes/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n  },\n  transfers: {\n    post: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.transfers.post.isSource(source)) {\n        throw new Error('Invalid source object for post transfers');\n      }\n      const mapping = options.overrideMapping || transfers.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/transfers', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    patch: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.transfers.patch.isSource(source)) {\n        throw new Error('Invalid source object for patch transfers');\n      }\n      const mapping = options.overrideMapping || transfers.patch;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}', method: 'patch' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    put: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.transfers.put.isSource(source)) {\n        throw new Error('Invalid source object for put transfers');\n      }\n      const mapping = options.overrideMapping || transfers.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    putError: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.transfers.putError.isSource(source)) {\n        throw new Error('Invalid source object for put transfers error');\n      }\n      const mapping = options.overrideMapping || transfers.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/transfers/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n  },\n  fxQuotes: {\n    post: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxQuotes.post.isSource(source)) {\n        throw new Error('Invalid source object for post fxQuotes');\n      }\n      const mapping = options.overrideMapping || fxQuotes.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = {\n        applyRollUpUnmappedAsExtensions: { extensionListProperty: 'body.conversionTerms.extensionList' },\n        ...targetValidationConfig({ path: '/fxQuotes', method: 'post' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    put: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxQuotes.put.isSource(source)) {\n        throw new Error('Invalid source object for put fxQuotes');\n      }\n      const mapping = options.overrideMapping || fxQuotes.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = {\n        applyRollUpUnmappedAsExtensions: { extensionListProperty: 'body.conversionTerms.extensionList' },\n        ...targetValidationConfig({ path: '/fxQuotes/{ID}', method: 'put' })\n      };\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    putError: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxQuotes.putError.isSource(source)) {\n        throw new Error('Invalid source object for put fxQuotes error');\n      }\n      const mapping = options.overrideMapping || fxQuotes.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/fxQuotes/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n  },\n  fxTransfers: {\n    post: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxTransfers.post.isSource(source)) {\n        throw new Error('Invalid source object for post fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers.post;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers', method: 'post' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    patch: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxTransfers.patch.isSource(source)) {\n        throw new Error('Invalid source object for patch fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers.patch;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}', method: 'patch' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    put: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxTransfers.put.isSource(source)) {\n        throw new Error('Invalid source object for put fxTransfers');\n      }\n      const mapping = options.overrideMapping || fxTransfers.put;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    },\n    putError: async (source: IsoSource, options: IsoFacadeOptions = {}): Promise<FspiopTarget> => {\n      if (!TypeGuards.FSPIOPISO20022.fxTransfers.putError.isSource(source)) {\n        throw new Error('Invalid source object for put fxTransfers error');\n      }\n      const mapping = options.overrideMapping || fxTransfers.putError;\n      const target = await transformFn(source, {\n        ...options,\n        logger: Config.logger as ContextLogger,\n        mapping\n      });\n      // step-specific configuration\n      const stepsConfig = targetValidationConfig({ path: '/fxTransfers/{ID}/error', method: 'put' });\n      options = { ...options, ...stepsConfig };\n      // apply additional transformation steps to target via pipeline\n      const pipelineOptions = createPipelineOptions(options, mapping);\n      return runPipeline(source, target, pipelineOptions) as Promise<FspiopTarget>;\n    }\n  },\n};\n","/*****\n License\n --------------\n Copyright © 2020-2025 Mojaloop Foundation\n 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\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n 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.\n\n Contributors\n --------------\n This is the official list of the Mojaloop project contributors for this file.\n Names of the original copyright holders (individuals or organizations)\n should be listed with a '*' in the first column. People who have\n contributed from an organization can be listed under the organization\n that actually holds the copyright for their contributions (see the\n Mojaloop Foundation for an example). Those individuals should have\n their names indented and be marked with a '-'. Email address can be added\n optionally within square brackets <email>.\n\n * Mojaloop Foundation\n - Name Surname <name.surname@mojaloop.io>\n \n * Steven Oderayi <steven.oderayi@infitx.com>\n --------------\n ******/\nexport { createTransformer } from './lib';\nimport { FspiopTransformFacade as FSPIOP, FspiopIso20022TransformFacade as FSPIOPISO20022 } from './facades';\nexport const TransformFacades = {\n  FSPIOP,\n  FSPIOPISO20022,\n};\n"],"mappings":";;;;;;;;;;;;;AAgCO,IAAM,cAAc,OAAO,QAAyB,YAAgE;AACzH,QAAM,EAAE,SAAS,qBAAqB,eAAe,QAAAA,QAAO,IAAI;AAChE,MAAI;AACF,UAAM,cAAc,kBAAkB,SAAS,EAAE,oBAAoB,CAAC;AACtE,WAAO,YAAY,UAAU,QAAQ,EAAE,cAAc,CAAC;AAAA,EACxD,SAAS,OAAO;AACd,IAAAA,QAAO,MAAM,oDAAoD,EAAE,OAAO,QAAQ,QAAQ,CAAC;AAC3F,UAAM;AAAA,EACR;AACF;AAEO,IAAM,cAAN,MAA0C;AAAA,EAC/C;AAAA,EAEA,YAAY,QAAoB;AAC9B,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,UAAU,QAAyB,EAAE,cAAc,IAA+B,CAAC,GAA6B;AACpH,WAAO,KAAK,OAAO,QAAQ,aAAa;AAAA,EAC1C;AACF;;;ACvBA,YA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AS,OAAO;AAC9D,aAAO,YAAY,QAAQ,QAAQ,eAAe;AAAA,IACpD;AAAA,EACF;AACF;;;AClYO,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AACF;","names":["logger","logger","path","logger","logger","path","logger","discovery_reverse","quotes_reverse","transfers_reverse","fxQuotes_reverse","discovery","quotes","fxQuotes","transfers","fxTransfers","Config","afterTransformSteps","targetValidationConfig","createPipelineOptions"]}