aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillingController.java
blob: 90c4622d8033e29e8e840e4bdab3d8061e98b312 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright Verizon Media. 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 com.yahoo.config.provision.TenantName;
import com.yahoo.vespa.hosted.controller.api.integration.user.User;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

public interface BillingController {

    PlanId getPlan(TenantName tenant);

    String getPlanDisplayName(PlanId planId);

    Quota getQuota(TenantName tenant);

    /**
     * @return String containing error message if something went wrong. Empty otherwise
     */
    PlanResult setPlan(TenantName tenant, PlanId planId, boolean hasDeployments);

    Invoice.Id createInvoiceForPeriod(TenantName tenant, ZonedDateTime startTime, ZonedDateTime endTime, String agent);

    Invoice createUncommittedInvoice(TenantName tenant, LocalDate until);

    Map<TenantName, Invoice> createUncommittedInvoices(LocalDate until);

    List<Invoice.LineItem> getUnusedLineItems(TenantName tenant);

    Optional<PaymentInstrument> getDefaultInstrument(TenantName tenant);

    String createClientToken(String tenant, String userId);

    boolean deleteInstrument(TenantName tenant, String userId, String instrumentId);

    void updateInvoiceStatus(Invoice.Id invoiceId, String agent, String status);

    void addLineItem(TenantName tenant, String description, BigDecimal amount, String agent);

    void deleteLineItem(String lineItemId);

    boolean setActivePaymentInstrument(InstrumentOwner paymentInstrument);

    InstrumentList listInstruments(TenantName tenant, String userId);

    List<Invoice> getInvoices(TenantName tenant);

    void deleteBillingInfo(TenantName tenant, Set<User> users, boolean isPrivileged);

    default CollectionMethod getCollectionMethod(TenantName tenant) {
        return CollectionMethod.NONE;
    }

    default CollectionResult setCollectionMethod(TenantName tenant, CollectionMethod method) {
        return CollectionResult.error("Method not implemented");
    }
}