package pricing type MMS43PricingService struct{} func NewMMS43PricingService() (*MMS43PricingService, error) { return &MMS43PricingService{}, nil } func (s *MMS43PricingService) Prices(params PricingParams) (map[string]Price, error) { // Determine which distance to use based on mobility type // For solidarity transport: use driver distance // For organized carpool: use passenger distance var distanceForPricing int64 if params.MobilityType == "solidarity_transport" { distanceForPricing = params.SharedMobility.DriverDistance } else { // organized_carpool or default distanceForPricing = params.SharedMobility.PassengerDistance } // Calculate passenger price var passengerAmount float64 // First 2 trips are free (1 return trip or 2 outward trips) freeTripsRemaining := 2 - params.Beneficiary.History if freeTripsRemaining > 0 { // Trip is free passengerAmount = 0.0 } else { // Price is 0.15€/km based on mobility type distance passengerAmount = 0.15 * float64(distanceForPricing) } // Driver indemnification is always 0.30€/km based on mobility type distance driverAmount := 0.30 * float64(distanceForPricing) return map[string]Price{ "passenger": { Amount: passengerAmount, Currency: "EUR", }, "driver": { Amount: driverAmount, Currency: "EUR", }, }, nil }