workarea-avatax 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  4. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. data/.github/workflows/ci.yml +66 -0
  7. data/.gitignore +18 -0
  8. data/.rubocop.yml +8 -0
  9. data/CHANGELOG.md +123 -0
  10. data/CODE_OF_CONDUCT.md +3 -0
  11. data/CONTRIBUTING.md +3 -0
  12. data/Gemfile +10 -0
  13. data/LICENSE.md +3 -0
  14. data/README.md +57 -0
  15. data/Rakefile +50 -0
  16. data/app/models/workarea/avatax/usage_type.rb +17 -0
  17. data/app/models/workarea/pricing/calculators/avalara_tax_calculator.rb +105 -0
  18. data/app/models/workarea/user.decorator +7 -0
  19. data/app/seeds/workarea/avatax_seeds.rb +44 -0
  20. data/app/view_models/workarea/admin/user_view_model.decorator +21 -0
  21. data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
  22. data/app/views/workarea/admin/users/_avatax_properties_fields.html.haml +5 -0
  23. data/app/workers/workarea/avatax/tax_invoice_worker.rb +29 -0
  24. data/bin/rails +17 -0
  25. data/config/initializers/appends.rb +4 -0
  26. data/config/initializers/avatax.rb +14 -0
  27. data/config/initializers/seeds.rb +1 -0
  28. data/config/locales/en.yml +6 -0
  29. data/lib/avatax/api.decorator +52 -0
  30. data/lib/workarea/avatax/bogus_gateway/bogus_create_transaction.rb +187 -0
  31. data/lib/workarea/avatax/bogus_gateway.rb +34 -0
  32. data/lib/workarea/avatax/engine.rb +36 -0
  33. data/lib/workarea/avatax/tax_request/addresses.rb +35 -0
  34. data/lib/workarea/avatax/tax_request/line_item.rb +47 -0
  35. data/lib/workarea/avatax/tax_request/order_line_item.rb +64 -0
  36. data/lib/workarea/avatax/tax_request/order_lines.rb +70 -0
  37. data/lib/workarea/avatax/tax_request/response.rb +49 -0
  38. data/lib/workarea/avatax/tax_request/shipping_line_item.rb +34 -0
  39. data/lib/workarea/avatax/tax_request.rb +77 -0
  40. data/lib/workarea/avatax/version.rb +5 -0
  41. data/lib/workarea/avatax.rb +71 -0
  42. data/test/dummy/Rakefile +6 -0
  43. data/test/dummy/bin/bundle +3 -0
  44. data/test/dummy/bin/rails +4 -0
  45. data/test/dummy/bin/rake +4 -0
  46. data/test/dummy/bin/setup +34 -0
  47. data/test/dummy/bin/update +29 -0
  48. data/test/dummy/config/application.rb +23 -0
  49. data/test/dummy/config/boot.rb +5 -0
  50. data/test/dummy/config/cable.yml +9 -0
  51. data/test/dummy/config/environment.rb +5 -0
  52. data/test/dummy/config/environments/development.rb +54 -0
  53. data/test/dummy/config/environments/production.rb +86 -0
  54. data/test/dummy/config/environments/test.rb +44 -0
  55. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  56. data/test/dummy/config/initializers/assets.rb +11 -0
  57. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  59. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/test/dummy/config/initializers/inflections.rb +16 -0
  61. data/test/dummy/config/initializers/mime_types.rb +4 -0
  62. data/test/dummy/config/initializers/new_framework_defaults.rb +23 -0
  63. data/test/dummy/config/initializers/workarea.rb +5 -0
  64. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/test/dummy/config/locales/en.yml +23 -0
  66. data/test/dummy/config/puma.rb +47 -0
  67. data/test/dummy/config/routes.rb +5 -0
  68. data/test/dummy/config/secrets.yml +22 -0
  69. data/test/dummy/config/spring.rb +6 -0
  70. data/test/dummy/config.ru +5 -0
  71. data/test/dummy/db/seeds.rb +2 -0
  72. data/test/dummy/lib/assets/.keep +0 -0
  73. data/test/dummy/log/.keep +0 -0
  74. data/test/dummy/public/404.html +67 -0
  75. data/test/dummy/public/422.html +67 -0
  76. data/test/dummy/public/500.html +66 -0
  77. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  78. data/test/dummy/public/apple-touch-icon.png +0 -0
  79. data/test/dummy/public/favicon.ico +0 -0
  80. data/test/factories/workarea/avatax_factories.rb +142 -0
  81. data/test/lib/workarea/avatax/tax_request/order_line_items_test.rb +114 -0
  82. data/test/lib/workarea/avatax/tax_request/response_test.rb +42 -0
  83. data/test/lib/workarea/avatax/tax_request_test.rb +51 -0
  84. data/test/lib/workarea/avatax_test.rb +28 -0
  85. data/test/models/workarea/avatax/usage_type_test.rb +13 -0
  86. data/test/models/workarea/pricing/calculators/avalara_tax_calculator_test.rb +113 -0
  87. data/test/support/avatax_test_settings.rb +9 -0
  88. data/test/system/workarea/storefront/avatax_system_test.rb +22 -0
  89. data/test/test_helper.rb +20 -0
  90. data/test/vcr_cassettes/succesful_avatax_create_transaction.yml +60 -0
  91. data/test/vcr_cassettes/succesful_avatax_create_transaction_multiple_shippings.yml +76 -0
  92. data/workarea-avatax.gemspec +20 -0
  93. metadata +176 -0
@@ -0,0 +1,13 @@
1
+ require "test_helper"
2
+
3
+ module Workarea
4
+ module Avatax
5
+ class UsageTypeTest < Workarea::TestCase
6
+ def test_countries_returns_array_of_cuntries
7
+ ussage_type = UsageType.new(country_codes: ["US"])
8
+
9
+ assert_equal [Country["US"]], ussage_type.countries
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,113 @@
1
+ require "test_helper"
2
+
3
+ module Workarea
4
+ module Pricing
5
+ module Calculators
6
+ class AvalaraTaxCalculatorTest < Workarea::TestCase
7
+ def test_adjust
8
+ create_pricing_sku(
9
+ id: "SKU",
10
+ tax_code: "001",
11
+ prices: [{ regular: 5.to_m }]
12
+ )
13
+
14
+ create_tax_category(
15
+ code: "001",
16
+ rates: [{ percentage: 0.06, region: "PA", country: "US" }]
17
+ )
18
+
19
+ order = Order.new(
20
+ items: [
21
+ {
22
+ price_adjustments: [
23
+ {
24
+ price: "item",
25
+ amount: 5.to_m,
26
+ data: { "tax_code" => "001" }
27
+ }
28
+ ],
29
+ total_price: 5.to_m,
30
+ }
31
+ ]
32
+ )
33
+
34
+ shipping = Shipping.new(
35
+ shipping_service: { name: "UPS Ground", tax_code: "001" },
36
+ price_adjustments: [
37
+ {
38
+ price: "shipping",
39
+ amount: "4.to_m"
40
+ }
41
+ ]
42
+ )
43
+
44
+ shipping.set_address(
45
+ postal_code: "19106",
46
+ region: "PA",
47
+ country: "US"
48
+ )
49
+
50
+ AvalaraTaxCalculator.test_adjust(order, shipping)
51
+
52
+ assert_equal(3, shipping.price_adjustments.length)
53
+
54
+ item_tax = shipping.price_adjustments.detect do |adjustment|
55
+ adjustment.data.keys.include? "order_item_id"
56
+ end
57
+ assert_equal("tax", item_tax.price)
58
+ assert_equal(0.30.to_m, item_tax.amount)
59
+
60
+ shipping_tax = shipping.price_adjustments.detect do |adjustment|
61
+ adjustment.data.keys.include? "shipping_service_tax"
62
+ end
63
+
64
+ assert_equal("tax", shipping_tax.price)
65
+ assert_equal(0.24.to_m, shipping_tax.amount)
66
+ end
67
+
68
+ def test_non_shipping_items
69
+ create_pricing_sku(
70
+ id: "SKU",
71
+ tax_code: "001",
72
+ prices: [{ regular: 5.to_m }]
73
+ )
74
+
75
+ create_tax_category(
76
+ code: "001",
77
+ rates: [{ percentage: 0.06, region: "PA", country: "US" }]
78
+ )
79
+
80
+ order = Order.new(
81
+ items: [
82
+ {
83
+ fulfillment: 'ignore',
84
+ price_adjustments: [
85
+ {
86
+ price: "item",
87
+ amount: 5.to_m,
88
+ data: { "tax_code" => "001" }
89
+ }
90
+ ],
91
+ total_price: 5.to_m,
92
+ }
93
+ ]
94
+ )
95
+
96
+ AvalaraTaxCalculator.test_adjust(order)
97
+
98
+ assert_equal(2, order.items.first.price_adjustments.length)
99
+
100
+ avalara_adjustment = order.items.first.price_adjustments.last
101
+ assert_equal('tax', avalara_adjustment.price)
102
+ assert_equal(0.30.to_m, avalara_adjustment.amount)
103
+ assert_equal('001', avalara_adjustment.data['tax_code'])
104
+ assert_equal(0.06, avalara_adjustment.data['PA STATE TAX'])
105
+ assert_equal(
106
+ order.items.first.price_adjustments.first.id,
107
+ avalara_adjustment.data['adjustment']
108
+ )
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,9 @@
1
+ Workarea::Avatax.configure do |config|
2
+ config.distribution_center = {
3
+ Line1: "12 N 3rd St",
4
+ city: "Philadelphia",
5
+ region: "PA",
6
+ country: "US",
7
+ postalCode: "19106"
8
+ }
9
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class AvataxSystemTest < Workarea::SystemTest
6
+ include Storefront::SystemTest
7
+
8
+ setup :setup_checkout_specs
9
+ setup :start_guest_checkout
10
+
11
+ def test_showing_taxes
12
+ assert_current_path(storefront.checkout_addresses_path)
13
+ fill_in_email
14
+ fill_in_shipping_address
15
+ click_button t('workarea.storefront.checkouts.continue_to_shipping')
16
+
17
+ visit storefront.cart_path
18
+ assert page.has_content? "0.84"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ require "simplecov"
2
+
3
+ SimpleCov.start "rails" do
4
+ add_filter "/workarea/avatax/version.rb"
5
+ add_filter "/lib/avatax*"
6
+ add_filter "app/seeds/*"
7
+ add_filter "lib/workarea/avatax/bogus_gateway*"
8
+ add_group "View Models", "app/view_models"
9
+ add_group "Queries", "app/queries"
10
+ end
11
+
12
+ ENV["RAILS_ENV"] = "test"
13
+
14
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
15
+ require "rails/test_help"
16
+ require "workarea/test_help"
17
+
18
+ # Filter out Minitest backtrace while allowing backtrace from other libraries
19
+ # to be shown.
20
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox-rest.avatax.com/api/v2/transactions/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"SalesOrder","date":"2019-07-01T09:50:30-04:00","code":"12D244609B","companyCode":null,"customerCode":"epigeon@weblinc.com","customerUsageType":null,"addresses":{"shipFrom":{"Line1":"12
9
+ N 3rd St","city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"},"shipTo":{"line1":"22
10
+ S 3rd St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}},"commit":false,"lines":[{"quantity":2,"amount":"10.00","itemCode":"SKU1","taxCode":"P0000000","description":"Test
11
+ Product","number":1},{"quantity":1,"amount":"1.00","itemCode":"SHIPPING","taxCode":"P0000000","description":"Test
12
+ 0","number":2}]}'
13
+ headers:
14
+ Accept:
15
+ - application/json; charset=utf-8
16
+ User-Agent:
17
+ - AvaTax Ruby Gem 17.12.0
18
+ X-Avalara-Client:
19
+ - ";;RubySdk;17.12.0;"
20
+ Authorization:
21
+ - Basic anl1Y2lzLWxwLWF2YXRheEB3ZWJsaW5jLmNvbTpKbXttM05YLlE=
22
+ Content-Type:
23
+ - application/json
24
+ Accept-Encoding:
25
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: Created
30
+ headers:
31
+ Date:
32
+ - Mon, 01 Jul 2019 13:50:30 GMT
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Connection:
38
+ - keep-alive
39
+ Location:
40
+ - "/api/v2/companies/766912/transactions/0"
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ Serverduration:
44
+ - '00:00:00.0669168'
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":0,"code":"12D244609B","companyId":766912,"date":"2019-07-01","paymentDate":"2019-07-01","status":"Temporary","type":"SalesOrder","customerVendorCode":"epigeon@weblinc.com","customerCode":"epigeon@weblinc.com","reconciled":false,"totalAmount":11.0,"totalExempt":0.0,"totalDiscount":0.0,"totalTax":0.88,"totalTaxable":11.0,"totalTaxCalculated":0.88,"adjustmentReason":"NotAdjusted","locked":false,"version":1,"exchangeRateEffectiveDate":"2019-07-01","exchangeRate":1.0,"modifiedDate":"2019-07-01T13:50:30.7825989Z","modifiedUserId":299077,"taxDate":"2019-07-01T00:00:00","lines":[{"id":0,"transactionId":0,"lineNumber":"1","description":"Test
48
+ Product","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SKU1","lineAmount":10.0,"quantity":2.0,"reportingDate":"2019-07-01","tax":0.8,"taxableAmount":10.0,"taxCalculated":0.8,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.6,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
49
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.6,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.2,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
50
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.2,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"2","description":"Test
51
+ 0","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SHIPPING","lineAmount":1.0,"quantity":1.0,"reportingDate":"2019-07-01","tax":0.08,"taxableAmount":1.0,"taxCalculated":0.08,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.06,"taxableAmount":1.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
52
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.06,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.02,"taxableAmount":1.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
53
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.02,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0}],"addresses":[{"id":0,"transactionId":0,"boundaryLevel":"Address","line1":"22
54
+ S 3rd St","line2":"","line3":"","city":"Philadelphia","region":"PA","postalCode":"19106","country":"US","taxRegionId":4014900,"latitude":"39.949483","longitude":"-75.14598"},{"id":0,"transactionId":0,"boundaryLevel":"Address","line1":"12
55
+ N 3rd St","line2":"","line3":"","city":"Philadelphia","region":"PA","postalCode":"19106","country":"US","taxRegionId":4014900,"latitude":"39.950493","longitude":"-75.145758"}],"summary":[{"country":"US","region":"PA","jurisType":"State","jurisCode":"42","jurisName":"PENNSYLVANIA","taxAuthorityType":45,"stateAssignedNo":"","taxType":"Sales","taxSubType":"S","taxName":"PA
56
+ STATE TAX","rateType":"General","taxable":11.0,"rate":0.060000,"tax":0.66,"taxCalculated":0.66,"nonTaxable":0.0,"exemption":0.0},{"country":"US","region":"PA","jurisType":"County","jurisCode":"101","jurisName":"PHILADELPHIA","taxAuthorityType":45,"stateAssignedNo":"51","taxType":"Sales","taxSubType":"S","taxName":"PA
57
+ COUNTY TAX","rateType":"General","taxable":11.0,"rate":0.020000,"tax":0.22,"taxCalculated":0.22,"nonTaxable":0.0,"exemption":0.0}]}'
58
+ http_version:
59
+ recorded_at: Mon, 01 Jul 2019 13:50:30 GMT
60
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox-rest.avatax.com/api/v2/transactions/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"SalesOrder","date":"2019-07-01T12:16:19-04:00","code":"149E1B083A","companyCode":null,"customerCode":"epigeon@workarea.com","customerUsageType":null,"addresses":{"shipFrom":{"Line1":"12
9
+ N 3rd St","city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"},"shipTo":{"line1":"22
10
+ S 3rd St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}},"commit":false,"lines":[{"quantity":2,"amount":"10.00","itemCode":"SKU1","taxCode":"001","description":"Split
11
+ Shipping Product One","number":1,"addresses":{"shipTo":{"line1":"22 S 3rd
12
+ St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}}},{"quantity":1,"amount":"7.00","itemCode":"SKU2","taxCode":"001","description":"Split
13
+ Shipping Product Two","number":2,"addresses":{"shipTo":{"line1":"22 S 3rd
14
+ St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}}},{"quantity":1,"amount":"7.00","itemCode":"SKU2","taxCode":"001","description":"Split
15
+ Shipping Product Two","number":3,"addresses":{"shipTo":{"line1":"12 N 3rd
16
+ St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}}},{"quantity":4,"amount":"36.00","itemCode":"SKU3","taxCode":"001","description":"Split
17
+ Shipping Product Three","number":4,"addresses":{"shipTo":{"line1":"12 N 3rd
18
+ St","line2":null,"city":"Philadelphia","region":"PA","country":"US","postalCode":"19106"}}},{"quantity":1,"amount":"5.00","itemCode":"SHIPPING","taxCode":"001","description":"Ground","number":5},{"quantity":1,"amount":"10.00","itemCode":"SHIPPING","taxCode":"001","description":"Express","number":6}]}'
19
+ headers:
20
+ Accept:
21
+ - application/json; charset=utf-8
22
+ User-Agent:
23
+ - AvaTax Ruby Gem 17.12.0
24
+ X-Avalara-Client:
25
+ - ";;RubySdk;17.12.0;"
26
+ Authorization:
27
+ - Basic anl1Y2lzLWxwLWF2YXRheEB3ZWJsaW5jLmNvbTpKbXttM05YLlE=
28
+ Content-Type:
29
+ - application/json
30
+ Accept-Encoding:
31
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
32
+ response:
33
+ status:
34
+ code: 201
35
+ message: Created
36
+ headers:
37
+ Date:
38
+ - Mon, 01 Jul 2019 16:16:19 GMT
39
+ Content-Type:
40
+ - application/json; charset=utf-8
41
+ Transfer-Encoding:
42
+ - chunked
43
+ Connection:
44
+ - keep-alive
45
+ Location:
46
+ - "/api/v2/companies/766912/transactions/0"
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ Serverduration:
50
+ - '00:00:00.1020795'
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":0,"code":"149E1B083A","companyId":766912,"date":"2019-07-01","paymentDate":"2019-07-01","status":"Temporary","type":"SalesOrder","customerVendorCode":"epigeon@workarea.com","customerCode":"epigeon@workarea.com","reconciled":false,"totalAmount":75.0,"totalExempt":0.0,"totalDiscount":0.0,"totalTax":6.0,"totalTaxable":75.0,"totalTaxCalculated":6.0,"adjustmentReason":"NotAdjusted","locked":false,"version":1,"exchangeRateEffectiveDate":"2019-07-01","exchangeRate":1.0,"modifiedDate":"2019-07-01T16:16:18.7702071Z","modifiedUserId":299077,"taxDate":"2019-07-01T00:00:00","lines":[{"id":0,"transactionId":0,"lineNumber":"1","description":"Split
54
+ Shipping Product One","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SKU1","lineAmount":10.0,"quantity":2.0,"reportingDate":"2019-07-01","tax":0.8,"taxableAmount":10.0,"taxCalculated":0.8,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.6,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
55
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.6,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.2,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
56
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.2,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"2","description":"Split
57
+ Shipping Product Two","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SKU2","lineAmount":7.0,"quantity":1.0,"reportingDate":"2019-07-01","tax":0.56,"taxableAmount":7.0,"taxCalculated":0.56,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.42,"taxableAmount":7.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
58
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.42,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.14,"taxableAmount":7.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
59
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.14,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"3","description":"Split
60
+ Shipping Product Two","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SKU2","lineAmount":7.0,"quantity":1.0,"reportingDate":"2019-07-01","tax":0.56,"taxableAmount":7.0,"taxCalculated":0.56,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.42,"taxableAmount":7.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
61
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.42,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.14,"taxableAmount":7.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
62
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.14,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"4","description":"Split
63
+ Shipping Product Three","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SKU3","lineAmount":36.0,"quantity":4.0,"reportingDate":"2019-07-01","tax":2.88,"taxableAmount":36.0,"taxCalculated":2.88,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":2.16,"taxableAmount":36.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
64
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":2.16,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.72,"taxableAmount":36.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
65
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.72,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"5","description":"Ground","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SHIPPING","lineAmount":5.0,"quantity":1.0,"reportingDate":"2019-07-01","tax":0.4,"taxableAmount":5.0,"taxCalculated":0.4,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.3,"taxableAmount":5.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
66
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.3,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.1,"taxableAmount":5.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
67
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.1,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0},{"id":0,"transactionId":0,"lineNumber":"6","description":"Express","discountAmount":0.0,"exemptAmount":0.0,"exemptCertId":0,"isItemTaxable":true,"itemCode":"SHIPPING","lineAmount":10.0,"quantity":1.0,"reportingDate":"2019-07-01","tax":0.8,"taxableAmount":10.0,"taxCalculated":0.8,"taxCode":"P0000000","taxCodeId":8087,"taxDate":"2019-07-01","taxIncluded":false,"details":[{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"42","jurisName":"PENNSYLVANIA","stateAssignedNo":"","jurisType":"STA","jurisdictionType":"State","nonTaxableAmount":0.0,"rate":0.060000,"tax":0.6,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
68
+ STATE TAX","taxAuthorityTypeId":45,"taxCalculated":0.6,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false},{"id":0,"transactionLineId":0,"transactionId":0,"country":"US","region":"PA","exemptAmount":0.0,"jurisCode":"101","jurisName":"PHILADELPHIA","stateAssignedNo":"51","jurisType":"CTY","jurisdictionType":"County","nonTaxableAmount":0.0,"rate":0.020000,"tax":0.2,"taxableAmount":10.0,"taxType":"Sales","taxSubTypeId":"S","taxName":"PA
69
+ COUNTY TAX","taxAuthorityTypeId":45,"taxCalculated":0.2,"rateType":"General","rateTypeCode":"G","unitOfBasis":"PerCurrencyUnit","isNonPassThru":false}],"nonPassthroughDetails":[],"hsCode":"","costInsuranceFreight":0.0,"vatCode":"","vatNumberTypeId":0}],"addresses":[{"id":0,"transactionId":0,"boundaryLevel":"Address","line1":"22
70
+ S 3rd St","line2":"","line3":"","city":"Philadelphia","region":"PA","postalCode":"19106","country":"US","taxRegionId":4014900,"latitude":"39.949483","longitude":"-75.14598"},{"id":0,"transactionId":0,"boundaryLevel":"Address","line1":"12
71
+ N 3rd St","line2":"","line3":"","city":"Philadelphia","region":"PA","postalCode":"19106","country":"US","taxRegionId":4014900,"latitude":"39.950493","longitude":"-75.145758"}],"summary":[{"country":"US","region":"PA","jurisType":"State","jurisCode":"42","jurisName":"PENNSYLVANIA","taxAuthorityType":45,"stateAssignedNo":"","taxType":"Sales","taxSubType":"S","taxName":"PA
72
+ STATE TAX","rateType":"General","taxable":75.0,"rate":0.060000,"tax":4.50,"taxCalculated":4.50,"nonTaxable":0.0,"exemption":0.0},{"country":"US","region":"PA","jurisType":"County","jurisCode":"101","jurisName":"PHILADELPHIA","taxAuthorityType":45,"stateAssignedNo":"51","taxType":"Sales","taxSubType":"S","taxName":"PA
73
+ COUNTY TAX","rateType":"General","taxable":75.0,"rate":0.020000,"tax":1.50,"taxCalculated":1.50,"nonTaxable":0.0,"exemption":0.0}]}'
74
+ http_version:
75
+ recorded_at: Mon, 01 Jul 2019 16:16:19 GMT
76
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ require "workarea/avatax/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "workarea-avatax"
7
+ s.version = Workarea::Avatax::VERSION
8
+ s.authors = ["Eric Pigeon"]
9
+ s.email = ["epigeon@workarea.com"]
10
+ s.summary = "Avalara Tax Plugin for the Workarea Ecommerce Platform"
11
+ s.description = "Avatax is a service for sales tax calculation and compliance"
12
+ s.license = "MIT"
13
+ s.files = `git ls-files`.split("\n")
14
+
15
+ s.required_ruby_version = ">= 2.2.2"
16
+
17
+ s.add_dependency 'workarea', '>= 3.5.x'
18
+ s.add_dependency "avatax", "~> 17.0"
19
+ s.add_dependency "hashie", "~> 3.0"
20
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: workarea-avatax
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Pigeon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: workarea
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.x
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.x
27
+ - !ruby/object:Gem::Dependency
28
+ name: avatax
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '17.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '17.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hashie
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Avatax is a service for sales tax calculation and compliance
56
+ email:
57
+ - epigeon@workarea.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".editorconfig"
63
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
64
+ - ".github/ISSUE_TEMPLATE/documentation-request.md"
65
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
66
+ - ".github/workflows/ci.yml"
67
+ - ".gitignore"
68
+ - ".rubocop.yml"
69
+ - CHANGELOG.md
70
+ - CODE_OF_CONDUCT.md
71
+ - CONTRIBUTING.md
72
+ - Gemfile
73
+ - LICENSE.md
74
+ - README.md
75
+ - Rakefile
76
+ - app/models/workarea/avatax/usage_type.rb
77
+ - app/models/workarea/pricing/calculators/avalara_tax_calculator.rb
78
+ - app/models/workarea/user.decorator
79
+ - app/seeds/workarea/avatax_seeds.rb
80
+ - app/view_models/workarea/admin/user_view_model.decorator
81
+ - app/view_models/workarea/storefront/cart_view_model.decorator
82
+ - app/views/workarea/admin/users/_avatax_properties_fields.html.haml
83
+ - app/workers/workarea/avatax/tax_invoice_worker.rb
84
+ - bin/rails
85
+ - config/initializers/appends.rb
86
+ - config/initializers/avatax.rb
87
+ - config/initializers/seeds.rb
88
+ - config/locales/en.yml
89
+ - lib/avatax/api.decorator
90
+ - lib/workarea/avatax.rb
91
+ - lib/workarea/avatax/bogus_gateway.rb
92
+ - lib/workarea/avatax/bogus_gateway/bogus_create_transaction.rb
93
+ - lib/workarea/avatax/engine.rb
94
+ - lib/workarea/avatax/tax_request.rb
95
+ - lib/workarea/avatax/tax_request/addresses.rb
96
+ - lib/workarea/avatax/tax_request/line_item.rb
97
+ - lib/workarea/avatax/tax_request/order_line_item.rb
98
+ - lib/workarea/avatax/tax_request/order_lines.rb
99
+ - lib/workarea/avatax/tax_request/response.rb
100
+ - lib/workarea/avatax/tax_request/shipping_line_item.rb
101
+ - lib/workarea/avatax/version.rb
102
+ - test/dummy/Rakefile
103
+ - test/dummy/bin/bundle
104
+ - test/dummy/bin/rails
105
+ - test/dummy/bin/rake
106
+ - test/dummy/bin/setup
107
+ - test/dummy/bin/update
108
+ - test/dummy/config.ru
109
+ - test/dummy/config/application.rb
110
+ - test/dummy/config/boot.rb
111
+ - test/dummy/config/cable.yml
112
+ - test/dummy/config/environment.rb
113
+ - test/dummy/config/environments/development.rb
114
+ - test/dummy/config/environments/production.rb
115
+ - test/dummy/config/environments/test.rb
116
+ - test/dummy/config/initializers/application_controller_renderer.rb
117
+ - test/dummy/config/initializers/assets.rb
118
+ - test/dummy/config/initializers/backtrace_silencers.rb
119
+ - test/dummy/config/initializers/cookies_serializer.rb
120
+ - test/dummy/config/initializers/filter_parameter_logging.rb
121
+ - test/dummy/config/initializers/inflections.rb
122
+ - test/dummy/config/initializers/mime_types.rb
123
+ - test/dummy/config/initializers/new_framework_defaults.rb
124
+ - test/dummy/config/initializers/workarea.rb
125
+ - test/dummy/config/initializers/wrap_parameters.rb
126
+ - test/dummy/config/locales/en.yml
127
+ - test/dummy/config/puma.rb
128
+ - test/dummy/config/routes.rb
129
+ - test/dummy/config/secrets.yml
130
+ - test/dummy/config/spring.rb
131
+ - test/dummy/db/seeds.rb
132
+ - test/dummy/lib/assets/.keep
133
+ - test/dummy/log/.keep
134
+ - test/dummy/public/404.html
135
+ - test/dummy/public/422.html
136
+ - test/dummy/public/500.html
137
+ - test/dummy/public/apple-touch-icon-precomposed.png
138
+ - test/dummy/public/apple-touch-icon.png
139
+ - test/dummy/public/favicon.ico
140
+ - test/factories/workarea/avatax_factories.rb
141
+ - test/lib/workarea/avatax/tax_request/order_line_items_test.rb
142
+ - test/lib/workarea/avatax/tax_request/response_test.rb
143
+ - test/lib/workarea/avatax/tax_request_test.rb
144
+ - test/lib/workarea/avatax_test.rb
145
+ - test/models/workarea/avatax/usage_type_test.rb
146
+ - test/models/workarea/pricing/calculators/avalara_tax_calculator_test.rb
147
+ - test/support/avatax_test_settings.rb
148
+ - test/system/workarea/storefront/avatax_system_test.rb
149
+ - test/test_helper.rb
150
+ - test/vcr_cassettes/succesful_avatax_create_transaction.yml
151
+ - test/vcr_cassettes/succesful_avatax_create_transaction_multiple_shippings.yml
152
+ - workarea-avatax.gemspec
153
+ homepage:
154
+ licenses:
155
+ - MIT
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: 2.2.2
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ requirements: []
172
+ rubygems_version: 3.0.6
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: Avalara Tax Plugin for the Workarea Ecommerce Platform
176
+ test_files: []