Class MockBillingController

java.lang.Object
com.yahoo.vespa.hosted.controller.api.integration.billing.MockBillingController
All Implemented Interfaces:
BillingController

public class MockBillingController extends Object implements BillingController
Author:
olaa
  • Constructor Details

    • MockBillingController

      public MockBillingController(Clock clock)
  • Method Details

    • getPlan

      public PlanId getPlan(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      Get the plan ID for the given tenant. This method will not fail if the tenant does not exist, it will return the default plan for that tenant instead.
      Specified by:
      getPlan in interface BillingController
    • tenantsWithPlan

      public List<com.yahoo.config.provision.TenantName> tenantsWithPlan(List<com.yahoo.config.provision.TenantName> tenants, PlanId planId)
      Description copied from interface: BillingController
      Return the list of tenants with the given plan.
      Specified by:
      tenantsWithPlan in interface BillingController
      Parameters:
      tenants - All existing tenants in the system
      planId - The ID of the plan to filter existing tenants on.
      Returns:
      The tenants that have the given plan.
    • getPlanDisplayName

      public String getPlanDisplayName(PlanId planId)
      Description copied from interface: BillingController
      The display name of the given plan
      Specified by:
      getPlanDisplayName in interface BillingController
    • getQuota

      public Quota getQuota(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      The quota for the given tenant. This method will return default quota for tenants that do not exist.
      Specified by:
      getQuota in interface BillingController
    • setPlan

      public PlanResult setPlan(com.yahoo.config.provision.TenantName tenant, PlanId planId, boolean hasDeployments, boolean isAccountant)
      Description copied from interface: BillingController
      Set the plan for the current tenant. Checks some pre-conditions to see if the tenant is eligible for the given plan.
      Specified by:
      setPlan in interface BillingController
      Parameters:
      tenant - The name of the tenant.
      planId - The ID of the plan to change to.
      hasDeployments - Does the tenant have active deployments.
      isAccountant - Is it the hosted accountant that is doing the operation
      Returns:
      String containing error message if something went wrong. Empty otherwise
    • createBillForPeriod

      public Bill.Id createBillForPeriod(com.yahoo.config.provision.TenantName tenant, ZonedDateTime startTime, ZonedDateTime endTime, String agent)
      Description copied from interface: BillingController
      Create a bill of unbilled use for the given tenant in the given time period.
      Specified by:
      createBillForPeriod in interface BillingController
      Parameters:
      tenant - The name of the tenant.
      startTime - The start of the billing period
      endTime - The end of the billing period
      agent - The agent that creates the bill
      Returns:
      The ID of the new bill.
    • createUncommittedBill

      public Bill createUncommittedBill(com.yahoo.config.provision.TenantName tenant, LocalDate until)
      Description copied from interface: BillingController
      Create an unpersisted bill of unbilled use for the given tenant from the end of last bill until the given date. This is used to show "unbilled use" in the Console.
      Specified by:
      createUncommittedBill in interface BillingController
      Parameters:
      tenant - The name of the tenant.
      until - The end date of the unbilled use period.
      Returns:
      A bill with the resource use and cost.
    • createUncommittedBills

      public Map<com.yahoo.config.provision.TenantName,Bill> createUncommittedBills(LocalDate until)
      Description copied from interface: BillingController
      Run {createUncommittedBill} for all tenants with unbilled use
      Specified by:
      createUncommittedBills in interface BillingController
    • getUnusedLineItems

      public List<Bill.LineItem> getUnusedLineItems(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      Get line items that have been manually added to a tenant, but is not yet part of a bill
      Specified by:
      getUnusedLineItems in interface BillingController
    • getDefaultInstrument

      public Optional<PaymentInstrument> getDefaultInstrument(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      Get the payment instrument for the given tenant
      Specified by:
      getDefaultInstrument in interface BillingController
    • createClientToken

      public String createClientToken(String tenant, String userId)
      Description copied from interface: BillingController
      Get the auth token needed to talk to payment services
      Specified by:
      createClientToken in interface BillingController
    • deleteInstrument

      public boolean deleteInstrument(com.yahoo.config.provision.TenantName tenant, String userId, String instrumentId)
      Description copied from interface: BillingController
      Delete a payment instrument from the list of the tenant's instruments
      Specified by:
      deleteInstrument in interface BillingController
    • updateBillStatus

      public void updateBillStatus(Bill.Id billId, String agent, String status)
      Description copied from interface: BillingController
      Change the status of the given bill
      Specified by:
      updateBillStatus in interface BillingController
    • addLineItem

      public void addLineItem(com.yahoo.config.provision.TenantName tenant, String description, BigDecimal amount, String agent)
      Description copied from interface: BillingController
      Add a line item to the given bill
      Specified by:
      addLineItem in interface BillingController
    • deleteLineItem

      public void deleteLineItem(String lineItemId)
      Description copied from interface: BillingController
      Delete a line item - only available for unused line items
      Specified by:
      deleteLineItem in interface BillingController
    • setActivePaymentInstrument

      public boolean setActivePaymentInstrument(InstrumentOwner paymentInstrument)
      Description copied from interface: BillingController
      Set the given payment instrument as the active instrument for the tenant
      Specified by:
      setActivePaymentInstrument in interface BillingController
    • listInstruments

      public InstrumentList listInstruments(com.yahoo.config.provision.TenantName tenant, String userId)
      Description copied from interface: BillingController
      List the payment instruments from the tenant
      Specified by:
      listInstruments in interface BillingController
    • getBillsForTenant

      public List<Bill> getBillsForTenant(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      Get all bills for the given tenant
      Specified by:
      getBillsForTenant in interface BillingController
    • getBills

      public List<Bill> getBills()
      Description copied from interface: BillingController
      Get all bills from the system
      Specified by:
      getBills in interface BillingController
    • getCollectionMethod

      public CollectionMethod getCollectionMethod(com.yahoo.config.provision.TenantName tenant)
      Description copied from interface: BillingController
      Get the bill collection method for the given tenant
      Specified by:
      getCollectionMethod in interface BillingController
    • setCollectionMethod

      public CollectionResult setCollectionMethod(com.yahoo.config.provision.TenantName tenant, CollectionMethod method)
      Description copied from interface: BillingController
      Set the bill collection method for the given tenant
      Specified by:
      setCollectionMethod in interface BillingController
    • addBill

      public void addBill(com.yahoo.config.provision.TenantName tenantName, Bill bill, boolean committed)