Skip to content

feat(invite): referral push notifications — accepted, inviter reward, invitee reward - #469

Merged
islandbitcoin merged 2 commits into
mainfrom
feat/referral-push-notifications
Aug 8, 2026
Merged

feat(invite): referral push notifications — accepted, inviter reward, invitee reward#469
islandbitcoin merged 2 commits into
mainfrom
feat/referral-push-notifications

Conversation

@islandbitcoin

Copy link
Copy Markdown
Contributor

What

The invite slice of ENG-531 (event notifications): three pushes across the referral flow, queued since the feature launch plan.

Recipient Trigger Copy
Inviter invite redeemed (ACCEPTED transition, redeem resolver) "Your invite was accepted 🎉 — {name} just joined Flash from your invite" (no-name fallback)
Inviter their reward leg confirmed paid (award-referral-reward) "Referral reward earned — US$X credited to your wallet"
Invitee their reward leg confirmed paid "Welcome reward received — US$X credited to your wallet"

Design

  • Best-effort throughout — the senders can never throw into the redeem or payout paths (outer try/catch + logged warns; fire-and-forget call sites).
  • Pending IBEX legs do NOT notify — money unconfirmed, ops reconciles first; only paid legs push.
  • Mirrors the bridge-KYC push module exactly: account → user → deviceTokens, localized phrases (notification.referral.* added to en + es), dead-token pruning via removeDeviceTokens, Payments category, typed data payload (referral_accepted / referral_inviterReward / referral_inviteeReward) for client-side routing.

Tests

7 new module tests (phrase selection, $ formatting, dead-token pruning, never-throws ×2) + wiring assertions: award spec (both legs push on paid; failed leg never), redeem spec (accepted push fires with the inviter's id). Full unit suite 1396 passed. (kyc.spec's logger stub gained .child() — the new import chain reaches the push module's load-time child logger.)

No schema changes, no migrations — deployable on the next train.

🤖 Generated with Claude Code

bobodread876 and others added 2 commits August 7, 2026 17:15
… invitee reward

The invite slice of ENG-531 (event notifications). Three pushes, all
best-effort (they can never throw into the redeem or payout paths):

- inviter: "Your invite was accepted" — fired from the redeem resolver
  after the ACCEPTED transition, named body when the redeemer has a
  username, no-name fallback otherwise
- inviter: "Referral reward earned — US$X credited" — fired from
  award-referral-reward only when the inviter's leg is confirmed PAID
- invitee: "Welcome reward received — US$X credited" — same, invitee leg

Pending IBEX legs deliberately do NOT notify (money unconfirmed; ops
reconciles first). Mirrors the bridge-KYC push module end to end:
account -> user -> deviceTokens, localized phrases
(notification.referral.* added to en + es), dead-token pruning,
Payments notification category, typed data payload for client routing.

Tests: 7 new module tests (phrase selection, amount formatting,
dead-token pruning, never-throws x2) + wiring assertions in the award
spec (paid legs push, failed legs never) and redeem spec (accepted push
fires with the inviter's id). Touched suites 64/64.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7z7o9J18BWbUnYJcemMtg
Review fix: the IBEX-pending cases now assert the push behavior — both-
pending fires nothing, mixed paid+pending fires exactly the paid leg.
Guards the rule most likely to be broken by a future "just notify on
pending too" edit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C7z7o9J18BWbUnYJcemMtg
@islandbitcoin
islandbitcoin merged commit 75073ef into main Aug 8, 2026
15 of 16 checks passed
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.

2 participants