Skip to content

refactor(payments): DM-transfer delegates module + rename old payments→funding#1130

Merged
bmc08gt merged 1 commit into
code/cashfrom
refactor/dm-payments-module
Jul 24, 2026
Merged

refactor(payments): DM-transfer delegates module + rename old payments→funding#1130
bmc08gt merged 1 commit into
code/cashfrom
refactor/dm-payments-module

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

What

Foundation for in-chat tip/contact payments, split out so the messenger chat-VM work can rebase on it.

1. New shared:payments module — DM transfer delegates

Two symmetric, self-contained delegates for sending cash inside a DM (resolve recipient → attach chat-type metadata → directTransfer → debit local balance → sync feed):

  • ContactPaymentDelegate — keyed by phone number, contact-DM metadata.
  • TipPaymentDelegate — keyed by user id, tip-DM metadata.

TippingCoordinator.confirmTip() now delegates its transfer to TipPaymentDelegate; the out-of-chat tip flow is behaviorally unchanged (it keeps the tip-card / amount / LaunchChat orchestration).

2. Rename old shared:paymentsshared:funding

The existing module is about adding money (purchase methods / deposit / on-ramp), not sending payments — so it's renamed to free the payments name for the transfer module. Updates all ~10 consumers, Gradle paths, Android namespaces, Kotlin packages (com.flipcash.app.paymentscom.flipcash.app.funding), and generated-R imports.

The two are genuinely different domains — shared:funding = fund the wallet, shared:payments = send a peer-to-peer DM transfer. Placing the delegates in a new module (rather than in funding) also avoids a tokens → payments dependency cycle.

3. ResolverController in-memory cache

An identity's on-chain address is effectively immutable, so successful resolutions are memoized (and the controller is now @Singleton). This collapses a pre-send resolve + the delegate's send-time resolve into a single network round-trip.

Verification

  • :apps:flipcash:app:compileDebugKotlin — full graph + Hilt aggregation, no dependency cycle
  • :apps:flipcash:shared:payments:compileDebugKotlin
  • :apps:flipcash:shared:funding:testDebugUnitTest, :apps:flipcash:shared:tipping:testDebugUnitTest — pass

…ents→funding

Introduce shared:payments holding ContactPaymentDelegate and TipPaymentDelegate — the
phone-number- and user-id-keyed cores for sending cash inside a DM (resolve recipient →
attach chat-type metadata → directTransfer → debit local balance → sync feed).
TippingCoordinator.confirmTip now delegates its transfer to TipPaymentDelegate; the
out-of-chat tip flow is unchanged.

Rename the existing shared:payments (add-money / purchase methods) to shared:funding so the
"payments" name is free for the transfer module. Updates all consumers, Gradle paths, Android
namespaces, Kotlin packages, and generated-R imports.

Add an in-memory cache to ResolverController (an identity's on-chain address is effectively
immutable), so a pre-send resolve and the delegate's send-time resolve collapse to a single
network round-trip.

Foundation for tip-chat sends in the messenger, which rebases on top of this.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197MAdYdxVWvdqRU6TEqBwh
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: payments Payments, transfers, intents, billing area: network gRPC, connectivity, API, exchange rates area: build-system Gradle, convention plugins, build-logic area: tokens Token accounts, balances, token info area: session labels Jul 23, 2026
@bmc08gt
bmc08gt merged commit 99a64c3 into code/cash Jul 24, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the refactor/dm-payments-module branch July 24, 2026 02:00
bmc08gt added a commit that referenced this pull request Jul 24, 2026
…ents→funding (#1130)

Introduce shared:payments holding ContactPaymentDelegate and TipPaymentDelegate — the
phone-number- and user-id-keyed cores for sending cash inside a DM (resolve recipient →
attach chat-type metadata → directTransfer → debit local balance → sync feed).
TippingCoordinator.confirmTip now delegates its transfer to TipPaymentDelegate; the
out-of-chat tip flow is unchanged.

Rename the existing shared:payments (add-money / purchase methods) to shared:funding so the
"payments" name is free for the transfer module. Updates all consumers, Gradle paths, Android
namespaces, Kotlin packages, and generated-R imports.

Add an in-memory cache to ResolverController (an identity's on-chain address is effectively
immutable), so a pre-send resolve and the delegate's send-time resolve collapse to a single
network round-trip.

Foundation for tip-chat sends in the messenger, which rebases on top of this.


Claude-Session: https://claude.ai/code/session_0197MAdYdxVWvdqRU6TEqBwh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: network gRPC, connectivity, API, exchange rates area: payments Payments, transfers, intents, billing area: session area: tokens Token accounts, balances, token info type: refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant