Class Invoice

java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.json.GenericJson
net.amcintosh.freshbooks.models.Invoice
All Implemented Interfaces:
Cloneable, Map<String,Object>, ConvertibleContent

public class Invoice extends com.google.api.client.json.GenericJson implements ConvertibleContent
Invoices in FreshBooks are what gets sent to Clients, detailing specific goods or services performed or provided by the Administrator of their System, and the amount that Client owes to the Admin.
See Also:
  • Constructor Details

    • Invoice

      public Invoice()
  • Method Details

    • getId

      public long getId()
      Get the unique identifier of this invoice within this business.
      Returns:
      The id of the invoice
    • getInvoiceId

      public long getInvoiceId()
      Get unique to this business id for invoice. Note: This is the same as getId.
      Returns:
      The id of the invoice
    • getAccountingSystemId

      public String getAccountingSystemId()
      Get unique identifier of the account the invoice exists on.
      Returns:
      Accounting System Id
    • getAccountId

      public String getAccountId()
      Get unique identifier of the account the invoice exists on. The same as getAccountingSystemId().
      Returns:
      Accounting System Id
    • getAddress

      public String getAddress()
      First line of address on invoice.
      Returns:
      String of the address
    • setAddress

      public void setAddress(String address)
      First line of address on invoice.
      Parameters:
      address - String of the address
    • getAmount

      public Money getAmount()
      Total amount of invoice
      Returns:
      Object containing amount and currency code.
    • isAutoBill

      public boolean isAutoBill()
      Whether this invoice has a credit card saved.
      Returns:
      boolean if invoice has autobill enabled.
    • setAutoBill

      public void setAutoBill(boolean autoBill)
      Whether this invoice has a credit card saved.

      Note: This is only writeable on creation.
      Parameters:
      autoBill -
    • getAutoBillStatus

      public Invoice.InvoiceAutoBillStatus getAutoBillStatus()
      One of retry, failed, or success.
      Returns:
    • setAutoBillStatus

      public void setAutoBillStatus(Invoice.InvoiceAutoBillStatus autoBillStatus)
      One of retry, failed, or success.

      Note: This is only writeable on creation.
      Parameters:
      autoBillStatus -
    • getCity

      public String getCity()
      City for address on invoice.
      Returns:
    • setCity

      public void setCity(String city)
      City for address on invoice.
      Parameters:
      city -
    • getCode

      public String getCode()
      Postal/ZIP code for address on invoice.
      Returns:
    • setCode

      public void setCode(String code)
      Postal/ZIP code for address on invoice.
      Parameters:
      code -
    • getCountry

      public String getCountry()
      Country for address on invoice.
      Returns:
    • setCountry

      public void setCountry(String country)
      Country for address on invoice.
      Parameters:
      country -
    • getClientId

      public long getClientId()
      Get the id of the client the invoice is for.

      Note: The API request/response uses customerid rather than clientid, so this method is identical to getCustomerId().
      Returns:
      Id of client
    • setClientId

      public void setClientId(long clientId)
      Set the id of the client the invoice is for.

      Note: The API request/response uses customerid rather than clientid, so this method is identical to setCustomerId().
      Parameters:
      clientId - Id of client
    • getCreateDate

      public LocalDate getCreateDate()
      Date the invoice was created.
      The API returns this in YYYY-MM-DD format. It is converted to a LocalDate.
      Returns:
      converted LocalDate object
    • setCreateDate

      public void setCreateDate(LocalDate createDate)
      Date the invoice was created.
      This is sent to the API in YYYY-MM-DD format.
      Parameters:
      createDate -
    • getCreatedAt

      public ZonedDateTime getCreatedAt()
      Get the time the invoice was created.

      Note: The API returns this data in "US/Eastern", but it is converted here to UTC.
      Returns:
      Created time in UTC
    • getCurrencyCode

      public String getCurrencyCode()
      Three-letter currency code for invoice.
      Returns:
    • setCurrencyCode

      public void setCurrencyCode(String currencyCode)
      Three-letter currency code for invoice.
      Parameters:
      currencyCode -
    • getCurrentOrganization

      public String getCurrentOrganization()
      The current name of the client's organization. Once an invoice is set, the organization will not reflect any changes to the client but the current organization is available.
      Returns:
      The client organization
    • getCustomerId

      public long getCustomerId()
      Get the id of the client the invoice is for.

      Note: The API request/response uses customerid rather than clientid, so this method is identical to getClientId().
      Returns:
      Id of client
    • setCustomerId

      public void setCustomerId(long customerId)
      Set the id of the client the invoice is for.

      Note: The API request/response uses customerid rather than clientid, so this method is identical to setClientId().
      Parameters:
      customerId - Id of client
    • getDatePaid

      public LocalDate getDatePaid()
      Date invoice was fully paid. The API returns this in YYYY-MM-DD format.
      Returns:
      date object
    • getDepositAmount

      public Money getDepositAmount()
      Amount required as deposit if required.
      Returns:
      Money object of required deposit
    • setDepositAmount

      public void setDepositAmount(Money depositAmount)
      Amount required as deposit if required. Can be set directly or calculated by the invoice depositPercentage.
      Parameters:
      depositAmount - Money object of required deposit
    • getDepositStatus

      public Invoice.InvoiceDepositStatus getDepositStatus()
      Description of deposits applied to invoice.
      Returns:
    • setDepositStatus

      public void setDepositStatus(Invoice.InvoiceDepositStatus depositStatus)
      Description of deposits applied to invoice.

      Note: This is only writeable on creation.
      Parameters:
      depositStatus -
    • getDepositPercentage

      public BigDecimal getDepositPercentage()
      Percent of the invoice's value required as a deposit.
      Returns:
      BigDecimal of percentage
    • setDepositPercentage

      public void setDepositPercentage(BigDecimal depositPercentage)
      Percent of the invoice's value required as a deposit. If set, invoice will have a depositAmount calculated.
      Parameters:
      depositPercentage - BigDecimal of percentage
    • getDescription

      public String getDescription()
      Description of first line of invoice
      Returns:
      The description
    • getDiscountDescription

      public String getDiscountDescription()
      Client-visible note about discount.
      Returns:
    • setDiscountDescription

      public void setDiscountDescription(String discountDescription)
      Client-visible note about discount.
      Parameters:
      discountDescription -
    • getDiscountTotal

      public Money getDiscountTotal()
      Amount outstanding on invoice.
      Returns:
      Object containing amount and currency code.
    • getDiscountValue

      public BigDecimal getDiscountValue()
      Percent amount being discounted from the subtotal.
      Returns:
      BigDecimal of percentage
    • setDiscountValue

      public void setDiscountValue(BigDecimal discountValue)
      Percent amount being discounted from the subtotal, decimal amount ranging from 0 to 100.
      Parameters:
      discountValue - BigDecimal of percentage
    • getDisplayStatus

      public Invoice.InvoiceDisplayStatus getDisplayStatus()
      Description of status. Used primarily for the FreshBooks UI.
      Returns:
      InvoiceDisplayStatus value
    • setDisplayStatus

      public void setDisplayStatus(Invoice.InvoiceDisplayStatus displayStatus)
      Description of status. Used primarily for the FreshBooks UI.

      Note: This is only writeable on creation.
      Parameters:
      displayStatus -
    • getDueDate

      public LocalDate getDueDate()
      Date invoice is marked as due by calculated from due_offset_days. If due_offset_days is not set, it will default to the date of issue. The API returns this in YYYY-MM-DD format.
      Returns:
      date object
    • getDueOffsetDays

      public int getDueOffsetDays()
      Number of days from creation that invoice is due.
      Returns:
    • setDueOffsetDays

      public void setDueOffsetDays(int dueOffsetDays)
      Number of days from creation that invoice is due.
      If not set, the due date will default to the date of issue.
      Parameters:
      dueOffsetDays -
    • getFirstName

      public String getFirstName()
      First name of client being invoiced.
      Returns:
    • setFirstName

      public void setFirstName(String fname)
      First name of client being invoiced.
      Parameters:
      fname -
    • getEstimateId

      public long getEstimateId()
      Id of associated estimate, 0 if none.
      Returns:
      Id of estimate
    • setEstimateId

      public void setEstimateId(long estimateId)
      Id of associated estimate
      Parameters:
      estimateId - Id of estimate
    • getGenerationDate

      public LocalDate getGenerationDate()
      The date the invoice was generated from a invoice profile or null if it was not generated.
      The API returns this in YYYY-MM-DD format.
      Returns:
      date object
    • setGenerationDate

      public void setGenerationDate(LocalDate generationDate)
      The date the invoice was generated from a invoice profile or null if it was not generated.
      Parameters:
      generationDate - The date
    • isGroundMail

      public boolean isGroundMail()
      Whether to send via ground mail.
      Returns:
    • getInvoiceNumber

      public String getInvoiceNumber()
      The user-specified number that appears on the invoice.
      Returns:
      The invoice number
    • setInvoiceNumber

      public void setInvoiceNumber(String invoiceNumber)
      The user-specified number that appears on the invoice.
      Parameters:
      invoiceNumber - The invoice number
    • getLanguage

      public String getLanguage()
      Two-letter language code, e.g. "en".
      Returns:
    • setLanguage

      public void setLanguage(String language)
      Two-letter language code, e.g. "en".
      Parameters:
      language -
    • getLastOrderStatus

      public Invoice.InvoiceOrderStatus getLastOrderStatus()
      Describes status of last attempted payment.
      Returns:
    • setLastOrderStatus

      public void setLastOrderStatus(Invoice.InvoiceOrderStatus lastOrderStatus)
      Describes status of last attempted payment.

      Note: This is only writeable on creation.
      Parameters:
      lastOrderStatus -
    • getLastName

      public String getLastName()
      Last name of client being invoiced.
      Returns:
    • setLastName

      public void setLastName(String lname)
      Last name of client being invoiced.
      Parameters:
      lname -
    • getLines

      public List<LineItem> getLines()
      Lines of the invoice.

      Note: These are only returned with a invoice call using a "lines" include.
      Eg.
      
           IncludesQueryBuilder inc = new IncludesQueryBuilder().include("lines");
      
           Invoice invoiceResponse = invoices.get(accountId, invoiceId, inc);
      
           ArrayList<QueryBuilder> builders = new ArrayList<QueryBuilder>();
           builders.add(inc);
           InvoiceList invoiceListResponse = invoices.list(accountId, builders);
       
      Returns:
    • setLines

      public void setLines(List<LineItem> lines)
      Lines of the invoice.
      Parameters:
      lines -
    • getNotes

      public String getNotes()
      Notes listed on invoice.
      Returns:
    • setNotes

      public void setNotes(String notes)
      Notes listed on invoice.
      Parameters:
      notes -
    • getOrganization

      public String getOrganization()
      Name of organization being invoiced. This is the value of the organization of the client but is denormalized so that changes to the client are not reflected on past invoices.
      Returns:
      The client organization
    • setOrganization

      public void setOrganization(String organization)
      Name of organization being invoiced. This is the value of the organization of the client but is denormalized so that changes to the client are not reflected on past invoices.
      Parameters:
      organization - The client organization
    • getOutstanding

      public Money getOutstanding()
      Amount outstanding on invoice.
      Returns:
      Object containing amount and currency code.
    • getOwnerId

      public long getOwnerId()
      Id of creator of invoice. 1 if business admin, other if created by another user. Eg. a contractor.
      Returns:
      User id from system
    • setOwnerId

      public void setOwnerId(long ownerId)
      User id of creator of invoice. Typically 1 for the business admin.

      Note: This is only writeable on creation.
      Parameters:
      ownerId - User id
    • getPaid

      public Money getPaid()
      Amount paid on invoice.
      Returns:
      Object containing amount and currency code.
    • getParent

      public long getParent()
      Id of object this invoice was generated from, 0 if none
      Returns:
      Id of parent resource
    • setParent

      public void setParent(long parent)
      Id of object this invoice was generated from, 0 if none

      Note: This is only writeable on creation.
      Parameters:
      parent - Id of the parent resource
    • getPaymentStatus

      public Invoice.InvoicePaymentStatus getPaymentStatus()
      Description of payment status. One of 'unpaid', 'partial', 'paid', and 'auto-paid'.
      See the v3_status table on this page for descriptions of each.
      Returns:
    • setPaymentStatus

      public void setPaymentStatus(Invoice.InvoicePaymentStatus paymentStatus)
      Description of payment status. One of 'unpaid', 'partial', 'paid', and 'auto-paid'.
      See the v3_status table on this page for descriptions of each.

      Note: This is only writeable on creation.
      Parameters:
      paymentStatus -
    • getPONumber

      public String getPONumber()
      Reference number for address on invoice.
      Returns:
    • setPONumber

      public void setPONumber(String PONumber)
      Reference number for address on invoice.
      Parameters:
      PONumber -
    • getPresentation

      public Invoice.InvoicePresentation getPresentation()
      Define invoice logo and styles.
      By default, if no presentation specified in a new invoice request payload, it will be assigned a default presentation. To override this default behaviour, set useDefaultPresentation to false.

      Note: The presentation details are only returned with a invoice call using a "presentation" include.
      
           IncludesQueryBuilder inc = new IncludesQueryBuilder().include("presentation");
      
           Invoice invoiceResponse = invoices.get(accountId, invoiceId, inc);
      
           ArrayList<QueryBuilder> builders = new ArrayList<QueryBuilder>();
           builders.add(inc);
           InvoiceList invoiceListResponse = invoices.list(accountId, builders);
       
      Returns:
    • setPresentation

      public void setPresentation(Invoice.InvoicePresentation presentation)
      Define invoice logo and styles.
      By default, if no presentation specified in a new invoice request payload, it will be assigned a default presentation. To override this default behaviour, set useDefaultPresentation to false.

      Note: The presentation details are only returned with a invoice call using a "presentation" include.
      
           IncludesQueryBuilder inc = new IncludesQueryBuilder().include("presentation");
      
           Invoice invoiceResponse = invoices.get(accountId, invoiceId, inc);
      
           ArrayList<QueryBuilder> builders = new ArrayList<QueryBuilder>();
           builders.add(inc);
           InvoiceList invoiceListResponse = invoices.list(accountId, builders);
       
      Parameters:
      presentation -
    • getProvince

      public String getProvince()
      Province/state for address on invoice.
      Returns:
    • setProvince

      public void setProvince(String province)
      Province/state for address on invoice.
      Parameters:
      province -
    • getSentId

      public long getSentId()
      User id of user who sent the invoice. Typically 1 for the business admin.
      Returns:
      User id from system
    • setSentId

      public void setSentId(long sentId)
      User id of user who sent the invoice. Typically 1 for the business admin.

      Note: This is only writeable on creation.
      Parameters:
      sentId - User id
    • isShowAttachments

      public boolean isShowAttachments()
      Whether attachments on invoice are rendered in FreshBooks UI.
      Returns:
    • setShowAttachments

      public void setShowAttachments(boolean showAttachments)
      Whether attachments on invoice are rendered in FreshBooks UI.
      Parameters:
      showAttachments -
    • getStreet

      public String getStreet()
      Street for address on invoice.
      Returns:
    • setStreet

      public void setStreet(String street)
      Street for address on invoice.
      Parameters:
      street -
    • getStreet2

      public String getStreet2()
      Second line of street for address on invoice.
      Returns:
    • setStreet2

      public void setStreet2(String street2)
      Second line of street for address on invoice.
      Parameters:
      street2 -
    • getStatus

      public Invoice.InvoiceStatus getStatus()
      Get the status of the invoice.
      Returns:
      Enum of the invoice status.
    • setStatus

      public void setStatus(Invoice.InvoiceStatus status)
      Set the status of the invoice. This is only writable at creation and cannot be manually set later.
      Parameters:
      status - InvoiceStatus value
    • getTerms

      public String getTerms()
      Terms listed on invoice.
      Returns:
    • setTerms

      public void setTerms(String terms)
      Terms listed on invoice.
      Parameters:
      terms -
    • getUpdated

      public ZonedDateTime getUpdated()
      Get the time of last modification to the invoice.

      Note: The API returns this data in "US/Eastern", but it is converted here to UTC.
      Returns:
      Updated time in UTC
    • isUseDefaultPresentation

      public boolean isUseDefaultPresentation()
      By default, if no presentation specified in new invoice request payload, it will be assigned a default presentation.
      To override this default behaviour, set useDefaultPresentation to false.
      Returns:
    • setUseDefaultPresentation

      public void setUseDefaultPresentation(boolean useDefaultPresentation)
      By default, if no presentation specified in new invoice request payload, it will be assigned a default presentation.
      To override this default behaviour, set useDefaultPresentation to false.
      Parameters:
      useDefaultPresentation -
    • getV3Status

      public Invoice.InvoiceV3Status getV3Status()
      v3 status fields give a descriptive name to states which can be used in filters
      Returns:
      InvoiceV3Status value
    • setV3Status

      public void setV3Status(Invoice.InvoiceV3Status v3Status)
      v3 status fields give a descriptive name to states which can be used in filters

      Note: This is only writeable on creation.
      Parameters:
      v3Status -
    • getVATName

      public String getVATName()
      Value Added Tax name of client if provided.
      Returns:
    • setVATName

      public void setVATName(String VATName)
      Value Added Tax name of client.
      Parameters:
      VATName -
    • getVATNumber

      public String getVATNumber()
      Value Added Tax number of client if provided.
      Returns:
    • setVATNumber

      public void setVATNumber(String VATNumber)
      Value Added Tax number of client.
      Parameters:
      VATNumber -
    • getVisState

      public VisState getVisState()
      Get the visibility state: active, deleted, or archived

      Returns:
      Enum of the visibility state.
      See Also:
    • setVisState

      public void setVisState(VisState visState)
      Set the visibility state of the invoice.

      Parameters:
      visState - VisState value
      See Also:
    • getContent

      public Map<String,Object> getContent()
      Description copied from interface: ConvertibleContent
      Return the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.
      Specified by:
      getContent in interface ConvertibleContent
      Returns: