fix MMS43 pricing
This commit is contained in:
@@ -7,6 +7,17 @@ func NewMMS43PricingService() (*MMS43PricingService, error) {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -16,12 +27,12 @@ func (s *MMS43PricingService) Prices(params PricingParams) (map[string]Price, er
|
||||
// Trip is free
|
||||
passengerAmount = 0.0
|
||||
} else {
|
||||
// Price is 0.15€/km for passenger distance
|
||||
passengerAmount = 0.15 * float64(params.SharedMobility.PassengerDistance)
|
||||
// Price is 0.15€/km based on mobility type distance
|
||||
passengerAmount = 0.15 * float64(distanceForPricing)
|
||||
}
|
||||
|
||||
// Driver indemnification is always 0.30€/km for driver distance
|
||||
driverAmount := 0.30 * float64(params.SharedMobility.DriverDistance)
|
||||
// Driver indemnification is always 0.30€/km based on mobility type distance
|
||||
driverAmount := 0.30 * float64(distanceForPricing)
|
||||
|
||||
return map[string]Price{
|
||||
"passenger": {
|
||||
|
||||
Reference in New Issue
Block a user