31 lines
746 B
Go
31 lines
746 B
Go
package pricing
|
|
|
|
type VosgesPricingService struct{}
|
|
|
|
func NewVosgesPricingService() (*VosgesPricingService, error) {
|
|
return &VosgesPricingService{}, nil
|
|
}
|
|
|
|
func (s *VosgesPricingService) Prices(params PricingParams) (map[string]Price, error) {
|
|
var distanceForPricing int64
|
|
if params.MobilityType == "solidarity_transport" {
|
|
distanceForPricing = params.SharedMobility.DriverDistance
|
|
} else {
|
|
distanceForPricing = params.SharedMobility.PassengerDistance
|
|
}
|
|
|
|
passengerAmount := 0.20 * float64(distanceForPricing)
|
|
driverAmount := 0.30 * float64(distanceForPricing)
|
|
|
|
return map[string]Price{
|
|
"passenger": {
|
|
Amount: passengerAmount,
|
|
Currency: "EUR",
|
|
},
|
|
"driver": {
|
|
Amount: driverAmount,
|
|
Currency: "EUR",
|
|
},
|
|
}, nil
|
|
}
|