Newer Version Available
AddressesResponse Class
Sets the tax address fields based on a response from the external
tax engine. Contains setter methods for the Ship From, Ship To, and Sold To
addresses.
Namespace
Usage
Because AddressesResponse
contains multiple addresses, we recommend using multiple instances of AddressResponse to set unique values for each address.
Example
This code sample represents a portion of the code used in a mock tax adapter. In this example, you create three AddressResponse classes, set their location codes, and pass them to the Ship To, Ship From, and Sold To setter methods in AddressesResponse. In an actual implementation, your AddressResponse classes already have a location code based on the response from the external tax engine.
1commercetax.AddressesResponse addressesRes = new commercetax.AddressesResponse();
2
3//AddressResponse containing ShipTo information
4commercetax.AddressResponse shipToAddress = new commercetax.AddressResponse();
5shipToAddress.setLocationCode('1234567');
6
7//AddressResponse containing ShipFrom information
8commercetax.AddressResponse shipFromAddress = new commercetax.AddressResponse();
9shipFromAddress.setLocationCode('84720385');
10
11//AddressResponse containing Sold To information
12commercetax.AddressResponse soldToAddress = new commercetax.AddressResponse();
13soldToAddress.setLocationCode('92381749');
14
15//set values of addressesRes
16addressesRes.setShipFrom(shipFromAddress);
17addressesRes.setShipTo(shipToAddress);
18addressesRes.setSoldTo(soldToAddress);AddressesResponse Methods
Learn more about the methods for AddressesResponse class.
The AddressesResponse class includes these methods.
setShipFrom(shipFrom)
Signature
global void setShipFrom(commercetax.AddressResponse shipFrom)
Parameters
- shipFrom
- Type: AddressResponse
- A single address. Use this generic address parameter to store any type of address, such as Ship From, Ship To, and Sold To details. Users set the specific address in an AddressResponse instance and then pass that instance to the AddressesResponse’s setShipTo(), setShipFrom(), and setSoldTo() methods as needed.
Return Value
Type: void
setShipTo(shipTo)
Signature
global void setShipTo(commercetax.AddressResponse shipTo)
Parameters
- shipTo
- Type: AddressResponse
- Stores a single address. This is a generic address parameter and can be used to store any type of address, such as Ship From, Ship To, and Sold To details. Users set the specific address in an AddressResponse instance and then pass that instance to the AddressesResponse’s setShipTo(), setShipFrom(), and setSoldTo() methods as needed.
Return Value
Type: void
setSoldTo(soldTo)
Signature
global void setSoldTo(commercetax.AddressResponse soldTo)
Parameters
- soldTo
- Type: AddressResponse
- Stores a single address. This is a generic address parameter and can be used to store any type of address, such as Ship From, Ship To, Sold To details. Users set the specific address in an AddressResponse instance and then pass that instance to the AddressesResponse’s setShipTo(), setShipFrom(), and setSoldTo() methods as needed.
Return Value
Type: void