Skip to content

feat: per-wallet mail text overrides for RealUnit#3639

Closed
TaprootFreak wants to merge 1 commit intodevelopfrom
feat/realunit-mail-templates
Closed

feat: per-wallet mail text overrides for RealUnit#3639
TaprootFreak wants to merge 1 commit intodevelopfrom
feat/realunit-mail-templates

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

Summary

Adds per-wallet override mechanism for user-mail texts so partner wallets (RealUnit being the first) can ship their own subjects, salutations and body texts without forking the trigger services or introducing new MailType values.

What changed

  • MailFactory.translate(...) is now wallet-aware. When a walletName is passed it tries mail.wallets.<walletname>.<key> first and falls back to the default key. getMailAffix, mapMailAffix and translateParams propagate the walletName, and createUserV2Mail / createPersonalMail pull it from wallet.name automatically.
  • mail.json (DE + EN) gets a new wallets.realunit block with overrides for general (closing / support / welcome / thanks), purchase / sale / refund / processing flows plus KYC failure, missing-data, reminder, and email-verification reminder. All texts use formal Sie and the RealUnit Schweiz AG closing.
  • realUnit.hbs mail layout (copy of onChainLabs.hbs with RealUnit logo URL swapped). Layout/colors are unchanged for now — RealUnit branding can be tuned in a follow-up once they hand over the assets.
  • config.ts flips mail.wallet.RealUnit.template from 'user-v2' to 'realUnit'.

What this maps to (RealUnit template doc v1.1)

Doc # Trigger / DFX-Event Override key
#1 Kauf abgeschlossen BUY_CRYPTO_COMPLETED payment.crypto_output.*
#2 Verkauf gestartet BUY_FIAT_PROCESSING payment.processing.*
#3 Monatslimit BUY_FIAT_PENDING payment.chargeback.reasons.monthly_limit
#4 Jahreslimit BUY_FIAT_PENDING payment.chargeback.reasons.annual_limit
#5 Einzahlung in Prüfung BUY_CRYPTO_PENDING payment.fiat_input.*
#7 Video-KYC KYC_FAILED kyc.failed.*
#8 KYC-Daten fehlen KYC_MISSING_DATA kyc.missing_data.*
#9 Mail-Bestätigung Reminder EMAIL_VERIFICATION_REMINDER verification_code.email.*
#11 KYC-Reminder KYC_REMINDER kyc.reminder.*
#12 Rückerstattung Limite BUY_FIAT_RETURN payment.chargeback.fiat.*
#15 Verkauf nicht möglich BUY_FIAT_RETURN payment.chargeback.crypto.*
#17 Verkaufserlös ausgezahlt BUY_FIAT_COMPLETED payment.fiat_output.*

#6 (Zahlungsproblem) and #13 (Aktion ausstehend) are intentionally NOT overridden — they should be disabled per-wallet via wallet.disabledMailTypes once this lands.

Open points (waiting on RealUnit / DAS)

  • Final support URL — currently assumed https://support.realunit.ch.
  • App path for KYC/flow-of-funds entry — currently text says "Menü → Profil → Verifizierung".
  • Consolidation of Hotfix #8 / Feature/log columns #10 / Feature/log columns #11 (kept as three separate texts for now).
  • Slots Feature/kyc mail #14 and Feature/ref percent #16 in the v1.0 doc (numbering gap, no template provided).
  • RealUnit branding assets for the HBS layout (logo URL is a placeholder, layout colours still match onChainLabs).
  • Whether EN should ship in phase 1 alongside DE (added preemptively).

Test plan

  • DEV deploy: trigger a KYC, CFP, removed lazy, bugfixes, refactoring #1-style buy completion mail for a RealUnit user and verify subject, salutation and closing render with RealUnit overrides.
  • Trigger a non-RealUnit user mail and verify default DFX texts are unchanged.
  • Trigger a Feature/log columns #11 KYC-reminder for a RealUnit user and verify both kyc.reminder.title and general.support come from the override block.
  • Inspect rendered HTML in Outlook/Gmail/iOS Mail (RealUnit logo loads, layout intact).
  • EN-language RealUnit user receives the EN override texts.

Out of scope

  • DB schema changes — none needed; everything is config-/i18n-driven.
  • Refactor of MailFactory beyond the override hook.
  • New MailType or MailContext values.
  • FR/IT translations (phase 2).

Make MailFactory.translate wallet-aware: when a wallet is attached to
the mail request, look up `mail.wallets.<walletname>.<key>` first and
fall back to the default key. Propagate walletName through getMailAffix,
mapMailAffix and translateParams so all i18n lookups in user-V2 and
personal mails respect the override.

Add RealUnit override block to de/en mail.json covering closing/support/
welcome/thanks plus subjects and salutations for purchase, sale, refund,
KYC and email-verification flows. Texts use formal "Sie" address and
RealUnit branding.

Add realUnit.hbs as RealUnit-branded mail template (logo swap, otherwise
identical to onChainLabs layout) and switch the RealUnit wallet config
to use it.
@TaprootFreak
Copy link
Copy Markdown
Collaborator Author

Doppelarbeit — wird ersetzt durch den älteren Draft-PR #3598 (feat/realunit-mail-template), der bereits weiter gediehen ist (separate mail-realunit.json, body-text-injection in der Factory, Preview-Script).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant