fix(frontend): use real merchant API data in ExploreMap offer cards (#151)#186
Open
gidadoabdullateef5 wants to merge 1 commit into
Open
Conversation
Map distance_km, payout_mxn, and rate_percent from the merchants API instead of hardcoded placeholder values. Closes ericmt-98#151.
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #151 —
ExploreMapwas showing identical placeholder economics on every merchant card becausemerchantToOfferignored the fields returned byGET /merchants/available.This PR wires
merchantToOfferto the existingAvailableMerchantresponse so each card reflects that merchant's real distance, payout, and commission.What changed
File:
micopay/frontend/src/pages/ExploreMap.tsxmerchantToOffernow maps API fields instead of hardcoded constants:AvailableMerchant)Offer)distance_kmdistanceformatDistance()distance_kmwalkMinuteswalkMinutes()payout_mxnreceiveMxnrate_percentcommissionPctusernamenameBefore: every card showed
180 m,3 min,$495.00 MXN, and1%commission.After: each card shows values computed from that merchant's API response.
Also removed the hardcoded
badge: 'Negocio verificado'sinceAvailableMerchanthas no badge field — the badge UI remains optional and simply won't render when absent.Acceptance criteria
merchantToOffermapsm.distance_km→formatDistance/walkMinutesmerchantToOffermapsm.payout_mxn→receiveMxnandm.rate_percent→commissionPctEmptyState(no crash)Scope
Frontend only — single-file change in
ExploreMap.tsx. No backend or hook changes required;useMerchantsAvailablealready returns the correct data.Test plan
$X.XX (Y%)) matchesamount - payout_mxnandrate_percent