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
The following fields are always present but do not need to be specified.
  • 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)
These fields are dependent on the TaxProvider implementation for what effect they will have, if any. They generally require setting up data on the external provider before being useful.
  • 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 request
    java.lang.String getCurrencyCode()
    Currency being used in the transaction
    java.lang.String getCustomerCode()
    Customer who is making the purchase
    java.time.Instant getDate()
    Date of the request should be made for.
    java.util.Optional<java.lang.String> getDescription()
    Description of the transaction
    java.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 NullPointerException
    void 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public java.util.List<TaxRequestLine> 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