TaxEngineContext Class

Wrapper class that stores details about the type of a tax calculation request.

CommerceTax

At the beginning of a tax adapter, use TaxEngineContext class to pass the value of a request type to an instance of RequestType.

Build the rest of your adapter based on the type of request that you got from TaxEngineContext class.

Learn more about the available constructors with the TaxEngineContext class.

The TaxEngineContext class includes these constructors.

Initializes the TaxEngineContext object. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

TaxEngineContext(commercetax.TaxEngineRequest request, commercetax.RequestType requestType, String namedUri)

  • request:

    Type: TaxEngineRequest Information about

    the request.

  • requestType:

    Type: RequestType

    Whether the tax request is to calculate or estimate tax.

  • namedUri:

    Type: String

    URI that was called as part of the tax calculation request.

Learn more about the available methods with the TaxEngineContext class.

The TaxEngineContext class includes these methods.

  • getNamedUri()

    Retrieves the value of the NamedUri field of the TaxEngineContext class.

  • getRequest()

    Gets the value of the TaxEngineContext’s Request field.

  • getRequestType()

    Gets the value of the RequestType field of the TaxEngineContext class.

Retrieves the value of the NamedUri field of the TaxEngineContext class.

global String getNamedUri()

Type: String

Gets the value of the TaxEngineContext’s Request field.

global commercetax.TaxEngineRequest getRequest()

Type: TaxEngineRequest

An implemented instance of an external tax engine’s interface for processing requests. We’ve provided the TaxEngineRequest interface for you to test within mock adapters with classes that implement it, such as CalculateTaxRequest. However, don’t use it outside of a testing context.

Gets the value of the RequestType field of the TaxEngineContext class.

global commercetax.RequestType getRequestType()

Type: RequestType

Indicates whether the calculation request was for actual or calculated tax.