Class TaxRequest
java.lang.Object
com.onenetwork.platform.common.tax.TaxRequest
public class TaxRequest
extends java.lang.Object
Represents a request to a TaxProvider for how much tax is due on a transaction.
The following fields are required:
- currencyCode - Currency the transaction will be using. Ex: USD
- date - Date the transaction is being recorded at. This may not be the current date. This may affect which tax laws are considered when calculating tax.
- lines - a collection of TaxRequestLines which will be included in the request
- companyCode - Which company is making the request. Defaults to "DEFAULT". May be used to differentiate which company the request is for if the provider uses this information.
- customerCode - Customer who is making the purchase. Defaults to "UNKNOWN". May be used to determine how much tax is due based on the configured characteristics of the customer (Ex: Tax exempt church)
-
Constructor Summary
Constructors Constructor Description TaxRequest(java.lang.String currencyCode, java.time.Instant date, java.util.Collection<TaxRequestLine> lines)
Constructs a TaxRequest object. -
Method Summary
Modifier and Type Method Description java.lang.String
getCompanyCode()
Company which is making the requestjava.lang.String
getCurrencyCode()
Currency being used in the transactionjava.lang.String
getCustomerCode()
Customer who is making the purchasejava.time.Instant
getDate()
Date of the request should be made for.java.util.Optional<java.lang.String>
getDescription()
Description of the transactionjava.util.List<TaxRequestLine>
getLines()
Lines describing the items being sold.void
setCompanyCode(java.lang.String companyCode)
Sets the company which is making the request If provided null, reverts back to the default value "DEFAULT"void
setCurrencyCode(java.lang.String currencyCode)
Sets the currency being used in the transaction If provided null throws a NullPointerExceptionvoid
setCustomerCode(java.lang.String customerCode)
Sets the customer who is making the purchase If provided null reverts back to the default value "UNKNOWN";void
setDate(java.time.Instant date)
Sets the date of the request should be made for.void
setDescription(java.lang.String description)
Sets the description of the transaction
-
Constructor Details
-
TaxRequest
public TaxRequest(java.lang.String currencyCode, java.time.Instant date, java.util.Collection<TaxRequestLine> lines)Constructs a TaxRequest object. If any of the parameters are null a NullPointerException will be thrown. Defaults companyCode to "DEFAULT" and customerCode to "UNKNOWN".
-
-
Method Details
-
getCompanyCode
public java.lang.String getCompanyCode()Company which is making the request -
setCompanyCode
public void setCompanyCode(java.lang.String companyCode)Sets the company which is making the request If provided null, reverts back to the default value "DEFAULT" -
getCurrencyCode
public java.lang.String getCurrencyCode()Currency being used in the transaction -
setCurrencyCode
public void setCurrencyCode(java.lang.String currencyCode)Sets the currency being used in the transaction If provided null throws a NullPointerException -
getCustomerCode
public java.lang.String getCustomerCode()Customer who is making the purchase -
setCustomerCode
public void setCustomerCode(java.lang.String customerCode)Sets the customer who is making the purchase If provided null reverts back to the default value "UNKNOWN"; -
getDate
public java.time.Instant getDate()Date of the request should be made for. This will affect the tax laws that are considered in case laws go into or out of effect at a certain date. This date need not be the current date. -
setDate
public void setDate(java.time.Instant date)Sets the date of the request should be made for. If provided null a NullPointerException will be thrown -
getDescription
public java.util.Optional<java.lang.String> getDescription()Description of the transaction -
setDescription
public void setDescription(java.lang.String description)Sets the description of the transaction -
getLines
Lines describing the items being sold. Returns the "live" list used to represent this request's lines. Modifying this list will modify the request. Ex: request.getLines().clear() - This will remove all lines from the request- See Also:
TaxRequestLine
-