diff options
Diffstat (limited to 'controller-api/src/main/java/com/yahoo')
3 files changed, 0 insertions, 117 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java index 8b48c72f88e..dcd1a057f49 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java @@ -34,9 +34,6 @@ public interface BillingController { */ List<TenantName> tenantsWithPlan(List<TenantName> existing, PlanId planId); - /** The display name of the given plan */ - String getPlanDisplayName(PlanId planId); - /** * The quota for the given tenant. * This method will return default quota for tenants that do not exist. @@ -63,7 +60,6 @@ public interface BillingController { * @return The ID of the new bill. */ Bill.Id createBillForPeriod(TenantName tenant, ZonedDateTime startTime, ZonedDateTime endTime, String agent); - Bill.Id createBillForPeriod(TenantName tenant, LocalDate startDate, LocalDate endDate, String agent); /** * Create an unpersisted bill of unbilled use for the given tenant from the end of last bill until the given date. @@ -80,36 +76,15 @@ public interface BillingController { /** Get line items that have been manually added to a tenant, but is not yet part of a bill */ List<Bill.LineItem> getUnusedLineItems(TenantName tenant); - /** Get the payment instrument for the given tenant */ - Optional<PaymentInstrument> getDefaultInstrument(TenantName tenant); - - /** Get the auth token needed to talk to payment services */ - String createClientToken(String tenant, String userId); - - /** Delete a payment instrument from the list of the tenant's instruments */ - boolean deleteInstrument(TenantName tenant, String userId, String instrumentId); - - /** Change the status of the given bill */ - void updateBillStatus(Bill.Id billId, String agent, BillStatus status); - /** Add a line item to the given bill */ void addLineItem(TenantName tenant, String description, BigDecimal amount, Optional<Bill.Id> billId, String agent); /** Delete a line item - only available for unused line items */ void deleteLineItem(String lineItemId); - /** Set the given payment instrument as the active instrument for the tenant */ - boolean setActivePaymentInstrument(InstrumentOwner paymentInstrument); - - /** List the payment instruments from the tenant */ - InstrumentList listInstruments(TenantName tenant, String userId); - /** Get all bills for the given tenant */ List<Bill> getBillsForTenant(TenantName tenant); - /** Get all bills from the system */ - List<Bill> getBills(); - /** Get the bill with the given id */ Bill getBill(Bill.Id billId); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentList.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentList.java deleted file mode 100644 index 559a3e8ee9c..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/InstrumentList.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.billing; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author olaa - */ -public class InstrumentList { - - private String activeInstrumentId; - private List<PaymentInstrument> instruments; - - - public InstrumentList(List<PaymentInstrument> instruments) { - this.instruments = instruments; - } - - public void setActiveInstrumentId(String activeInstrumentId) { - this.activeInstrumentId = activeInstrumentId; - } - - public void addInstrument(PaymentInstrument instrument) { - instruments.add(instrument); - } - - public void addInstruments(List<PaymentInstrument> instruments) { - instruments.addAll(instruments); - } - - public String getActiveInstrumentId() { - return activeInstrumentId; - } - - public List<PaymentInstrument> getInstruments() { - return instruments; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java index 9012b45748c..b50018c187c 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/MockBillingController.java @@ -28,7 +28,6 @@ public class MockBillingController implements BillingController { PlanId defaultPlan = PlanId.from("trial"); List<TenantName> tenants = new ArrayList<>(); Map<TenantName, PlanId> plans = new HashMap<>(); - Map<TenantName, PaymentInstrument> activeInstruments = new HashMap<>(); Map<TenantName, List<Bill>> committedBills = new HashMap<>(); public Map<TenantName, Bill> uncommittedBills = new HashMap<>(); Map<TenantName, List<Bill.LineItem>> unusedLineItems = new HashMap<>(); @@ -52,11 +51,6 @@ public class MockBillingController implements BillingController { } @Override - public String getPlanDisplayName(PlanId planId) { - return "Plan with id: " + planId.value(); - } - - @Override public Quota getQuota(TenantName tenant) { return Quota.unlimited().withMaxClusterSize(5); } @@ -83,11 +77,6 @@ public class MockBillingController implements BillingController { } @Override - public Bill.Id createBillForPeriod(TenantName tenant, LocalDate startDate, LocalDate endDate, String agent) { - return createBillForPeriod(tenant, startDate.atStartOfDay(ZoneOffset.UTC), endDate.plusDays(1).atStartOfDay(ZoneOffset.UTC), agent); - } - - @Override public Bill createUncommittedBill(TenantName tenant, LocalDate until) { return uncommittedBills.getOrDefault(tenant, emptyBill()); } @@ -103,31 +92,6 @@ public class MockBillingController implements BillingController { } @Override - public Optional<PaymentInstrument> getDefaultInstrument(TenantName tenant) { - return Optional.ofNullable(activeInstruments.get(tenant)); - } - - @Override - public String createClientToken(String tenant, String userId) { - return "some-token"; - } - - @Override - public boolean deleteInstrument(TenantName tenant, String userId, String instrumentId) { - activeInstruments.remove(tenant); - return true; - } - - @Override - public void updateBillStatus(Bill.Id billId, String agent, BillStatus status) { - var now = clock.instant().atZone(ZoneOffset.UTC); - committedBills.values().stream() - .flatMap(List::stream) - .filter(bill -> billId.equals(bill.id())) - .forEach(bill -> bill.statusHistory().history.put(now, status)); - } - - @Override public void addLineItem(TenantName tenant, String description, BigDecimal amount, Optional<Bill.Id> billId, String agent) { if (billId.isPresent()) { throw new UnsupportedOperationException(); @@ -152,28 +116,11 @@ public class MockBillingController implements BillingController { } @Override - public boolean setActivePaymentInstrument(InstrumentOwner paymentInstrument) { - var instrumentId = paymentInstrument.getPaymentInstrumentId(); - activeInstruments.put(paymentInstrument.getTenantName(), createInstrument(instrumentId)); - return true; - } - - @Override - public InstrumentList listInstruments(TenantName tenant, String userId) { - return null; - } - - @Override public List<Bill> getBillsForTenant(TenantName tenant) { return committedBills.getOrDefault(tenant, List.of()); } @Override - public List<Bill> getBills() { - return committedBills.values().stream().flatMap(Collection::stream).toList(); - } - - @Override public Bill getBill(Bill.Id billId) { return committedBills.values().stream() .flatMap(Collection::stream) |