Sha256: 42fede2e39407fa7d0ef0fe0c58331491b94c6fbd0b5369baf0c3037c2fbfbce

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'yaml'
require File.expand_path('../../lib/avatax', __FILE__)

credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))

AvaTax.configure do |config|
  begin
    credentials = YAML.load_file(File.expand_path('../credentials.yaml', __FILE__))
    config.endpoint = credentials['endpoint']
    config.username = credentials['username']
    config.password = credentials['password']
  rescue
    config.endpoint = 'https://sandbox-rest.avatax.com'
    config.username = ENV['SANDBOX_USERNAME']
    config.password = ENV['SANDBOX_PASSWORD']
  end
end

@client = AvaTax::Client.new(:logger => true)

# puts @client.query_companies

createTransactionModel = {
  type: 'SalesInvoice',
  companyCode: '12670',
  date: '2017-06-05',
  customerCode: 'ABC',
  "addresses": {
    "ShipFrom": {
      "line1": "123 Main Street",
      "city": "Irvine",
      "region": "CA",
      "country": "US",
      "postalCode": "92615"
    },
    "ShipTo": {
      "line1": "100 Market Street",
      "city": "San Francisco",
      "region": "CA",
      "country": "US",
      "postalCode": "94105"
    }
  },
  lines: [{amount: 100}]
}
transaction = @client.create_transaction(createTransactionModel)
puts JSON.pretty_generate(transaction)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avatax-18.9.0 example/avatax.rb
avatax-18.7.1 example/avatax.rb
avatax-18.6.1 example/avatax.rb
avatax-18.5.1 example/avatax.rb
avatax-18.4.1 example/avatax.rb