Package net.amcintosh.freshbooks.models
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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumDescription of deposits applied to invoice.static enumDescription of status.static enumstatic enumDescription of payment status.static classInvoice Presentations are used to style an invoice including font, colors, and logos.static enumStatus values for an invoice.static enumv3 status fields give a descriptive name to states which can be used in filters.Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.FlagsNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet unique identifier of the account the invoice exists on.Get unique identifier of the account the invoice exists on.First line of address on invoice.Total amount of invoiceOne of retry, failed, or success.getCity()City for address on invoice.longGet the id of the client the invoice is for.getCode()Postal/ZIP code for address on invoice.Return the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.Country for address on invoice.Get the time the invoice was created.Date the invoice was created.Three-letter currency code for invoice.The current name of the client's organization.longGet the id of the client the invoice is for.Date invoice was fully paid.Amount required as deposit if required.Percent of the invoice's value required as a deposit.Description of deposits applied to invoice.Description of first line of invoiceClient-visible note about discount.Amount outstanding on invoice.Percent amount being discounted from the subtotal.Description of status.Date invoice is marked as due by calculated fromdue_offset_days.intNumber of days from creation that invoice is due.longId of associated estimate, 0 if none.First name of client being invoiced.The date the invoice was generated from a invoice profile or null if it was not generated.longgetId()Get the unique identifier of this invoice within this business.longGet unique to this business id for invoice.The user-specified number that appears on the invoice.Two-letter language code, e.g.Last name of client being invoiced.Describes status of last attempted payment.getLines()Lines of the invoice.getNotes()Notes listed on invoice.Name of organization being invoiced.Amount outstanding on invoice.longId of creator of invoice.getPaid()Amount paid on invoice.longId of object this invoice was generated from, 0 if noneDescription of payment status.Reference number for address on invoice.Define invoice logo and styles.Province/state for address on invoice.longUser id of user who sent the invoice.Get the status of the invoice.Street for address on invoice.Second line of street for address on invoice.getTerms()Terms listed on invoice.Get the time of last modification to the invoice.v3 status fields give a descriptive name to states which can be used in filtersValue Added Tax name of client if provided.Value Added Tax number of client if provided.Get the visibility state: active, deleted, or archivedbooleanWhether this invoice has a credit card saved.booleanWhether to send via ground mail.booleanWhether attachments on invoice are rendered in FreshBooks UI.booleanBy default, if no presentation specified in new invoice request payload, it will be assigned a default presentation.voidsetAddress(String address) First line of address on invoice.voidsetAutoBill(boolean autoBill) Whether this invoice has a credit card saved.voidsetAutoBillStatus(Invoice.InvoiceAutoBillStatus autoBillStatus) One of retry, failed, or success.voidCity for address on invoice.voidsetClientId(long clientId) Set the id of the client the invoice is for.voidPostal/ZIP code for address on invoice.voidsetCountry(String country) Country for address on invoice.voidsetCreateDate(LocalDate createDate) Date the invoice was created.voidsetCurrencyCode(String currencyCode) Three-letter currency code for invoice.voidsetCustomerId(long customerId) Set the id of the client the invoice is for.voidsetDepositAmount(Money depositAmount) Amount required as deposit if required.voidsetDepositPercentage(BigDecimal depositPercentage) Percent of the invoice's value required as a deposit.voidsetDepositStatus(Invoice.InvoiceDepositStatus depositStatus) Description of deposits applied to invoice.voidsetDiscountDescription(String discountDescription) Client-visible note about discount.voidsetDiscountValue(BigDecimal discountValue) Percent amount being discounted from the subtotal, decimal amount ranging from 0 to 100.voidsetDisplayStatus(Invoice.InvoiceDisplayStatus displayStatus) Description of status.voidsetDueOffsetDays(int dueOffsetDays) Number of days from creation that invoice is due.voidsetEstimateId(long estimateId) Id of associated estimatevoidsetFirstName(String fname) First name of client being invoiced.voidsetGenerationDate(LocalDate generationDate) The date the invoice was generated from a invoice profile or null if it was not generated.voidsetInvoiceNumber(String invoiceNumber) The user-specified number that appears on the invoice.voidsetLanguage(String language) Two-letter language code, e.g.voidsetLastName(String lname) Last name of client being invoiced.voidsetLastOrderStatus(Invoice.InvoiceOrderStatus lastOrderStatus) Describes status of last attempted payment.voidLines of the invoice.voidNotes listed on invoice.voidsetOrganization(String organization) Name of organization being invoiced.voidsetOwnerId(long ownerId) User id of creator of invoice.voidsetParent(long parent) Id of object this invoice was generated from, 0 if none
Note: This is only writeable on creation.voidsetPaymentStatus(Invoice.InvoicePaymentStatus paymentStatus) Description of payment status.voidsetPONumber(String PONumber) Reference number for address on invoice.voidsetPresentation(Invoice.InvoicePresentation presentation) Define invoice logo and styles.voidsetProvince(String province) Province/state for address on invoice.voidsetSentId(long sentId) User id of user who sent the invoice.voidsetShowAttachments(boolean showAttachments) Whether attachments on invoice are rendered in FreshBooks UI.voidsetStatus(Invoice.InvoiceStatus status) Set the status of the invoice.voidStreet for address on invoice.voidsetStreet2(String street2) Second line of street for address on invoice.voidTerms listed on invoice.voidsetUseDefaultPresentation(boolean useDefaultPresentation) By default, if no presentation specified in new invoice request payload, it will be assigned a default presentation.voidsetV3Status(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.voidsetVATName(String VATName) Value Added Tax name of client.voidsetVATNumber(String VATNumber) Value Added Tax number of client.voidsetVisState(VisState visState) Set the visibility state of the invoice.Methods inherited from class com.google.api.client.json.GenericJson
clone, getFactory, set, setFactory, toPrettyString, toStringMethods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeysMethods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
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 asgetId.- Returns:
- The id of the invoice
-
getAccountingSystemId
Get unique identifier of the account the invoice exists on.- Returns:
- Accounting System Id
-
getAccountId
Get unique identifier of the account the invoice exists on. The same asgetAccountingSystemId().- Returns:
- Accounting System Id
-
getAddress
First line of address on invoice.- Returns:
- String of the address
-
setAddress
First line of address on invoice.- Parameters:
address- String of the address
-
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
One of retry, failed, or success.- Returns:
-
setAutoBillStatus
One of retry, failed, or success.
Note: This is only writeable on creation.- Parameters:
autoBillStatus-
-
getCity
City for address on invoice.- Returns:
-
setCity
City for address on invoice.- Parameters:
city-
-
getCode
Postal/ZIP code for address on invoice.- Returns:
-
setCode
Postal/ZIP code for address on invoice.- Parameters:
code-
-
getCountry
Country for address on invoice.- Returns:
-
setCountry
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 usescustomeridrather thanclientid, so this method is identical togetCustomerId().- 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 usescustomeridrather thanclientid, so this method is identical tosetCustomerId().- Parameters:
clientId- Id of client
-
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
Date the invoice was created.
This is sent to the API in YYYY-MM-DD format.- Parameters:
createDate-
-
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
Three-letter currency code for invoice.- Returns:
-
setCurrencyCode
Three-letter currency code for invoice.- Parameters:
currencyCode-
-
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 usescustomeridrather thanclientid, so this method is identical togetClientId().- 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 usescustomeridrather thanclientid, so this method is identical tosetClientId().- Parameters:
customerId- Id of client
-
getDatePaid
Date invoice was fully paid. The API returns this in YYYY-MM-DD format.- Returns:
- date object
-
getDepositAmount
Amount required as deposit if required.- Returns:
- Money object of required deposit
-
setDepositAmount
Amount required as deposit if required. Can be set directly or calculated by the invoicedepositPercentage.- Parameters:
depositAmount- Money object of required deposit
-
getDepositStatus
Description of deposits applied to invoice.- Returns:
-
setDepositStatus
Description of deposits applied to invoice.
Note: This is only writeable on creation.- Parameters:
depositStatus-
-
getDepositPercentage
Percent of the invoice's value required as a deposit.- Returns:
- BigDecimal of percentage
-
setDepositPercentage
Percent of the invoice's value required as a deposit. If set, invoice will have adepositAmountcalculated.- Parameters:
depositPercentage- BigDecimal of percentage
-
getDescription
Description of first line of invoice- Returns:
- The description
-
getDiscountDescription
Client-visible note about discount.- Returns:
-
setDiscountDescription
Client-visible note about discount.- Parameters:
discountDescription-
-
getDiscountTotal
Amount outstanding on invoice.- Returns:
- Object containing amount and currency code.
-
getDiscountValue
Percent amount being discounted from the subtotal.- Returns:
- BigDecimal of percentage
-
setDiscountValue
Percent amount being discounted from the subtotal, decimal amount ranging from 0 to 100.- Parameters:
discountValue- BigDecimal of percentage
-
getDisplayStatus
Description of status. Used primarily for the FreshBooks UI.- Returns:
- InvoiceDisplayStatus value
-
setDisplayStatus
Description of status. Used primarily for the FreshBooks UI.
Note: This is only writeable on creation.- Parameters:
displayStatus-
-
getDueDate
Date invoice is marked as due by calculated fromdue_offset_days. Ifdue_offset_daysis 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
First name of client being invoiced.- Returns:
-
setFirstName
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
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
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
The user-specified number that appears on the invoice.- Returns:
- The invoice number
-
setInvoiceNumber
The user-specified number that appears on the invoice.- Parameters:
invoiceNumber- The invoice number
-
getLanguage
Two-letter language code, e.g. "en".- Returns:
-
setLanguage
Two-letter language code, e.g. "en".- Parameters:
language-
-
getLastOrderStatus
Describes status of last attempted payment.- Returns:
-
setLastOrderStatus
Describes status of last attempted payment.
Note: This is only writeable on creation.- Parameters:
lastOrderStatus-
-
getLastName
Last name of client being invoiced.- Returns:
-
setLastName
Last name of client being invoiced.- Parameters:
lname-
-
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
Lines of the invoice.- Parameters:
lines-
-
getNotes
Notes listed on invoice.- Returns:
-
setNotes
Notes listed on invoice.- Parameters:
notes-
-
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
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
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
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
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
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
Reference number for address on invoice.- Returns:
-
setPONumber
Reference number for address on invoice.- Parameters:
PONumber-
-
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, setuseDefaultPresentationto 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
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, setuseDefaultPresentationto 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
Province/state for address on invoice.- Returns:
-
setProvince
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
Street for address on invoice.- Returns:
-
setStreet
Street for address on invoice.- Parameters:
street-
-
getStreet2
Second line of street for address on invoice.- Returns:
-
setStreet2
Second line of street for address on invoice.- Parameters:
street2-
-
getStatus
Get the status of the invoice.- Returns:
- Enum of the invoice status.
-
setStatus
Set the status of the invoice. This is only writable at creation and cannot be manually set later.- Parameters:
status- InvoiceStatus value
-
getTerms
Terms listed on invoice.- Returns:
-
setTerms
Terms listed on invoice.- Parameters:
terms-
-
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
v3 status fields give a descriptive name to states which can be used in filters- Returns:
- InvoiceV3Status value
-
setV3Status
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
Value Added Tax name of client if provided.- Returns:
-
setVATName
Value Added Tax name of client.- Parameters:
VATName-
-
getVATNumber
Value Added Tax number of client if provided.- Returns:
-
setVATNumber
Value Added Tax number of client.- Parameters:
VATNumber-
-
getVisState
Get the visibility state: active, deleted, or archived- Returns:
- Enum of the visibility state.
- See Also:
-
setVisState
Set the visibility state of the invoice.- Parameters:
visState- VisState value- See Also:
-
getContent
Description copied from interface:ConvertibleContentReturn the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.- Specified by:
getContentin interfaceConvertibleContent- Returns:
-