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:
- New
deliveryMethodvariable. - 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):WandE - Default rendered output:
W→Wire,E→Local
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
deliveryMethodto 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 toWire/Localacross all 4 recipient prefund templates.{{deliveryMethod|W=Swift|E=Local}}substitutes toSwift/Local.{{deliveryMethod|W=SWIFT}}[3]substitutes toSWI(mapping then truncate) when value isW, and toLoc(default mapping then truncate) when value isE.- Generic modifier works on any other variable (test with
buyCurrencyorbankCountryCode). - Vostro substitution unaffected — vostro templates that don't reference
deliveryMethodcontinue to render correctly. - docs/prefund-description-config.md updated:
- "Available variables → Recipient templates" table includes
deliveryMethodrow. - "Template syntax" table includes the new mapping modifier.
- "Suggested templates" section gets one example using the modifier.
Log in to comment and vote
No comments yet
Be the first to share your thoughts.