import { mapPaymentLeafToCanonical } from '@dbis/checkpoint-core';
import type { PaymentLeaf } from './ingress/types';

export function attachIso20022ToLeaves(leaves: PaymentLeaf[]): void {
  if (process.env.CHECKPOINT_ISO_ENRICH === '0') return;
  for (const leaf of leaves) {
    if (!leaf.iso20022) leaf.iso20022 = mapPaymentLeafToCanonical(leaf);
  }
}
