Class BillingDatabaseClientMock
java.lang.Object
com.yahoo.vespa.hosted.controller.api.integration.billing.BillingDatabaseClientMock
- All Implemented Interfaces:
BillingDatabaseClient
- Author:
- olaa
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLineItem(com.yahoo.config.provision.TenantName tenantName, Bill.LineItem lineItem, Optional<Bill.Id> invoiceId) Add a line item to an open billvoidcommitLineItems(com.yahoo.config.provision.TenantName tenantName, Bill.Id invoiceId) Associate all uncommitted line items to a given bill This is only allowed if the line item has not already been associated with an billcreateBill(com.yahoo.config.provision.TenantName tenant, ZonedDateTime startTime, ZonedDateTime endTime, String agent) Create a completely new Bill in the open state with no LineItems.voiddeactivateDefaultPaymentInstrument(com.yahoo.config.provision.TenantName tenant) Deactivates the default payment instrument for a tenant, if it exists.voiddeleteLineItem(String lineItemId) Delete a line item This is only allowed if the line item has not yet been associated with an billgetCollectionMethod(com.yahoo.config.provision.TenantName tenantName) Get the current collection method for the tenant - if one has persistedgetDefaultPaymentInstrumentForTenant(com.yahoo.config.provision.TenantName tenantName) getPlan(com.yahoo.config.provision.TenantName tenantName) Return the plan for the given tenantReturn the plan for the given tenants if present.getUnusedLineItems(com.yahoo.config.provision.TenantName tenantName) voidmaintain()Performs necessary maintenance operationsRead the given bill from the data sourceRead all bills, ordered by datereadBillsForTenant(com.yahoo.config.provision.TenantName tenant) Get all bills for a given tenant, ordered by datebooleansetActivePaymentInstrument(InstrumentOwner paymentInstrument) voidsetCollectionMethod(com.yahoo.config.provision.TenantName tenantName, CollectionMethod collectionMethod) Set the collection method for the tenantvoidSet the current plan for the given tenantvoidSet status for the given bill
-
Constructor Details
-
BillingDatabaseClientMock
-
-
Method Details
-
setActivePaymentInstrument
- Specified by:
setActivePaymentInstrumentin interfaceBillingDatabaseClient
-
getDefaultPaymentInstrumentForTenant
public Optional<InstrumentOwner> getDefaultPaymentInstrumentForTenant(com.yahoo.config.provision.TenantName tenantName) - Specified by:
getDefaultPaymentInstrumentForTenantin interfaceBillingDatabaseClient
-
getStatus
-
createBill
public Bill.Id createBill(com.yahoo.config.provision.TenantName tenant, ZonedDateTime startTime, ZonedDateTime endTime, String agent) Description copied from interface:BillingDatabaseClientCreate a completely new Bill in the open state with no LineItems.- Specified by:
createBillin interfaceBillingDatabaseClient- Parameters:
tenant- The name of the tenant the bill is foragent- The agent that created the bill- Returns:
- The Id of the new bill
-
readBill
Description copied from interface:BillingDatabaseClientRead the given bill from the data source- Specified by:
readBillin interfaceBillingDatabaseClient- Parameters:
billId- The Id of the bill to retrieve- Returns:
- The Bill if it exists, Optional.empty() if not.
-
addLineItem
public String addLineItem(com.yahoo.config.provision.TenantName tenantName, Bill.LineItem lineItem, Optional<Bill.Id> invoiceId) Description copied from interface:BillingDatabaseClientAdd a line item to an open bill- Specified by:
addLineItemin interfaceBillingDatabaseClientlineItem- The line item to addinvoiceId- The optional ID of the bill this line item is for- Returns:
- The Id of the new line item
-
setStatus
Description copied from interface:BillingDatabaseClientSet status for the given bill- Specified by:
setStatusin interfaceBillingDatabaseClient- Parameters:
invoiceId- The ID of the bill this status is foragent- The agent that added the statusstatus- The new status of the bill
-
getUnusedLineItems
- Specified by:
getUnusedLineItemsin interfaceBillingDatabaseClient
-
deleteLineItem
Description copied from interface:BillingDatabaseClientDelete a line item This is only allowed if the line item has not yet been associated with an bill- Specified by:
deleteLineItemin interfaceBillingDatabaseClient- Parameters:
lineItemId- The ID of the line item
-
commitLineItems
Description copied from interface:BillingDatabaseClientAssociate all uncommitted line items to a given bill This is only allowed if the line item has not already been associated with an bill- Specified by:
commitLineItemsin interfaceBillingDatabaseClient- Parameters:
tenantName- The tenant we want to commit line items forinvoiceId- The ID of the line item
-
getPlan
Description copied from interface:BillingDatabaseClientReturn the plan for the given tenant- Specified by:
getPlanin interfaceBillingDatabaseClient- Parameters:
tenantName- The tenant to retrieve the plan for- Returns:
- Optional.of the plan if present in DN, else Optional.empty
-
getPlans
public Map<com.yahoo.config.provision.TenantName,Optional<Plan>> getPlans(List<com.yahoo.config.provision.TenantName> tenants) Description copied from interface:BillingDatabaseClientReturn the plan for the given tenants if present. If the database does not know of the tenant, the tenant is not included in the result.- Specified by:
getPlansin interfaceBillingDatabaseClient
-
setPlan
Description copied from interface:BillingDatabaseClientSet the current plan for the given tenant- Specified by:
setPlanin interfaceBillingDatabaseClient- Parameters:
tenantName- The tenant to set the plan forplan- The plan to use
-
deactivateDefaultPaymentInstrument
public void deactivateDefaultPaymentInstrument(com.yahoo.config.provision.TenantName tenant) Description copied from interface:BillingDatabaseClientDeactivates the default payment instrument for a tenant, if it exists. Used during tenant deletion- Specified by:
deactivateDefaultPaymentInstrumentin interfaceBillingDatabaseClient
-
getCollectionMethod
public Optional<CollectionMethod> getCollectionMethod(com.yahoo.config.provision.TenantName tenantName) Description copied from interface:BillingDatabaseClientGet the current collection method for the tenant - if one has persisted- Specified by:
getCollectionMethodin interfaceBillingDatabaseClient- Returns:
- Optional.empty if no collection method has been persisted for the tenant
-
setCollectionMethod
public void setCollectionMethod(com.yahoo.config.provision.TenantName tenantName, CollectionMethod collectionMethod) Description copied from interface:BillingDatabaseClientSet the collection method for the tenant- Specified by:
setCollectionMethodin interfaceBillingDatabaseClient- Parameters:
tenantName- The name of the tenant to set collection method forcollectionMethod- The collection method for the tenant
-
readBillsForTenant
Description copied from interface:BillingDatabaseClientGet all bills for a given tenant, ordered by date- Specified by:
readBillsForTenantin interfaceBillingDatabaseClient- Parameters:
tenant- The name of the tenant- Returns:
- List of all bills ordered by date
-
readBills
Description copied from interface:BillingDatabaseClientRead all bills, ordered by date- Specified by:
readBillsin interfaceBillingDatabaseClient- Returns:
- List of all bills ordered by date
-
maintain
public void maintain()Description copied from interface:BillingDatabaseClientPerforms necessary maintenance operations- Specified by:
maintainin interfaceBillingDatabaseClient
-