Package org.killbill.billing.invoice.api
Interface InvoiceUserApi
-
- All Superinterfaces:
KillbillApi
public interface InvoiceUserApi extends KillbillApi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcommitInvoice(UUID invoiceId, CallContext context)Move the invoice status from DRAFT to COMMITTEDvoidconsumeExistingCBAOnAccountWithUnpaidInvoices(UUID accountId, CallContext context)Rebalance CBA for account which have credit and unpaid invoices-- only needed if system is configured to not rebalance automatically.UUIDcreateMigrationInvoice(UUID accountId, org.joda.time.LocalDate invoiceDate, Iterable<InvoiceItem> items, CallContext context)voiddeleteCBA(UUID accountId, UUID invoiceId, UUID invoiceItemId, CallContext context)Delete a CBA item.BigDecimalgetAccountBalance(UUID accountId, TenantContext context)Retrieve the account balance.BigDecimalgetAccountCBA(UUID accountId, TenantContext context)Retrieve the account CBA.InvoiceItemgetCreditById(UUID creditId, TenantContext context)Retrieve a credit by id.InvoiceItemgetExternalChargeById(UUID externalChargeId, TenantContext context)Retrieve an external charge by id.InvoicegetInvoice(UUID invoiceId, TenantContext context)Retrieve an invoice by id.StringgetInvoiceAsHTML(UUID invoiceId, TenantContext context)Retrieve the invoice formatted in HTML.List<AuditLogWithHistory>getInvoiceAuditLogsWithHistoryForId(UUID invoiceId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given invoice.InvoicegetInvoiceByInvoiceItem(UUID invoiceItemId, TenantContext context)InvoicegetInvoiceByNumber(Integer number, TenantContext context)Retrieve an invoice by invoice number.InvoicegetInvoiceByPayment(UUID paymentId, TenantContext context)Get all invoices for a given payment.List<AuditLogWithHistory>getInvoiceItemAuditLogsWithHistoryForId(UUID invoiceItemId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given invoice item.List<InvoiceItem>getInvoiceItemsByParentInvoice(UUID parentInvoiceId, TenantContext context)Retrieve invoice items details associated to Parent SUMMARY invoice itemList<AuditLogWithHistory>getInvoicePaymentAuditLogsWithHistoryForId(UUID invoicePaymentId, AuditLevel auditLevel, TenantContext context)Get all the audit entries with history for a given invoice payment.Pagination<Invoice>getInvoices(Long offset, Long limit, TenantContext context)List<Invoice>getInvoicesByAccount(UUID accountId, boolean includesMigrated, boolean includeVoidedInvoices, boolean includeInvoiceComponents, TenantContext context)Get all invoices for a given account.Pagination<Invoice>getInvoicesByAccount(UUID accountId, Long offset, Long limit, TenantContext context)List<Invoice>getInvoicesByAccount(UUID accountId, org.joda.time.LocalDate fromDate, org.joda.time.LocalDate upToDate, boolean includeVoidedInvoices, boolean includeInvoiceComponents, TenantContext context)Find invoices from a given day, for a given account.List<Invoice>getInvoicesByGroup(UUID accountId, UUID groupId, TenantContext context)Collection<Invoice>getUnpaidInvoicesByAccountId(UUID accountId, org.joda.time.LocalDate fromDate, org.joda.time.LocalDate upToDate, TenantContext context)Find unpaid invoices for a given account, up to a given day.List<InvoiceItem>insertCredits(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> creditItems, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context)Add a credit to an account.List<InvoiceItem>insertExternalCharges(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> charges, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context)Add one or multiple external charges to an account.InvoiceIteminsertInvoiceItemAdjustment(UUID accountId, UUID invoiceId, UUID invoiceItemId, org.joda.time.LocalDate effectiveDate, String description, String itemDetails, Iterable<PluginProperty> properties, CallContext context)Adjust fully a given invoice item.InvoiceIteminsertInvoiceItemAdjustment(UUID accountId, UUID invoiceId, UUID invoiceItemId, org.joda.time.LocalDate effectiveDate, BigDecimal amount, Currency currency, String description, String itemDetails, Iterable<PluginProperty> properties, CallContext context)Adjust partially a given invoice item.List<InvoiceItem>insertTaxItems(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> taxes, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context)Add one or multiple tax items to one invoice.Pagination<Invoice>searchInvoices(String searchKey, Long offset, Long limit, TenantContext context)Find all invoices having their id, number, account id or currency matching the search keyvoidtagInvoiceAsNotWrittenOff(UUID invoiceId, CallContext context)Unmark an invoice as written off.voidtagInvoiceAsWrittenOff(UUID invoiceId, CallContext context)Mark an invoice as written off.voidtransferChildCreditToParent(UUID childAccountId, CallContext context)Move a given child credit to the parent levelInvoicetriggerDryRunInvoiceGeneration(UUID accountId, org.joda.time.LocalDate targetDate, DryRunArguments dryRunArguments, Iterable<PluginProperty> properties, CallContext context)Trigger an invoice for a given account and a given day.InvoicetriggerInvoiceGeneration(UUID accountId, org.joda.time.LocalDate targetDate, Iterable<PluginProperty> properties, CallContext context)Trigger an invoice for a given account and a given day.Iterable<Invoice>triggerInvoiceGroupGeneration(UUID accountId, org.joda.time.LocalDate targetDate, Iterable<PluginProperty> properties, CallContext context)Trigger an invoice for a given account and a given day.voidvoidInvoice(UUID invoiceId, CallContext context)Move the invoice status from DRAFT or COMMITTED to VOID
-
-
-
Method Detail
-
getInvoicesByAccount
List<Invoice> getInvoicesByAccount(UUID accountId, boolean includesMigrated, boolean includeVoidedInvoices, boolean includeInvoiceComponents, TenantContext context)
Get all invoices for a given account.- Parameters:
accountId- account idincludesMigrated- flag that indicates if migrated invoices should be returnedincludeVoidedInvoices- flag that indicates if voided invoices should be returnedincludeInvoiceComponents- flag that indicates if invoice components (items, payments, etc.) should be returnedcontext- the tenant context- Returns:
- all invoices
-
getInvoicesByAccount
Pagination<Invoice> getInvoicesByAccount(UUID accountId, Long offset, Long limit, TenantContext context)
- Parameters:
accountId- account idoffset- the offset of the first resultlimit- the maximum number of results to retrievecontext- the tenant context- Returns:
- paginated invoices
-
getInvoicesByAccount
List<Invoice> getInvoicesByAccount(UUID accountId, org.joda.time.LocalDate fromDate, org.joda.time.LocalDate upToDate, boolean includeVoidedInvoices, boolean includeInvoiceComponents, TenantContext context)
Find invoices from a given day, for a given account.- Parameters:
accountId- account idfromDate- the earliest included target day to consider, in the account timezoneupToDate- the latest included target day to consider, in the account timezoneincludeInvoiceComponents- flag that indicates if invoice components (items, payments, etc.) should be returnedcontext- the tenant context- Returns:
- a list of invoices
-
getInvoicesByGroup
List<Invoice> getInvoicesByGroup(UUID accountId, UUID groupId, TenantContext context)
- Parameters:
accountId- account idgroupId- the group idcontext- the tenant context- Returns:
-
getInvoices
Pagination<Invoice> getInvoices(Long offset, Long limit, TenantContext context)
- Parameters:
context- the user contextoffset- the offset of the first resultlimit- the maximum number of results to retrieve- Returns:
- the list of invoices for that tenant
-
searchInvoices
Pagination<Invoice> searchInvoices(String searchKey, Long offset, Long limit, TenantContext context)
Find all invoices having their id, number, account id or currency matching the search key- Parameters:
searchKey- the search keyoffset- the offset of the first resultlimit- the maximum number of results to retrievecontext- the user context- Returns:
- the list of invoices matching this search key for that tenant
-
getAccountBalance
BigDecimal getAccountBalance(UUID accountId, TenantContext context)
Retrieve the account balance.- Parameters:
accountId- account idcontext- the tenant context- Returns:
- the account balance
-
getAccountCBA
BigDecimal getAccountCBA(UUID accountId, TenantContext context)
Retrieve the account CBA.- Parameters:
accountId- account idcontext- the tenant context- Returns:
- the account CBA
-
getInvoice
Invoice getInvoice(UUID invoiceId, TenantContext context) throws InvoiceApiException
Retrieve an invoice by id.- Parameters:
invoiceId- invoice idcontext- the tenant context- Returns:
- the invoice
- Throws:
InvoiceApiException
-
getInvoiceByPayment
Invoice getInvoiceByPayment(UUID paymentId, TenantContext context) throws InvoiceApiException
Get all invoices for a given payment.- Parameters:
paymentId- payment idcontext- the tenant context- Returns:
- the invoice
- Throws:
InvoiceApiException
-
getInvoiceByNumber
Invoice getInvoiceByNumber(Integer number, TenantContext context) throws InvoiceApiException
Retrieve an invoice by invoice number.- Parameters:
number- invoice numbercontext- the tenant context- Returns:
- the invoice
- Throws:
InvoiceApiException
-
getInvoiceByInvoiceItem
Invoice getInvoiceByInvoiceItem(UUID invoiceItemId, TenantContext context) throws InvoiceApiException
- Parameters:
invoiceItemId- invoice item idcontext- the tenant context- Returns:
- Throws:
InvoiceApiException
-
getUnpaidInvoicesByAccountId
Collection<Invoice> getUnpaidInvoicesByAccountId(UUID accountId, org.joda.time.LocalDate fromDate, org.joda.time.LocalDate upToDate, TenantContext context)
Find unpaid invoices for a given account, up to a given day.- Parameters:
accountId- account idfromDate- the earliest included target day to consider, in the account timezoneupToDate- the latest included target day to consider, in the account timezonecontext- the tenant context- Returns:
- a collection of invoices
-
triggerInvoiceGeneration
Invoice triggerInvoiceGeneration(UUID accountId, org.joda.time.LocalDate targetDate, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Trigger an invoice for a given account and a given day.- Parameters:
accountId- account idtargetDate- the target day, in the account timezoneproperties- plugin specific propertiescontext- the call context- Returns:
- the invoice generated
- Throws:
InvoiceApiException
-
triggerInvoiceGroupGeneration
Iterable<Invoice> triggerInvoiceGroupGeneration(UUID accountId, org.joda.time.LocalDate targetDate, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Trigger an invoice for a given account and a given day. If there is an active plugin implementing the InvoicePluginApi#getInvoiceGrouping it will be invoked, and as a result we may end up with N invoices.- Parameters:
accountId- account idtargetDate- the target day, in the account timezoneproperties- plugin specific propertiescontext- the call context- Returns:
- the invoice generated
- Throws:
InvoiceApiException
-
triggerDryRunInvoiceGeneration
Invoice triggerDryRunInvoiceGeneration(UUID accountId, org.joda.time.LocalDate targetDate, DryRunArguments dryRunArguments, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Trigger an invoice for a given account and a given day.- Parameters:
accountId- account idtargetDate- the target day, in the account timezonedryRunArguments- dry run argumentsproperties- plugin specific propertiescontext- the call context- Returns:
- the invoice generated
- Throws:
InvoiceApiException
-
tagInvoiceAsWrittenOff
void tagInvoiceAsWrittenOff(UUID invoiceId, CallContext context) throws TagApiException, InvoiceApiException
Mark an invoice as written off.- Parameters:
invoiceId- invoice idcontext- call context- Throws:
TagApiExceptionInvoiceApiException
-
tagInvoiceAsNotWrittenOff
void tagInvoiceAsNotWrittenOff(UUID invoiceId, CallContext context) throws TagApiException, InvoiceApiException
Unmark an invoice as written off.- Parameters:
invoiceId- invoice idcontext- call context- Throws:
TagApiExceptionInvoiceApiException
-
getExternalChargeById
InvoiceItem getExternalChargeById(UUID externalChargeId, TenantContext context) throws InvoiceApiException
Retrieve an external charge by id.- Parameters:
externalChargeId- external charge idcontext- the tenant context- Returns:
- the external charge
- Throws:
InvoiceApiException
-
insertExternalCharges
List<InvoiceItem> insertExternalCharges(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> charges, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Add one or multiple external charges to an account.- Parameters:
accountId- account ideffectiveDate- the effective date for newly created invoices (in the account timezone)charges- the chargesautoCommit- the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sentcontext- the call context- Returns:
- the external charges invoice items
- Throws:
InvoiceApiException
-
insertTaxItems
List<InvoiceItem> insertTaxItems(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> taxes, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Add one or multiple tax items to one invoice.- Parameters:
accountId- account ideffectiveDate- the effective date for newly created invoice (in the account timezone)taxes- the tax itemsautoCommit- the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sentcontext- the call context- Returns:
- the tax invoice items
- Throws:
InvoiceApiException
-
getCreditById
InvoiceItem getCreditById(UUID creditId, TenantContext context) throws InvoiceApiException
Retrieve a credit by id.- Parameters:
creditId- credit idcontext- the tenant context- Returns:
- the credit
- Throws:
InvoiceApiException
-
insertCredits
List<InvoiceItem> insertCredits(UUID accountId, org.joda.time.LocalDate effectiveDate, Iterable<InvoiceItem> creditItems, boolean autoCommit, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Add a credit to an account.- Parameters:
accountId- account ideffectiveDate- the day to grant the credit, in the account timezonecreditItems- the list of credits to addautoCommit- the flag to indicate if the invoice is set to COMMITTED or DRAFT and events are sentcontext- the call contextproperties- the plugin specific properties- Returns:
- the credit invoice items
- Throws:
InvoiceApiException
-
insertInvoiceItemAdjustment
InvoiceItem insertInvoiceItemAdjustment(UUID accountId, UUID invoiceId, UUID invoiceItemId, org.joda.time.LocalDate effectiveDate, String description, String itemDetails, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Adjust fully a given invoice item.- Parameters:
accountId- account idinvoiceId- invoice idinvoiceItemId- invoice item ideffectiveDate- the effective date for this adjustment invoice item (in the account timezone)description- the item descriptionitemDetails- the item detailsproperties- the plugin specific propertiescontext- the call context- Returns:
- the adjustment invoice item
- Throws:
InvoiceApiException
-
insertInvoiceItemAdjustment
InvoiceItem insertInvoiceItemAdjustment(UUID accountId, UUID invoiceId, UUID invoiceItemId, org.joda.time.LocalDate effectiveDate, BigDecimal amount, Currency currency, String description, String itemDetails, Iterable<PluginProperty> properties, CallContext context) throws InvoiceApiException
Adjust partially a given invoice item.- Parameters:
accountId- account idinvoiceId- invoice idinvoiceItemId- invoice item ideffectiveDate- the effective date for this adjustment invoice item (in the account timezone)amount- the adjustment amountcurrency- adjustment currencydescription- the item descriptionitemDetails- the item detailsproperties- the plugin specific propertiescontext- the call context- Returns:
- the adjustment invoice item
- Throws:
InvoiceApiException
-
deleteCBA
void deleteCBA(UUID accountId, UUID invoiceId, UUID invoiceItemId, CallContext context) throws InvoiceApiException
Delete a CBA item.- Parameters:
accountId- account idinvoiceId- invoice idinvoiceItemId- invoice item id (must be of type CBA_ADJ)context- the call context- Throws:
InvoiceApiException
-
getInvoiceAsHTML
String getInvoiceAsHTML(UUID invoiceId, TenantContext context) throws AccountApiException, IOException, InvoiceApiException
Retrieve the invoice formatted in HTML.- Parameters:
invoiceId- invoice idcontext- the tenant context- Returns:
- the invoice in HTML format
- Throws:
AccountApiExceptionIOExceptionInvoiceApiException
-
consumeExistingCBAOnAccountWithUnpaidInvoices
void consumeExistingCBAOnAccountWithUnpaidInvoices(UUID accountId, CallContext context)
Rebalance CBA for account which have credit and unpaid invoices-- only needed if system is configured to not rebalance automatically.- Parameters:
accountId- account idcontext- the call context
-
commitInvoice
void commitInvoice(UUID invoiceId, CallContext context) throws InvoiceApiException
Move the invoice status from DRAFT to COMMITTED- Parameters:
invoiceId- invoice idcontext- the tenant context- Throws:
InvoiceApiException
-
createMigrationInvoice
UUID createMigrationInvoice(UUID accountId, org.joda.time.LocalDate invoiceDate, Iterable<InvoiceItem> items, CallContext context)
- Parameters:
accountId- account idinvoiceDate- maximum billing event day to consider (in the account timezone)items- items to be placed on the migration invoicecontext- call call context- Returns:
- The UUID of the created invoice
-
transferChildCreditToParent
void transferChildCreditToParent(UUID childAccountId, CallContext context) throws InvoiceApiException
Move a given child credit to the parent level- Parameters:
childAccountId- child account idcontext- the tenant context- Throws:
InvoiceApiException
-
getInvoiceItemsByParentInvoice
List<InvoiceItem> getInvoiceItemsByParentInvoice(UUID parentInvoiceId, TenantContext context) throws InvoiceApiException
Retrieve invoice items details associated to Parent SUMMARY invoice item- Parameters:
parentInvoiceId- the parent invoice idcontext- the tenant context- Returns:
- a list of invoice items associated with a parent invoice
- Throws:
InvoiceApiException- if any unexpected error occurs
-
voidInvoice
void voidInvoice(UUID invoiceId, CallContext context) throws InvoiceApiException
Move the invoice status from DRAFT or COMMITTED to VOID- Parameters:
invoiceId- invoice idcontext- the tenant context- Throws:
InvoiceApiException
-
getInvoiceAuditLogsWithHistoryForId
List<AuditLogWithHistory> getInvoiceAuditLogsWithHistoryForId(UUID invoiceId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given invoice.- Parameters:
invoiceId- the invoice idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for an invoice
-
getInvoiceItemAuditLogsWithHistoryForId
List<AuditLogWithHistory> getInvoiceItemAuditLogsWithHistoryForId(UUID invoiceItemId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given invoice item.- Parameters:
invoiceItemId- the invoice item idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for an invoice item
-
getInvoicePaymentAuditLogsWithHistoryForId
List<AuditLogWithHistory> getInvoicePaymentAuditLogsWithHistoryForId(UUID invoicePaymentId, AuditLevel auditLevel, TenantContext context)
Get all the audit entries with history for a given invoice payment.- Parameters:
invoicePaymentId- the invoice payment idauditLevel- audit level (verbosity)context- the tenant context- Returns:
- all audit entries with history for an invoice payment
-
-