From b666d12b74c731a5f2a84aa42ad1e0d7ae68527c Mon Sep 17 00:00:00 2001 From: dzmitryfomchyn Date: Wed, 28 Aug 2024 16:16:58 +0200 Subject: [PATCH] PaymentMethods.etc2 --- CHANGELOG.md | 11 +++++++++++ .../directions/v5/models/PaymentMethods.java | 17 +++++++++++++++++ .../v5/models/DirectionsRouteTest.java | 19 +++++++++++++++++++ .../directions_v5_with_toll_costs.json | 4 ++++ 4 files changed, 51 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f949e4b1..b57ec0e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ Mapbox welcomes participation and contributions from everyone. ### main +### v7.2.0 - August 28, 2024 + +- Added `PaymentMethods#etc2` payment method. +- Added `V6StructuredInputQuery#country` option. + + +### v7.1.0 - July 8, 2024 + +- Optimize memory usage in Directions API model classes by interning frequently occurring strings in JSON + + ### v7.0.0 - April 23, 2024 - Added Geocoding V6 Support. diff --git a/services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/PaymentMethods.java b/services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/PaymentMethods.java index 9a28360ea..cc7b75c09 100644 --- a/services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/PaymentMethods.java +++ b/services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/PaymentMethods.java @@ -32,6 +32,14 @@ public static Builder builder() { @Nullable public abstract CostPerVehicleSize etc(); + /* + * Information about payment by etc2. + * + * return etc2 payment method + */ + @Nullable + public abstract CostPerVehicleSize etc2(); + /* * Information about payment by cash. * @@ -89,6 +97,15 @@ public abstract static class Builder @NonNull public abstract Builder etc(@Nullable CostPerVehicleSize etc); + /* + * Information about payment by etc2. + * + * param etc2 payment method + * return this builder for chaining options together + */ + @NonNull + public abstract Builder etc2(@Nullable CostPerVehicleSize etc2); + /* * Information about payment by cash. * diff --git a/services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsRouteTest.java b/services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsRouteTest.java index 965e9c5ca..9ff5b32ef 100644 --- a/services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsRouteTest.java +++ b/services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsRouteTest.java @@ -134,6 +134,25 @@ public void directionsRoute_hasTollCosts() throws IOException { DirectionsRoute route = DirectionsRoute.fromJson(json, options, uuid); assertEquals(2, route.tollCosts().size()); + + PaymentMethods paymentMethods = route.tollCosts().get(0).paymentMethods(); + + CostPerVehicleSize etc = CostPerVehicleSize.builder() + .middle(5566.0) + .build(); + assertEquals(etc, paymentMethods.etc()); + + CostPerVehicleSize etc2 = CostPerVehicleSize.builder() + .middle(6789.0) + .standard(7890.0) + .build(); + assertEquals(etc2, paymentMethods.etc2()); + + CostPerVehicleSize cash = CostPerVehicleSize.builder() + .small(123.0) + .large(4567.0) + .build(); + assertEquals(cash, paymentMethods.cash()); } @Test diff --git a/services-directions-models/src/test/resources/directions_v5_with_toll_costs.json b/services-directions-models/src/test/resources/directions_v5_with_toll_costs.json index d0094eb48..32137b0c6 100644 --- a/services-directions-models/src/test/resources/directions_v5_with_toll_costs.json +++ b/services-directions-models/src/test/resources/directions_v5_with_toll_costs.json @@ -12,6 +12,10 @@ "etc": { "middle": 5566 }, + "etc2": { + "middle": 6789, + "standard": 7890 + }, "cash": { "small": 123, "large": 4567