Connect your dynamic tax calculations to the AvaTax API.
Important
You can use the devcontainer Dockerfile and docker-compose.yaml directly - but remember to run pnpm install and pnpm setup-dynamodb manually
The easiest way to run Saleor for local development is to use development containers. If you have Visual Studio Code, follow their guide on how to open an existing folder in a container.
The development container only creates a container; you still need to start the server. See the common-commands section to learn more.
The development container will have two ports opened:
3000- where the AvaTax app dev server will listen for requests8000- where the local DynamoDB will listen for requests and allow NoSQL Workbench for DynamoDB to connect
Running the app in development server:
pnpm run devRunning tests:
pnpm run testDynamoDB is used to store client-side logs and auth data. To develop this feature locally, use development containers or use docker-compose from .devcontainer:
- Run
docker compose upfor local DynamoDB instance - Run
pnpm run setup-dynamodbto create the DynamoDB table
Ensure the following env variables are set:
DYNAMODB_LOGS_ITEM_TTL_IN_DAYS=30
DYNAMODB_LOGS_TABLE_NAME=avatax-client-logs
DYNAMODB_MAIN_TABLE_NAME=avatax-main-tableAlternatively, you can connect to AWS-based DynamoDB:
- Create a table in your AWS, based on the parameters in
scripts/setup-dynamodb.ts - Set AWS-specific env variables
Our E2E tests are using PactumJS for making requests to Saleor instance and a separate Vitest workspace for running tests.
Before running tests, you have to set up .env file with TEST_SALEOR_API_URL that points to your Saleor instance with installed AvaTax app. For reference, you can use .env.example file:
cp .env.example .envYou should also add E2E_USER_NAME and E2E_USER_PASSWORD which are credentials for a staff user that has permissions of MANAGE_ORDERS.
You also have to generate GraphQL files using graphql-codegen:
pnpm run generateAfter you complete the setup, run the tests with:
pnpm run e2eOur tests include default data that is used for our specific Saleor instance. It includes IDs of products, channels, vouchers, etc. You can find them in e2e/data/maps and e2e/data/templates.
If you want to create a new instance from scratch, you have to create a fork of this repository and create following configuration in your Saleor:
- Channels
- Create USA channel with
USDcurrency andUnited Statesas country, the channel should haveorderSettings:allowUnpaidOrders: true,automaticallyConfirmAllNewOrders: true
- Create USA channel with
- Warehouse: create new warehouse or use existing ones and set-up shipping methods for your new channel
- Tax classes: create each tax class for test case used in our tests (see
e2e/data/maps/product.json) - Products
- Create or use existing products (from default saleor-platform seed data) and assign them tax class and make them available in USA channel
- Tax configuration: Set USA channel tax configuration ot
tax appandpricesEnteredWithTax: false - App: Install AvaTax app and configure it with your account, assign shipping address in USA, and set up tax classes for products
Bruno is an open source tool for exploring and testing APIs. It's similar to Postman or Insomnia.
This app has a collection of requests to Saleor that go through fetching a product from channel, creating a checkout, adding shipping method and completing checkout (channel must have allowUnpaidOrders setting set to true). You also need to set enableAccountConfirmationByEmail to false in your shop site settings.
To set up Bruno, go to the bruno directory and run
pnpm install --ignore-workspaceAfter that, you have to prepare an environment for Bruno. Environments are a set of variables that are used in requests.
To use your own storefront user create .env file inside bruno folder with:
SALEOR_API_URL=
STOREFRONT_USER_EMAIL=
STOREFRONT_USER_PASSWORD=
STOREFRONT_USER_NAME=
STAFF_USER_EMAIL=
STAFF_USER_PASSWORD=
CHANNEL_SLUG=
PROMO_CODE=
The app has an example environment for localhost in environments/localhost.bru. You can copy it to bootstrap your own environment e.g cloud.bru (which will be ignored by git).
Note
This section refers to apps hosted by Saleor or using REST APL. If you self host AvaTax app you need to write your own logic for updating migration scripts. See How to update app webhooks for more info.
You need to set REST_APL_TOKEN & REST_APL_ENDPOINT in our .env file first.
Test migration with dry run, operation will not modify any data:
pnpm migrate:dry-runTo start the migration run command:
pnpm migrateVisit AvaTax App documentation to learn how to configure the app.
Visit @saleor/apps-otel README to learn how to run app with OTEL locally.
