mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
Negentwee: Use full trip fares instead of per leg.
This commit is contained in:
parent
f19004c31a
commit
82c6761097
1 changed files with 8 additions and 6 deletions
|
@ -485,15 +485,17 @@ public class NegentweeProvider extends AbstractNetworkProvider {
|
||||||
|
|
||||||
// Get journey fares
|
// Get journey fares
|
||||||
JSONObject fareInfo = trip.getJSONObject("fareInfo");
|
JSONObject fareInfo = trip.getJSONObject("fareInfo");
|
||||||
JSONArray fareLegs = fareInfo.getJSONArray("legs");
|
|
||||||
|
|
||||||
Fare[] foundFares = new Fare[fareLegs.length()];
|
List<Fare> tripFares = null;
|
||||||
for (int i = 0; i < fareLegs.length(); i++) {
|
if (fareInfo.getBoolean("complete")) {
|
||||||
foundFares[i] = fareFromJSONObject(fareLegs.getJSONObject(i));
|
tripFares = Arrays.asList(
|
||||||
|
new Fare("Full-price", Fare.Type.ADULT, Currency.getInstance("EUR"),
|
||||||
|
fareInfo.getInt("fullPriceCents") / 100, null, null),
|
||||||
|
new Fare("Reduced-price", Fare.Type.ADULT, Currency.getInstance("EUR"),
|
||||||
|
fareInfo.getInt("reducedPriceCents") / 100, null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Trip(trip.getString("id"), from, to, foundLegs, Arrays.asList(foundFares), null,
|
return new Trip(trip.getString("id"), from, to, foundLegs, tripFares, null, trip.getInt("numberOfChanges"));
|
||||||
trip.getInt("numberOfChanges"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stop stopFromJSONObject(JSONObject stop) throws JSONException {
|
private Stop stopFromJSONObject(JSONObject stop) throws JSONException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue