Skip to content

fix(roadflare-rider): emit authoritative fiat fare in non-Bitcoin RoadFlare offers #84

@variablefate

Description

@variablefate

Summary

ADR-0008 added `fare_fiat_amount` and `fare_fiat_currency` to Kind 3173 for non-Cashu / non-Lightning rides. The receive side was wired in drivestr by #61 (`FiatFare` data class, full UI integration, process-death persistence). The Android rider-app "send" side was wired in a follow-up — `RiderViewModel` passes `fareFiatAmount` + `fareFiatCurrency` through 15+ call sites.

The remaining gap is roadflare-rider (the Android RoadFlare-only rider app): it has zero references to either field name (`FiatFare`, `fiatFare`, `fareFiatAmount`, `fareFiatCurrency`). Non-Bitcoin RoadFlare offers (cash, Zelle, PayPal, etc.) sent from this app omit the authoritative fiat fields entirely, forcing iOS and drivestr receivers to fall back to sats→USD conversion and re-introducing the ~$1 drift ADR-0008 was meant to eliminate.

Verification

```
grep -rn "FiatFare\|fiatFare\|fareFiatAmount\|fareFiatCurrency" roadflare-rider/ --include="*.kt"
→ zero matches
```

For comparison, drivestr has full coverage (DriverModeScreen, DriverModeScreenComponents, DriverViewModel, RoadflareNotificationFormattingTest) and rider-app has 15+ send-side call sites in RiderViewModel.

Scope

  • Compute `fareFiatAmount` + `fareFiatCurrency` in roadflare-rider's offer flow when the selected payment method is non-Bitcoin (matches rider-app's existing logic — pickup→dropoff route × per-mile rate + base fare).
  • Pass the fields through the `RideOfferSpec.RoadFlare` send path so they reach `RideOfferEvent.create()` JSON.
  • Boost path: drop both fields per CLAUDE.md "Boost behavior" / ADR-0008 (driver falls back to sats→USD for the boosted offer only).
  • Cashu / Lightning offers: do NOT emit the fields per the "both-or-neither" rule scoped to fiat-rail offers.

Acceptance criteria

  • roadflare-rider sends a Cash / Zelle / PayPal RoadFlare offer → on-the-wire Kind 3173 contains both `fare_fiat_amount` and `fare_fiat_currency`.
  • Boost path drops both fields; receiving driver falls back to sats→USD for the boosted offer only.
  • Cashu / Lightning offers from roadflare-rider remain unchanged (no new fields).
  • Regression test extends `RoadflareWiringTest` (or a new test class) to pin serialization for non-Bitcoin offers.
  • Manual cross-platform: roadflare-rider → drivestr displays the rider's exact fiat amount; roadflare-rider → roadflare-ios same.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions