mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-06 15:18:49 +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
|
||||
JSONObject fareInfo = trip.getJSONObject("fareInfo");
|
||||
JSONArray fareLegs = fareInfo.getJSONArray("legs");
|
||||
|
||||
Fare[] foundFares = new Fare[fareLegs.length()];
|
||||
for (int i = 0; i < fareLegs.length(); i++) {
|
||||
foundFares[i] = fareFromJSONObject(fareLegs.getJSONObject(i));
|
||||
List<Fare> tripFares = null;
|
||||
if (fareInfo.getBoolean("complete")) {
|
||||
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,
|
||||
trip.getInt("numberOfChanges"));
|
||||
return new Trip(trip.getString("id"), from, to, foundLegs, tripFares, null, trip.getInt("numberOfChanges"));
|
||||
}
|
||||
|
||||
private Stop stopFromJSONObject(JSONObject stop) throws JSONException {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue