55import com .fasterxml .jackson .annotation .JsonProperty ;
66import lombok .ToString ;
77
8+ import java .math .BigDecimal ;
89import java .util .List ;
910import java .util .Objects ;
1011
@@ -22,8 +23,8 @@ public class OutboundPrefixPrice {
2223
2324 private final List <String > prefixes ;
2425 private final String friendlyName ;
25- private final double basePrice ;
26- private final double currentPrice ;
26+ private final BigDecimal basePrice ;
27+ private final BigDecimal currentPrice ;
2728
2829 /**
2930 * Initialize an OutboundPrefixPrice.
@@ -36,8 +37,8 @@ public class OutboundPrefixPrice {
3637 @ JsonCreator
3738 public OutboundPrefixPrice (@ JsonProperty ("prefixes" ) final List <String > prefixes ,
3839 @ JsonProperty ("friendly_name" ) final String friendlyName ,
39- @ JsonProperty ("base_price" ) final double basePrice ,
40- @ JsonProperty ("current_price" ) final double currentPrice ) {
40+ @ JsonProperty ("base_price" ) final BigDecimal basePrice ,
41+ @ JsonProperty ("current_price" ) final BigDecimal currentPrice ) {
4142 this .prefixes = prefixes ;
4243 this .friendlyName = friendlyName ;
4344 this .basePrice = basePrice ;
@@ -52,11 +53,49 @@ public String getFriendlyName() {
5253 return friendlyName ;
5354 }
5455
56+ /**
57+ * Returns the retail price per minute to make a call to numbers matching this prefix list. The value returned by
58+ * this method is represented as a {@code double}, which may result in loss of precision.
59+ *
60+ * @return the retail price per minute to make a call to numbers matching this prefix list
61+ *
62+ * @deprecated please use {{@link #getBasePriceDecimal()}} instead for a lossless representation of the price
63+ */
64+ @ Deprecated
5565 public double getBasePrice () {
66+ return basePrice .doubleValue ();
67+ }
68+
69+ /**
70+ * Returns the retail price per minute to make a call to numbers matching this prefix list.
71+ *
72+ * @return the retail price per minute to make a call to numbers matching this prefix list
73+ */
74+ public BigDecimal getBasePriceDecimal () {
5675 return basePrice ;
5776 }
5877
78+ /**
79+ * Returns the current price per minute (which accounts for any volume or custom price discounts) to make a call to
80+ * numbers matching this prefix list. The value returned by this method is represented as a {@code double}, which
81+ * may result in loss of precision.
82+ *
83+ * @return the current price per minute to make a call to numbers matching this prefix list
84+ *
85+ * @deprecated please use {{@link #getCurrentPriceDecimal()} instead for a lossless representation of the price
86+ */
87+ @ Deprecated
5988 public double getCurrentPrice () {
89+ return currentPrice .doubleValue ();
90+ }
91+
92+ /**
93+ * Returns the current price per minute (which accounts for any volume or custom price discounts) to make a call to
94+ * numbers matching this prefix list.
95+ *
96+ * @return the current price per minute to make a call to numbers matching this prefix list
97+ */
98+ public BigDecimal getCurrentPriceDecimal () {
6099 return currentPrice ;
61100 }
62101
0 commit comments