Class TaxResponse
java.lang.Object
com.onenetwork.platform.common.tax.TaxResponse
public class TaxResponse
extends java.lang.Object
A response to a TaxRequest.
A TaxResponse can contain either an error or a successful response including total tax due
along with TaxResponseLines describing each item from the TaxRequest.
An error TaxResponse can be created with:
TaxResponse.error(errorMessage);A successful TaxResponse can be create with
TaxResponse.success(totalTax, taxResponseLines);
-
Method Summary
Modifier and Type Method Description static TaxResponse
error(java.lang.String errorMessage)
Creates an error TaxResponse with the given error messagejava.util.Optional<java.lang.String>
getError()
Returns the error this TaxResponse contains.java.util.List<TaxResponseLine>
getLines()
Returns the lines of this TaxResponse.double
getTotalTax()
returns the total tax due for this TaxRequestboolean
isSuccess()
Was the TaxRequest successful?static TaxResponse
success(double totalTax, java.util.Collection<TaxResponseLine> lines)
Creates a successful TaxResponse with the given totalTax and TaxResponseLines
-
Method Details
-
error
Creates an error TaxResponse with the given error message -
success
Creates a successful TaxResponse with the given totalTax and TaxResponseLines -
isSuccess
public boolean isSuccess()Was the TaxRequest successful? -
getError
public java.util.Optional<java.lang.String> getError()Returns the error this TaxResponse contains. If there is no error then returns Optional.empty() -
getLines
Returns the lines of this TaxResponse. The returned list is a copy and can be edited without changing this object. -
getTotalTax
public double getTotalTax()returns the total tax due for this TaxRequest
-