From b422c8adc3d7a39f01fdc6fa2b01d1407c48a1b9 Mon Sep 17 00:00:00 2001 From: Arnaud Delcasse Date: Tue, 10 Jun 2025 08:56:50 +0200 Subject: [PATCH] fixed price cities --- pricing/pricing_pfm63.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pricing/pricing_pfm63.go b/pricing/pricing_pfm63.go index 5b3d4d0..3f8edf2 100644 --- a/pricing/pricing_pfm63.go +++ b/pricing/pricing_pfm63.go @@ -5,6 +5,7 @@ import ( "slices" "github.com/manterfield/go-mapreader" + "github.com/rs/zerolog/log" ) type PFM63PricingService struct{} @@ -23,6 +24,10 @@ func (s *PFM63PricingService) Prices(vars map[string]any) (map[string]Price, err if err != nil { return nil, fmt.Errorf("passenger_priority parameter not found : %v", err) } + ret, err := mapreader.BoolErr(vars, "return") + if err != nil { + return nil, fmt.Errorf("passenger_priority parameter not found : %v", err) + } passenger_history, err := mapreader.IntErr(vars, "passenger.history") if err != nil { return nil, fmt.Errorf("passenger_history parameter not found : %v", err) @@ -31,6 +36,10 @@ func (s *PFM63PricingService) Prices(vars map[string]any) (map[string]Price, err if err != nil { return nil, fmt.Errorf("destination_locality parameter not found : %v", err) } + // passenger_locality, err := mapreader.StrErr(vars, "passenger.locality") + // if err != nil { + // return nil, fmt.Errorf("destination_locality parameter not found : %v", err) + // } driver_distance, err := mapreader.IntErr(vars, "journey.driver_distance") if err != nil { return nil, fmt.Errorf("driver_distance parameter not found : %v", err) @@ -41,13 +50,18 @@ func (s *PFM63PricingService) Prices(vars map[string]any) (map[string]Price, err } pricing := 0.0 + log.Debug().Str("destination loc", destination_locality).Msg("debuf pricing") if passenger_history == 0 { pricing = 0 } else if passenger_priority && passenger_distance <= 5 { pricing = 0 } else if slices.Contains([]string{"Clermont-Ferrand", "Ussel", "Aubusson", "Riom"}, destination_locality) { - pricing = 5 + if ret { + pricing = 10 + } else { + pricing = 5 + } } else if passenger_distance < 15 { pricing = 2 } else if passenger_distance < 30 {