Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2013 Ning, Inc.
   *
   * Ning licenses this file to you under the Apache License, version 2.0
   * (the "License"); you may not use this file except in compliance with the
   * License.  You may obtain a copy of the License at:
   *
   *    http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  * License for the specific language governing permissions and limitations
  * under the License.
  */
 
 package org.killbill.billing.invoice.api;
 
 import java.util.List;
 import java.util.UUID;
 
 
 import static org.killbill.billing.security.Permission.ACCOUNT_CAN_CHARGE;
 import static org.killbill.billing.security.Permission.ACCOUNT_CAN_CREDIT;
 import static org.killbill.billing.security.Permission.INVOICE_CAN_CREDIT;
 import static org.killbill.billing.security.Permission.INVOICE_CAN_DELETE_CBA;
 import static org.killbill.billing.security.Permission.INVOICE_CAN_ITEM_ADJUST;
 
 public interface InvoiceUserApi {

    
Get all invoices for a given account.

Parameters:
accountId account id
context the tenant context
Returns:
all invoices
 
     public List<InvoicegetInvoicesByAccount(UUID accountIdTenantContext context);

    
Find invoices from a given day, for a given account.

Parameters:
accountId account id
fromDate the earliest target day to consider, in the account timezone
context the tenant context
Returns:
a list of invoices
 
     public List<InvoicegetInvoicesByAccount(UUID accountIdLocalDate fromDateTenantContext context);

    

Parameters:
context the user context
offset the offset of the first result
limit the maximum number of results to retrieve
Returns:
the list of invoices for that tenant
 
     public Pagination<InvoicegetInvoices(Long offsetLong limitTenantContext context);

    
Find all invoices having their id, number, account id or currency matching the search key

Parameters:
searchKey the search key
offset the offset of the first result
limit the maximum number of results to retrieve
context the user context
Returns:
the list of invoices matching this search key for that tenant
 
     public Pagination<InvoicesearchInvoices(String searchKeyLong offsetLong limitTenantContext context);

    
Retrieve the account balance.

Parameters:
accountId account id
context the tenant context
Returns:
the account balance
 
     public BigDecimal getAccountBalance(UUID accountIdTenantContext context);

    
Retrieve the account CBA.

Parameters:
accountId account id
context the tenant context
Returns:
the account CBA
 
     public BigDecimal getAccountCBA(UUID accountIdTenantContext context);

    
Retrieve an invoice by id.

Parameters:
invoiceId invoice id
context the tenant context
Returns:
the invoice
    public Invoice getInvoice(UUID invoiceIdTenantContext contextthrows InvoiceApiException;

    
Get all invoices for a given payment.

Parameters:
paymentId payment id
context the tenant context
Returns:
the invoice
    public Invoice getInvoiceByPayment(UUID paymentIdTenantContext contextthrows InvoiceApiException;

    
Retrieve an invoice by invoice number.

Parameters:
number invoice number
context the tenant context
Returns:
the invoice
    public Invoice getInvoiceByNumber(Integer numberTenantContext contextthrows InvoiceApiException;

    
Find unpaid invoices for a given account, up to a given day.

Parameters:
accountId account id
upToDate the latest target day to consider, in the account timezone
context the tenant context
Returns:
a collection of invoices
    public Collection<InvoicegetUnpaidInvoicesByAccountId(UUID accountIdLocalDate upToDateTenantContext context);

    
Trigger an invoice for a given account and a given day.

Parameters:
accountId account id
targetDate the target day, in the account timezone
dryRun dry run mode or not
context the call context
Returns:
the invoice generated
Throws:
InvoiceApiException
    public Invoice triggerInvoiceGeneration(UUID accountIdLocalDate targetDateboolean dryRunCallContext contextthrows InvoiceApiException;

    
Mark an invoice as written off.

Parameters:
invoiceId invoice id
context call context
Throws:
org.killbill.billing.util.api.TagApiException
    public void tagInvoiceAsWrittenOff(UUID invoiceIdCallContext contextthrows TagApiExceptionInvoiceApiException;

    
Unmark an invoice as written off.

Parameters:
invoiceId invoice id
context call context
Throws:
org.killbill.billing.util.api.TagApiException
    public void tagInvoiceAsNotWrittenOff(UUID invoiceIdCallContext contextthrows TagApiExceptionInvoiceApiException;

    
Retrieve an external charge by id.

Parameters:
externalChargeId external charge id
context the tenant context
Returns:
the external charge
Throws:
InvoiceApiException
    public InvoiceItem getExternalChargeById(UUID externalChargeIdTenantContext contextthrows InvoiceApiException;

    
Add one or multiple external charges to an account.

Parameters:
accountId account id
effectiveDate the effective date for newly created invoices (in the account timezone)
charges the charges
context the call context
Returns:
the external charges invoice items
Throws:
InvoiceApiException
    public List<InvoiceIteminsertExternalCharges(UUID accountIdLocalDate effectiveDateIterable<InvoiceItemchargesCallContext contextthrows InvoiceApiException;

    
Retrieve a credit by id.

Parameters:
creditId credit id
context the tenant context
Returns:
the credit
Throws:
InvoiceApiException
    public InvoiceItem getCreditById(UUID creditIdTenantContext contextthrows InvoiceApiException;

    
Add a credit to an account.

Parameters:
accountId account id
amount the credit amount
effectiveDate the day to grant the credit, in the account timezone
currency the credit currency
context the call context
Returns:
the credit invoice item
Throws:
InvoiceApiException
    public InvoiceItem insertCredit(UUID accountIdBigDecimal amountLocalDate effectiveDate,
                                    Currency currencyCallContext contextthrows InvoiceApiException;

    
Add a credit to an invoice. This can be used to adjust invoices.

Parameters:
accountId account id
invoiceId invoice id
amount the credit amount
effectiveDate the day to grant the credit, in the account timezone
currency the credit currency
context the call context
Returns:
the credit invoice item
Throws:
InvoiceApiException
    public InvoiceItem insertCreditForInvoice(UUID accountIdUUID invoiceIdBigDecimal amountLocalDate effectiveDate,
                                              Currency currencyCallContext contextthrows InvoiceApiException;

    
Adjust fully a given invoice item.

Parameters:
accountId account id
invoiceId invoice id
invoiceItemId invoice item id
effectiveDate the effective date for this adjustment invoice item (in the account timezone)
context the call context
Returns:
the adjustment invoice item
Throws:
InvoiceApiException
    public InvoiceItem insertInvoiceItemAdjustment(UUID accountIdUUID invoiceIdUUID invoiceItemIdLocalDate effectiveDateCallContext contextthrows InvoiceApiException;

    
Adjust partially a given invoice item.

Parameters:
accountId account id
invoiceId invoice id
invoiceItemId invoice item id
effectiveDate the effective date for this adjustment invoice item (in the account timezone)
amount the adjustment amount
currency adjustment currency
context the call context
Returns:
the adjustment invoice item
Throws:
InvoiceApiException
    public InvoiceItem insertInvoiceItemAdjustment(UUID accountIdUUID invoiceIdUUID invoiceItemIdLocalDate effectiveDate,
                                                   BigDecimal amountCurrency currencyCallContext contextthrows InvoiceApiException;

    
Delete a CBA item.

Parameters:
accountId account id
invoiceId invoice id
invoiceItemId invoice item id (must be of type CBA_ADJ)
context the call context
Throws:
InvoiceApiException
    public void deleteCBA(UUID accountIdUUID invoiceIdUUID invoiceItemIdCallContext contextthrows InvoiceApiException;

    
Retrieve the invoice formatted in HTML.

Parameters:
invoiceId invoice id
context the tenant context
Returns:
the invoice in HTML format
Throws:
org.killbill.billing.account.api.AccountApiException
java.io.IOException
InvoiceApiException
    public String getInvoiceAsHTML(UUID invoiceIdTenantContext contextthrows AccountApiExceptionIOExceptionInvoiceApiException;

    
Rebalance CBA for account which have credit and unpaid invoices-- only needed if system is configured to not rebalance automatically.

Parameters:
accountId account id
context the callcontext
    public void consumeExstingCBAOnAccountWithUnpaidInvoices(final UUID accountIdfinal CallContext context);
New to GrepCode? Check out our FAQ X