Sha256: 4aced10a99f179b493681a1345f8f0b71c77ce469035bf0db91db064847ca9a7

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 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: 'DEFAULT',
  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 transaction

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
avatax-18.4.0 example/avatax.rb
avatax-18.3.0 example/avatax.rb
avatax-18.2.0 example/avatax.rb
avatax-18.1.2 example/avatax.rb
avatax-17.12.0 example/avatax.rb
avatax-17.9.1 example/avatax.rb