Add `deliveryMethod` template variable + generic inline mapping syntax to prefund description config

Context

Partners can configure the prefund funds-transfer description string with templates like:

PR {{paymentId}} {{buyAmount}} {{buyCurrency}} {{recipientLegalName}}[20] {{bankCountryCode}}

See docs/prefund-description-config.md for the full reference. Recipient templates expose 8 variables today; there's no way to include the recipient's delivery method (SWIFT vs in-country EFT) in the description.

Two related asks bundled here because they're best designed together:

  1. New deliveryMethod variable.
  2. Generic inline-mapping modifier on the template engine, so a single variable can render different strings per partner without backend code changes.

Part 1 — deliveryMethod variable

Add a new template variable on recipient prefund templates.

  • Source field: recipient.liveData.DeliveryMethodId
  • Raw values today (from TableConstants.js): W and E
  • Default rendered output: WWire, ELocal

Files to change (variable-map population in each rail adapter, recipient template only):

  • graphql/src/paymentEngine/rails/InternationalUSDConsWire/InternationalUSDConsWireAdapter.js (~1483–1496)
  • graphql/src/paymentEngine/rails/InternationalUSDCorpWire/InternationalUSDCorpWireAdapter.js (~1580–1593)
  • graphql/src/paymentEngine/rails/InternationalFXConsWire/InternationalFXConsWireAdapter.js (~1536–1549)
  • graphql/src/paymentEngine/rails/InternationalFXCorpWire/InternationalFXCorpWireAdapter.js (~1791–1804)

Part 2 — Generic inline mapping modifier

Extend FormatUtils.populateDynamicString() (graphql/src/utils/FormatUtils.js, ~L429-454) with an inline mapping modifier that lets a template override the rendered string per raw value. This is generic — works on any variable, not just deliveryMethod.

Proposed syntax (engineering can finalize delimiter):

{{deliveryMethod}}                       → "Wire" or "Local"  (default mapping in the adapter)
{{deliveryMethod|W=Swift|E=Local}}       → "Swift" or "Local" (template-level override)
{{deliveryMethod|W=SWIFT|E=ACH}}[6]      → composes with existing [N] width modifier
{{buyCurrency|USD=Dollars|EUR=Euros}}    → works on any variable

Semantics:

  • If the modifier is present and the raw value matches a key, render the mapped value.
  • If the raw value doesn't match any key in the modifier, fall back to the default rendered value (i.e. what {{var}} alone would render). This keeps the modifier additive — partners only spell out the cases they care about.
  • The [N] width modifier applies after mapping: slice the rendered string, not the raw value.
  • Delimiter (| proposed) must not conflict with any existing template content. If it does, pick another (;, ::, etc.) — flag in the PR.

Caveats

  • Recipient templates only. Vostro payments have no recipient and no delivery method. Don't add deliveryMethod to the vostro variable map (substitution throws on undefined variables — see existing caveat #2 in the doc).
  • All 4 flavors (USD/FX × Consumer/Corporate) on the recipient path.
  • Backwards compatible. Templates without the new modifier render unchanged. The modifier is a pure parser extension.
  • Unknown variable still throws. The mapping modifier doesn't suppress the existing "unknown variable name" crash — only the per-value mapping is overridable.

Acceptance

  • {{deliveryMethod}} substitutes to Wire / Local across all 4 recipient prefund templates.
  • {{deliveryMethod|W=Swift|E=Local}} substitutes to Swift / Local.
  • {{deliveryMethod|W=SWIFT}}[3] substitutes to SWI (mapping then truncate) when value is W, and to Loc (default mapping then truncate) when value is E.
  • Generic modifier works on any other variable (test with buyCurrency or bankCountryCode).
  • Vostro substitution unaffected — vostro templates that don't reference deliveryMethod continue to render correctly.
  • docs/prefund-description-config.md updated:
  • "Available variables → Recipient templates" table includes deliveryMethod row.
  • "Template syntax" table includes the new mapping modifier.
  • "Suggested templates" section gets one example using the modifier.

Please authenticate to join the conversation.

Upvoters
Status

In Progress

Board

💡 Public Tracking

Date

About 1 month ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.