summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2021-11-03 12:39:12 +0100
committerØyvind Grønnesby <oyving@verizonmedia.com>2021-11-03 12:39:12 +0100
commit41bf6baf7256cfa2619457bb47a935b61d0e7a7b (patch)
tree5151e9a6a5c1d8b1ccba6cb02abd344a4b7763da /controller-api
parent8cbeb2b57269e64ea05ccf9f1044f57843a6e80c (diff)
Make the bill end date inclusive instead of exclusive
Before the end date for the billing was used to calculate startOfDay to generate the timestamp we actually use. Now we are changing it to .plusDays(1).startOfDay to make it so UI will effectively use the end of today as the timestamp. Also added some more implementations to ManualClock to get some tests to work.
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
index d1af5b428de..1788154b9e2 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
@@ -7,6 +7,7 @@ import com.yahoo.config.provision.zone.ZoneId;
import java.math.BigDecimal;
import java.time.Clock;
+import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.List;
@@ -78,6 +79,14 @@ public class Bill {
return endTime;
}
+ public LocalDate getStartDate() {
+ return startTime.toLocalDate();
+ }
+
+ public LocalDate getEndDate() {
+ return endTime.minusDays(1).toLocalDate();
+ }
+
public BigDecimal sum() {
return lineItems.stream().map(LineItem::amount).reduce(SCALED_ZERO, BigDecimal::add);
}