feat: ajout pricing vosges (0.30€/km conducteur, 0.20€/km passager)

This commit is contained in:
Arnaud Delcasse
2026-03-03 11:51:00 +01:00
parent 75d0288d2d
commit 0f75544f93
2 changed files with 32 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ func NewPricingService(implementation string) (PricingService, error) {
return NewMMS43PricingService()
case "pfm63":
return NewPFM63PricingService()
case "vosges":
return NewVosgesPricingService()
default:
return nil, fmt.Errorf("pricing implementation %v is not supported", implementation)

30
pricing/pricing_vosges.go Normal file
View File

@@ -0,0 +1,30 @@
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
}