Giter VIP home page Giter VIP logo

avatax-rest-v2-jre-sdk's Introduction

AvaTax-REST-V2-JRE-SDK

This GitHub repository is the Java Runtime Environment SDK for Avalara's world-class tax service, AvaTax. It uses the AvaTax REST v2 API, which is a fully REST implementation and provides a single client for all AvaTax functionality. For more information about AvaTax REST v2, please visit Avalara's Developer Network or view the online Swagger documentation.

Build Status

Maven Central

Maven Central

Travis-CI

Travis

Installing the JRE SDK

The AvaTax JRE SDK is available for download on Maven.

For the AvaTax JRE SDK, there are four different files available to download:

  • pom : This Project Object Model is an XML file that contains information about the project and configuration details used by Maven to build the project. This file is not needed in order to run the AvaTax JRE SDK.
  • jar : This is what file you will use to import into your project in order to access AvaTax. This file is needed in order to run the AvaTax JRE SDK.
  • javadoc.jar : This file is documentation generated from the source code in the jar file. This file is not needed in order to run the AvaTax JRE SDK.
  • sources.jar : This file contains the source code for the jar file. This file is not needed in order to run the AvaTax JRE SDK, but it is helpful to use in order to view the code within the jar file in the editor. In order to view the code, download this file and attach it as a source to the jar file.

Once you have the jar file downloaded, import it into your editor as an external jar file.

Using the JRE SDK

The JRE SDK uses a fluent interface to define a connection to AvaTax and to make API calls to calculate tax on transactions. Here's an example of how to connect to AvaTax in Java:

import java.math.BigDecimal;
import net.avalara.avatax.rest.client.AvaTaxClient;
import net.avalara.avatax.rest.client.TransactionBuilder;
import net.avalara.avatax.rest.client.enums.AvaTaxEnvironment;
import net.avalara.avatax.rest.client.enums.DocumentType;
import net.avalara.avatax.rest.client.enums.TransactionAddressType;
import net.avalara.avatax.rest.client.models.PingResultModel;
import net.avalara.avatax.rest.client.models.TransactionModel;

public class Program {
	public static void main(String[] args) {
		//creates our AvaTaxClient
		AvaTaxClient client = new AvaTaxClient("Test", "1.0", "localhost", AvaTaxEnvironment.Sandbox)
				.withSecurity("MyUsername", "MyPassword"); //replace with your username and password
		
		try {
			//verify that we can ping successfully
			PingResultModel ping = client.ping();
			if(ping.getAuthenticated()) {
				System.out.print("Successfully created a client!");
			}
		} catch (Exception e) {}		
		
		//builds the Transaction and creates the TransactionModel
		try {
			TransactionModel transaction = new TransactionBuilder(client, "DEFAULT", DocumentType.SalesInvoice, "ABC")
			.withAddress(TransactionAddressType.SingleLocation, "123 Main Street", null, null, "Irvine", "CA", "92615", "US")
			.withLine( new BigDecimal(100.0), new BigDecimal(1), "P0000000")
            .Create();
		} catch (Exception e) {}
		
	}

}

avatax-rest-v2-jre-sdk's People

Contributors

waynemyeravalara avatar ted-spence-avalara avatar drheart avatar mlsnyder avatar han8909227 avatar cassonmars avatar avalara-tela avatar han-bao-avalara avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.