super_good-solidus_taxjar 0.15.2 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +16 -0
  3. data/.gitignore +19 -13
  4. data/.travis.yml +12 -5
  5. data/CHANGELOG.md +71 -0
  6. data/Gemfile +23 -5
  7. data/LICENSE +26 -0
  8. data/PULL_REQUEST_TEMPLATE.md +20 -0
  9. data/README.md +34 -9
  10. data/Rakefile +4 -17
  11. data/app/controllers/spree/admin/taxjar_settings_controller.rb +8 -0
  12. data/app/decorators/super_good/solidus_taxjar/spree/order_updater/fire_recalculated_event.rb +18 -0
  13. data/app/overrides/spree/admin/shared/_configuration_menu.rb +11 -0
  14. data/app/views/spree/admin/taxjar_settings/show.html.erb +13 -0
  15. data/bin/rails +7 -0
  16. data/bin/rails-engine +13 -0
  17. data/bin/rails-sandbox +16 -0
  18. data/bin/rake +7 -0
  19. data/bin/sandbox +84 -0
  20. data/config/routes.rb +7 -0
  21. data/lib/super_good-solidus_taxjar.rb +4 -0
  22. data/lib/super_good/engine.rb +10 -0
  23. data/lib/super_good/solidus_taxjar.rb +19 -7
  24. data/lib/super_good/solidus_taxjar/addresses.rb +63 -0
  25. data/lib/super_good/solidus_taxjar/api.rb +27 -10
  26. data/lib/super_good/solidus_taxjar/api_params.rb +26 -8
  27. data/lib/super_good/solidus_taxjar/calculator_helper.rb +38 -0
  28. data/lib/super_good/solidus_taxjar/discount_calculator.rb +1 -1
  29. data/lib/super_good/solidus_taxjar/tax_calculator.rb +17 -50
  30. data/lib/super_good/solidus_taxjar/tax_rate_calculator.rb +35 -0
  31. data/lib/super_good/solidus_taxjar/version.rb +2 -2
  32. data/spec/features/spree/admin/taxjar_settings_spec.rb +48 -0
  33. data/spec/models/spree/order_updater_spec.rb +12 -0
  34. data/spec/spec_helper.rb +20 -0
  35. data/spec/super_good/solidus_taxjar/addresses_spec.rb +288 -0
  36. data/spec/super_good/solidus_taxjar/api_params_spec.rb +434 -0
  37. data/spec/super_good/solidus_taxjar/api_spec.rb +222 -0
  38. data/spec/super_good/solidus_taxjar/discount_calculator_spec.rb +13 -0
  39. data/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +332 -0
  40. data/spec/super_good/solidus_taxjar/tax_rate_calculator_spec.rb +116 -0
  41. data/spec/super_good/solidus_taxjar_spec.rb +92 -0
  42. data/super_good-solidus_taxjar.gemspec +17 -14
  43. metadata +46 -9
  44. data/LICENSE.txt +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b31e03589ed5699fa26ba2b8f2b5ccb99fe64af208fce5c15eba8ccec10366a
4
- data.tar.gz: 63bb0d2f537723e15feaae9785090f6903c4bf6b7d2763915f22f5668dff6e89
3
+ metadata.gz: ea057c858aee853bafe0e6510d678028c46db7e1640383348ada09adbedcf8dc
4
+ data.tar.gz: 9e18d2dce1ed09754a6de1c8eecaac84af5f579fb9ebe8120d26fad646beb3d0
5
5
  SHA512:
6
- metadata.gz: a09644d7afc6976fc173bd000137424ac398057db518491bbfdfd544cf66b046347959388d3c913016ee3c1b0c43211adcb2a83692c96e2a4b66cf20dc5acc45
7
- data.tar.gz: a723866885f456c418004f0642ccd7351e371c288a3f8d81cdb9b7a7179d655b738ac41f2a85b5878cc5da17ebf8a3af8697a3e02270008882d1da0ac0735a64
6
+ metadata.gz: 9c042476951882510a92dd96ae09d0a8da6406a7d05edd93be023c1b6dfdc84d7a31a5c3fdc7904ea1c9115a04fe3a0d22c74d4520824ed02bd3ef0cf274c5c6
7
+ data.tar.gz: 66cf84615dd4b4bd478494bd464464e5d25bd02c5a49029c080c180ca5bd791fff6bb09108e4a597cdd4d7df8fc6cbff247d37476917fe5306288a5ae5e66707
@@ -0,0 +1,16 @@
1
+ version: 2.1
2
+ orbs:
3
+ solidusio_extensions: solidusio/extensions@0.2.24
4
+
5
+ jobs:
6
+ run-specs-with-postgres:
7
+ executor: solidusio_extensions/postgres
8
+ steps:
9
+ - checkout
10
+ - solidusio_extensions/run-tests-solidus-older
11
+ - solidusio_extensions/store-test-results
12
+
13
+ workflows:
14
+ "Run specs on supported Solidus versions":
15
+ jobs:
16
+ - run-specs-with-postgres
data/.gitignore CHANGED
@@ -1,14 +1,20 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
1
+ *.gem
2
+ \#*
3
+ *~
4
+ .#*
5
+ .DS_Store
6
+ .idea
7
+ .project
8
+ .sass-cache
9
+ coverage
13
10
  Gemfile.lock
14
- /spec/dummy
11
+ tmp
12
+ nbproject
13
+ pkg
14
+ *.swp
15
+ spec/dummy
16
+ spec/examples.txt
17
+ /sandbox
18
+ .rvmrc
19
+ .ruby-version
20
+ .ruby-gemset
data/.travis.yml CHANGED
@@ -1,12 +1,19 @@
1
1
  ---
2
+ dist: trusty
2
3
  sudo: false
3
4
  language: ruby
4
5
  cache: bundler
5
- rvm:
6
- - 2.3.7
7
- env:
8
- matrix:
9
- - SOLIDUS_BRANCH=v2.4 DB=postgres RAILS_VERSION="~> 5.1.0"
6
+ addons:
7
+ postgresql: "9.3"
8
+ jobs:
9
+ include:
10
+ - rvm: 2.5.8
11
+ env: SOLIDUS_BRANCH=v2.9 DB=postgresql RAILS_VERSION="~> 5.1.0"
12
+ - rvm: 2.6.6
13
+ env: SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0"
14
+ - rvm: 2.6.6
15
+ env: SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 6.0.0"
16
+
10
17
  before_install:
11
18
  - gem update --system
12
19
  - gem install bundler
data/CHANGELOG.md CHANGED
@@ -1,6 +1,77 @@
1
1
  # Changelog
2
2
 
3
3
  ## master
4
+ ## v0.18.2
5
+
6
+ - [#71](https://github.com/SuperGoodSoft/solidus_taxjar/pull/69) Unlock ExecJS version. This reverts the temporary fix introduced in #69
7
+ - [#79](https://github.com/SuperGoodSoft/solidus_taxjar/pull/79) Relax Ruby required version to support Ruby 3.0+
8
+ - [#51](https://github.com/SuperGoodSoft/solidus_taxjar/pull/51) Add nexus regions method to API
9
+ - [#58](https://github.com/SuperGoodSoft/solidus_taxjar/pull/58) Take shipping promotions into account in default calculator
10
+ - [#59](https://github.com/SuperGoodSoft/solidus_taxjar/pull/59) Add pry debugging tools
11
+ - [#69](https://github.com/SuperGoodSoft/solidus_taxjar/pull/69) Lock ExecJS version
12
+ - [#37](https://github.com/SuperGoodSoft/solidus_taxjar/pull/37) Added a basic Taxjar settings admin interface which displays placeholder text.
13
+ - [#64](https://github.com/SuperGoodSoft/solidus_taxjar/pull/64) Provide Spree::Address.address2 to TaxJar address validation if it is present.
14
+ - [#80](https://github.com/SuperGoodSoft/solidus_taxjar/pull/80) Support order_recalculated event in < 2.11
15
+
16
+ ## v0.18.1
17
+
18
+ [#52](https://github.com/supergoodsoft/solidus_taxjar/pull/52) fixes a critical bug in the API class that was released in `v0.18.0`. Please upgrade.
19
+
20
+ - [#47](https://github.com/SuperGoodSoft/solidus_taxjar/pull/47) Fixed bug in `validate_address_params` for addresses without a state
21
+ - [#52](https://github.com/supergoodsoft/solidus_taxjar/pull/52) Fixed critical bug in API class
22
+
23
+ ## ~~v0.18.0~~
24
+ `v0.18.0` was removed due to a regression in the API class that was fixed in [#52](https://github.com/SuperGoodSoft/solidus_taxjar/pull/52) and `v0.18.1`
25
+
26
+ - [#21](https://github.com/SuperGoodSoft/solidus_taxjar/pull/21) Migrated project to `solidus_dev_support`
27
+ - [#22](https://github.com/SuperGoodSoft/solidus_taxjar/pull/22) Added support for TaxJar address validation API through `SuperGood::SolidusTaxJar::Addresses` class
28
+ - [#34](https://github.com/SuperGoodSoft/solidus_taxjar/pull/34) Include API version in request headers
29
+ - [#38](https://github.com/SuperGoodSoft/solidus_taxjar/pull/38) Added a rails engine to support future solidus backend UI
30
+ - [#43](https://github.com/SuperGoodSoft/solidus_taxjar/pull/43) Support zeitwerk loading
31
+
32
+ **Breaking Changes**:
33
+
34
+ - Module name `SolidusTaxJar` renamed to `SolidusTaxjar`
35
+ - Class name `API` renamed to `Api`
36
+ - Class name `APIParams` renamed to `ApiParams`
37
+
38
+ ### Upgrading from 0.17.X to 0.18.X
39
+
40
+ If you're currently using version 0.17.X and want to upgrade to 0.18.X, follow these steps:
41
+
42
+ - Rename any instances of the module `SolidusTaxJar` to `SolidusTaxjar`
43
+ - Rename any instances of the class `API` to `Api`
44
+ - Rename any instances of the class `APIParams` to `ApiParams`
45
+
46
+ ## v0.17.1
47
+
48
+ - Fixed bug where shipping calculator was not used for order shipping param. (Thanks @spaghetticode!)
49
+
50
+ ## v0.17.0
51
+
52
+ - Added `SuperGood::SolidusTaxJar.custom_order_params` to allow for custom overrides to the parameters sent to TaxJar when calculating order taxes. For example, if you needed to send a custom nexus address you could do:
53
+ ```ruby
54
+ SuperGood::SolidusTaxJar.custom_order_params = ->(order) {
55
+ {
56
+ nexus_addresses: [
57
+ {
58
+ id: 'Main Location',
59
+ country: 'AU',
60
+ zip: 'NSW 2000',
61
+ city: 'Sydney',
62
+ street: '483 George St',
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ```
68
+ The callback receives the `Spree::Order` that the params are for and the return value can override existing values like the order's ID.
69
+
70
+ ## v0.16.0
71
+
72
+ - Fix `#incomplete_address?` method to be friendly also to completely blank addresses.
73
+
74
+ - Added `SuperGood::SolidusTaxJar::TaxRateCalculator` for retrieving the tax rate for a given `Spree::Address`. The calculator follows `TaxCalculator` conventions by relying on address validators and custom exception handling.
4
75
 
5
76
  ## v0.15.2
6
77
 
data/Gemfile CHANGED
@@ -6,16 +6,34 @@ branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
6
6
 
7
7
  gem "solidus", github: "solidusio/solidus", branch: branch
8
8
 
9
- if ENV['RAILS_VERSION']
10
- gem "rails", ENV['RAILS_VERSON']
11
- end
9
+ # Needed to help Bundler figure out how to resolve dependencies,
10
+ # otherwise it takes forever to resolve them.
11
+ # See https://github.com/bundler/bundler/issues/6677
12
+ gem "rails", ENV.fetch("RAILS_VERSION") { ">0.a" }
13
+
14
+ # Provides basic authentication functionality for testing parts of your engine
15
+ gem "solidus_auth_devise"
12
16
 
13
- if ENV.fetch('DB') == 'postgres'
14
- gem 'pg'
17
+ case ENV["DB"]
18
+ when "mysql"
19
+ gem "mysql2"
20
+ when "postgresql"
21
+ gem "pg"
22
+ else
23
+ gem "sqlite3"
15
24
  end
16
25
 
17
26
  group :development, :test do
18
27
  gem "pry"
28
+ gem "pry-stack_explorer"
29
+ gem "pry-byebug"
19
30
  end
20
31
 
21
32
  gemspec
33
+
34
+ # Use a local Gemfile to include development dependencies that might not be
35
+ # relevant for the project or for other contributors, e.g. pry-byebug.
36
+ #
37
+ # We use `send` instead of calling `eval_gemfile` to work around an issue with
38
+ # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
39
+ send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2020 Super Good Software, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Solidus nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,20 @@
1
+ What is the goal of this PR?
2
+ ---
3
+
4
+
5
+
6
+ How do you manually test these changes? (if applicable)
7
+ ---
8
+
9
+ 1. Do a thing
10
+ * [ ] Assert a result
11
+
12
+ Merge Checklist
13
+ ---
14
+
15
+ - [ ] Run the manual tests
16
+ - [ ] Update the changelog
17
+ - [ ] Run a sandbox app and verify taxes are being calculated
18
+
19
+ Screenshots
20
+ ---
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
- ## *Warning:* This extension is under active development and not yet at a v1.0 release.
1
+ # `SuperGood::SolidusTaxjar` [![Build Status](https://travis-ci.com/SuperGoodSoft/solidus_taxjar.svg?token=rc5QTgHvLLF7cpqkmyfd&branch=master)](https://travis-ci.com/SuperGoodSoft/solidus_taxjar)
2
2
 
3
- # `SuperGood::SolidusTaxJar` [![Build Status](https://travis-ci.com/SuperGoodSoft/solidus_taxjar.svg?token=rc5QTgHvLLF7cpqkmyfd&branch=master)](https://travis-ci.com/SuperGoodSoft/solidus_taxjar)
3
+ `SuperGood::SolidusTaxjar` is a [Solidus](https://github.com/solidusio/solidus) extension that allows Solidus stores to use [TaxJar](https://www.taxjar.com/) for tax calculations.
4
4
 
5
- `SuperGood::SolidusTaxJar` is a [Solidus](https://github.com/solidusio/solidus) extension that allows Solidus stores to use [TaxJar](https://www.taxjar.com/) for tax calculations.
6
-
7
- This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spree_taxjar), like [solidus_taxjar](https://github.com/boomerdigital/solidus_taxjar). Instead, `SuperGood::SolidusTaxJar` uses the new configurable tax system [introduced by @adammathys](https://github.com/solidusio/solidus/pull/1892) in Solidus 2.4.
5
+ This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spree_taxjar), like [solidus_taxjar](https://github.com/boomerdigital/solidus_taxjar). Instead of using a custom calculator, `SuperGood::SolidusTaxjar` uses the new configurable tax system [by @adammathys](https://github.com/solidusio/solidus/pull/1892) introduced in Solidus v2.4. This maps better to how the TaxJar API itself works.
8
6
 
9
7
  ## Installation
10
8
 
@@ -24,7 +22,7 @@ This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spr
24
22
  # Put this in config/initializers/solidus.rb
25
23
 
26
24
  Spree.config do |config|
27
- config.tax_calculator_class = SuperGood::SolidusTaxJar::TaxCalculator
25
+ config.tax_calculator_class = SuperGood::SolidusTaxjar::TaxCalculator
28
26
  end
29
27
  ```
30
28
 
@@ -33,18 +31,45 @@ This is not a fork of [spree_taxjar](https://github.com/vinsol-spree-contrib/spr
33
31
  ```ruby
34
32
  # Put this in config/initializers/taxjar.rb
35
33
 
36
- SuperGood::SolidusTaxJar::TaxCalculator.exception_handler = ->(e) {
34
+ SuperGood::SolidusTaxjar.exception_handler = ->(e) {
37
35
  # Report exceptions in here. For example, if you were using the Sentry's
38
36
  # raven-ruby gem to report errors, you might do this:
39
37
  Raven.capture_exception(e)
40
38
  }
41
39
  ```
42
40
 
43
- 4. Finally, make sure that the `TAXJAR_API_KEY` environment variable is set to a your TaxJar API key and make sure that you have a `Spree::TaxRate` with the name "Sales Tax". This will be used as the source for the tax adjustments that Solidus creates.
41
+ 5. Finally, make sure that the `TAXJAR_API_KEY` environment variable is set to a your TaxJar API key and make sure that you have a `Spree::TaxRate` with the name "Sales Tax". This will be used as the source for the tax adjustments that Solidus creates.
42
+
43
+ ## Project Status
44
+
45
+ This extension is under active development and not yet at a v1.0 release, but it's currently being used in production by multiple Solidus stores.
46
+
47
+ Requirements for TaxJar integrations vary as some stores also need reporting, which isn't provided out of the box by this extension. This is because individual stores will be using different background job frameworks or runners (Sidekiq, delayed_job, ActiveJob, etc.) and a reliable integration will rely on one of these. Because this part of the integration is small, we've chosen to provide the transaction reporting functionality, but have skipped directly integrating it.
48
+
49
+ If you're having trouble integrating this extension with your store and would like some assistance, please reach out to Jared via e-mail at [jared@super.gd](mailto:jared@super.gd) or on the official Solidus as `@jared`.
50
+
51
+ ## Features
52
+
53
+ The extension provides currently two high level `calculator` classes that wrap the low-level Ruby taxjar gem API calls:
54
+
55
+ * tax calculator
56
+ * tax rate calculator
57
+
58
+ The extension requires the `order_recalculated` event which is not supported on Solidus < 2.11, so this extension provides a [compatibility layer](app/decorators/super_good/solidus_taxjar/spree/order_updater/fire_recalculated_event.rb).
59
+
60
+ ### TaxCalculator
61
+
62
+ `SuperGood::SolidusTaxjar::TaxCalculator` allows calculating the full tax breakdown for a given `Spree::Order`. The breakdown includes separate line items taxes and shipment taxes.
63
+
64
+ ### TaxRateCalculator
65
+
66
+ `SuperGood::SolidusTaxjar::TaxRateCalculator` allows calculating the tax rate for a given `Spree::Address`. It relies on the same low-level Ruby TaxJar API endpoint of the tax calculator in order to provide the most coherent and reliable results. TaxJar support recommends using this endpoint for live calculations.
44
67
 
45
68
  ## Development
46
69
 
47
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
70
+ Before installing dependencies, make sure your environment variables are setup. Our CI uses something like this: `SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0`. These environment variables need to be set when installing dependencies and running specs, so set them before the command like this: `SOLIDUS_BRANCH=v2.10 DB=postgresql RAILS_VERSION="~> 5.2.0 bin/setup`
71
+
72
+ Run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
73
 
49
74
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
75
 
data/Rakefile CHANGED
@@ -1,19 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
- require 'spree/testing_support/extension_rake'
1
+ # frozen_string_literal: true
4
2
 
5
- RSpec::Core::RakeTask.new(:spec)
3
+ require 'solidus_dev_support/rake_tasks'
4
+ SolidusDevSupport::RakeTasks.install
6
5
 
7
- task :default do
8
- if Dir["spec/dummy"].empty?
9
- Rake::Task[:test_app].invoke
10
- Dir.chdir("../../")
11
- end
12
- Rake::Task[:spec].invoke
13
- end
14
-
15
- desc 'Generates a dummy app for testing'
16
- task :test_app do
17
- ENV['LIB_NAME'] = 'super_good/solidus_taxjar'
18
- Rake::Task['extension:test_app'].invoke
19
- end
6
+ task default: 'extension:specs'
@@ -0,0 +1,8 @@
1
+ module Spree
2
+ module Admin
3
+ class TaxjarSettingsController < Spree::Admin::BaseController
4
+ def show
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SuperGood
4
+ module SolidusTaxjar
5
+ module Spree
6
+ module OrderUpdater
7
+ module FireRecalculatedEvent
8
+ def persist_totals
9
+ ::Spree::Event.fire 'order_recalculated', order: order
10
+ super
11
+ end
12
+
13
+ ::Spree::OrderUpdater.prepend(self) if ::Spree.solidus_gem_version < Gem::Version.new('2.11.0')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ Deface::Override.new(
4
+ virtual_path: 'spree/admin/shared/_taxes_tabs',
5
+ name: 'add_taxjar_admin_menu_links',
6
+ insert_bottom: "[data-hook='admin_settings_taxes_tabs']"
7
+ ) do
8
+ <<-HTML
9
+ <%= configurations_sidebar_menu_item "TaxJar Settings", admin_taxjar_settings_path %>
10
+ HTML
11
+ end
@@ -0,0 +1,13 @@
1
+ <%= render 'spree/admin/shared/taxes_tabs' %>
2
+
3
+ <% content_for :page_title do %>
4
+ <%= "Taxjar Settings" %>
5
+ <% end %>
6
+
7
+ <% if ENV["TAXJAR_API_KEY"] %>
8
+ <table>
9
+ </table>
10
+ <% else %>
11
+ <p>You must provide a TaxJar API token to use this extension. You can sign up for TaxJar <%= link_to "here", "https://app.taxjar.com/api_sign_up", target: "_blank", rel: "noreferrer" %>. Please see the extension documentation for details on providing this token to the extension.</p>
12
+ <p><i>For more help in aquiring a TaxJar API token, see <%= link_to "How do I get a TaxJar sales tax API token?", "https://support.taxjar.com/article/160-how-do-i-get-a-sales-tax-api-token", target: "_blank", rel: "noreferrer" %></i></p>
13
+ <% end %>
data/bin/rails ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
7
+ end
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path("..", __dir__)
6
+ ENGINE_PATH = File.expand_path("../lib/solidus_taxjar/engine", __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
10
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+
12
+ require "rails/all"
13
+ require "rails/engine/commands"
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = "sandbox"
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn "Creating the sandbox app..."
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
9
+ warn "Automatic creation of the sandbox app failed"
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec "bin/rails", *ARGV