Skip to content

fix(frontend): use real merchant API data in ExploreMap offer cards (#151)#186

Open
gidadoabdullateef5 wants to merge 1 commit into
ericmt-98:mainfrom
gidadoabdullateef5:fix/explore-map-real-merchant-data
Open

fix(frontend): use real merchant API data in ExploreMap offer cards (#151)#186
gidadoabdullateef5 wants to merge 1 commit into
ericmt-98:mainfrom
gidadoabdullateef5:fix/explore-map-real-merchant-data

Conversation

@gidadoabdullateef5

Copy link
Copy Markdown

Summary

Fixes #151ExploreMap was showing identical placeholder economics on every merchant card because merchantToOffer ignored the fields returned by GET /merchants/available.

This PR wires merchantToOffer to the existing AvailableMerchant response so each card reflects that merchant's real distance, payout, and commission.

What changed

File: micopay/frontend/src/pages/ExploreMap.tsx

merchantToOffer now maps API fields instead of hardcoded constants:

API field (AvailableMerchant) UI field (Offer) Helper used
distance_km distance formatDistance()
distance_km walkMinutes walkMinutes()
payout_mxn receiveMxn
rate_percent commissionPct
username name (already wired)

Before: every card showed 180 m, 3 min, $495.00 MXN, and 1% commission.

After: each card shows values computed from that merchant's API response.

Also removed the hardcoded badge: 'Negocio verificado' since AvailableMerchant has no badge field — the badge UI remains optional and simply won't render when absent.

Acceptance criteria

  • merchantToOffer maps m.distance_kmformatDistance / walkMinutes
  • merchantToOffer maps m.payout_mxnreceiveMxn and m.rate_percentcommissionPct
  • Each merchant card displays that merchant's real distance, payout, and commission
  • Empty merchant list handled gracefully via existing EmptyState (no crash)

Scope

Frontend only — single-file change in ExploreMap.tsx. No backend or hook changes required; useMerchantsAvailable already returns the correct data.

Test plan

  • Open Convertir a efectivo with location permission granted
  • Confirm multiple merchant cards show different distances, walk times, payouts, and commission percentages
  • Confirm the primary ("Mejor oferta") card uses real values from the first merchant in the API response
  • Confirm commission display ($X.XX (Y%)) matches amount - payout_mxn and rate_percent
  • Test with no nearby merchants → empty state renders without errors
  • Test location denied / fetch error paths still work (unchanged)

Map distance_km, payout_mxn, and rate_percent from the merchants API
instead of hardcoded placeholder values. Closes ericmt-98#151.
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@gidadoabdullateef5 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

P1-1 · ExploreMap shows hardcoded merchant economics — use real API data

1 participant