Slide 17
Slide 17 text
Reuse code from the normal mode
import (
"github.com/lyft/purchaseflowlib"
)
// buildFallbackResponse builds the API offer representation that can be rendered on clients
func (h *Handler) buildFallbackResponse(fallbackProducts []*Products) (*OffersResp, error) {
fallbackOffers := purchaseflowlib.BuildOffers(fallbackProducts)
rankedOffers := purchaseflowlib.Rank(fallbackOffers)
resp, err := purchaseflowlib.ToAPIResponse(h.user, rankedOffers)
if err != nil {
return nil, err
}
return resp, nil
}