Skip to content

Commit 2f67c25

Browse files
authored
Merge pull request #4202 from hove-io/hotfix/flowbird
NAV-2676 [Flowbird] Intégration des prix issus de l'API flowbird
2 parents c1c00e6 + 5573e18 commit 2f67c25

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

source/jormungandr/jormungandr/parking_space_availability/car/forseti.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@ def process_data(self, data, poi):
7979
parking_coord = Coords(parking.get('coord').get('lat'), parking.get('coord').get('lon'))
8080
distance = crowfly_distance_between(poi_coord, parking_coord)
8181
if distance < self.distance:
82-
return ParkingPlaces(availability=parking.get('availability'))
82+
return ParkingPlaces(
83+
availability=parking.get('availability'),
84+
currency=parking.get('currency'),
85+
amount=parking.get('amount'),
86+
start_time=parking.get('startTime'),
87+
end_time=parking.get('endTime'),
88+
)

source/jormungandr/jormungandr/parking_space_availability/car/parking_places.py

+16
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def __init__(
4343
occupied_electric_vehicle=None,
4444
state=None,
4545
availability=None,
46+
currency=None,
47+
start_time=None,
48+
end_time=None,
49+
amount=None,
4650
):
4751
if available is not None:
4852
self.available = available
@@ -66,6 +70,14 @@ def __init__(
6670
self.state = state
6771
if availability is not None:
6872
self.availability = availability
73+
if currency is not None:
74+
self.currency = currency
75+
if amount is not None:
76+
self.amount = amount
77+
if start_time is not None:
78+
self.start_time = start_time
79+
if end_time is not None:
80+
self.end_time = end_time
6981
if not total_places and any(n is not None for n in [available, occupied, available_PRM, occupied_PRM]):
7082
self.total_places = (available or 0) + (occupied or 0) + (available_PRM or 0) + (occupied_PRM or 0)
7183

@@ -82,6 +94,10 @@ def __eq__(self, other):
8294
"occupied_electric_vehicle",
8395
"state",
8496
"availability",
97+
"currency",
98+
"amount",
99+
"start_time",
100+
"end_time",
85101
"total_places",
86102
]:
87103
if hasattr(other, item):

source/jormungandr/jormungandr/parking_space_availability/car/tests/forseti_test.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,22 @@ def parking_space_availability_forseti_get_informations_test():
5959
"name": "786 Parking",
6060
"coord": {"lat": 42.368227, "lon": -83.0779357},
6161
"availability": True,
62+
"currency": "USD",
63+
"startTime": "2019-04-01T00:00:00Z",
64+
"endTime": "2019-04-01T23:59:59Z",
65+
"amount": 6000,
6266
}
6367
],
6468
"pagination": {"start_page": 0, "items_on_page": 25, "items_per_page": 25, "total_result": 1},
6569
}
6670

67-
parking_places = ParkingPlaces(availability=True)
71+
parking_places = ParkingPlaces(
72+
availability=True,
73+
currency='USD',
74+
start_time='2019-04-01T00:00:00Z',
75+
end_time='2019-04-01T23:59:59Z',
76+
amount=6000,
77+
)
6878
provider = ForsetiProvider('http://forseti')
6979
provider._call_webservice = MagicMock(return_value=webservice_response)
7080
parking = provider.get_informations(poi)

0 commit comments

Comments
 (0)