super_good-solidus_taxjar 0.18.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +58 -0
  3. data/CHANGELOG.md +118 -5
  4. data/Gemfile +28 -10
  5. data/README.md +300 -45
  6. data/Rakefile +3 -0
  7. data/app/controllers/spree/admin/taxjar_settings_controller.rb +93 -0
  8. data/app/controllers/spree/admin/taxjar_transactions_controller.rb +37 -0
  9. data/app/controllers/spree/admin/transaction_sync_batches_controller.rb +18 -0
  10. data/app/jobs/super_good/solidus_taxjar/backfill_transaction_sync_batch_job.rb +23 -0
  11. data/app/jobs/super_good/solidus_taxjar/replace_transaction_job.rb +26 -0
  12. data/app/jobs/super_good/solidus_taxjar/report_transaction_job.rb +22 -0
  13. data/app/models/super_good/solidus_taxjar/configuration.rb +27 -0
  14. data/app/models/super_good/solidus_taxjar/order_transaction.rb +16 -0
  15. data/app/models/super_good/solidus_taxjar/refund_transaction.rb +13 -0
  16. data/app/models/super_good/solidus_taxjar/transaction_sync_batch.rb +11 -0
  17. data/app/models/super_good/solidus_taxjar/transaction_sync_log.rb +8 -0
  18. data/app/overrides/spree/admin/orders_controller_override.rb +12 -0
  19. data/app/overrides/spree/admin/shared/_order_submenu/add_taxjar_sync_history_tab.html.erb.deface +6 -0
  20. data/app/overrides/spree/admin/shared/_order_summary/add_taxjar_reported_at.html.erb.deface +30 -0
  21. data/app/overrides/spree/admin/shared/_taxes_tabs/add_configuration_menu_items.html.erb.deface +5 -0
  22. data/app/overrides/super_good/solidus_taxjar/spree/order_override.rb +21 -0
  23. data/app/views/spree/admin/orders/taxjar_transactions.html.erb +4 -0
  24. data/app/views/spree/admin/shared/_transaction_sync_log_table.html.erb +35 -0
  25. data/app/views/spree/admin/taxjar_settings/_nexus_regions.html.erb +23 -0
  26. data/app/views/spree/admin/taxjar_settings/_tax_categories.html.erb +41 -0
  27. data/app/views/spree/admin/taxjar_settings/edit.html.erb +17 -0
  28. data/app/views/spree/admin/taxjar_settings/edit_no_api_key.html.erb +21 -0
  29. data/app/views/spree/admin/transaction_sync_batches/index.html.erb +50 -0
  30. data/app/views/spree/admin/transaction_sync_batches/show.html.erb +7 -0
  31. data/bin/console +2 -0
  32. data/bin/rails-engine +1 -1
  33. data/bin/sandbox +43 -36
  34. data/bin/setup +3 -3
  35. data/config/routes.rb +19 -0
  36. data/db/migrate/20210908205201_create_taxjar_order_transactions.rb +16 -0
  37. data/db/migrate/20211008175113_create_taxjar_refund_transaction.rb +15 -0
  38. data/db/migrate/20211008183858_add_transaction_date_to_order_transaction.rb +5 -0
  39. data/db/migrate/20211119143354_create_configuration.rb +8 -0
  40. data/db/migrate/20220405213958_create_transaction_sync_batches.rb +7 -0
  41. data/db/migrate/20220405215225_create_transaction_sync_logs.rb +14 -0
  42. data/db/migrate/20220908181655_add_dates_to_transaction_sync_batch.rb +6 -0
  43. data/db/migrate/20220912182210_allow_null_transaction_sync_batches_on_logs.rb +5 -0
  44. data/db/migrate/20230320211309_add_refund_transaction_to_sync_logs.rb +5 -0
  45. data/lib/generators/super_good/solidus_taxjar/install/install_generator.rb +68 -0
  46. data/lib/super_good/engine.rb +2 -0
  47. data/lib/super_good/solidus_taxjar/addresses.rb +3 -3
  48. data/lib/super_good/solidus_taxjar/api.rb +45 -9
  49. data/lib/super_good/solidus_taxjar/api_params.rb +93 -26
  50. data/lib/super_good/solidus_taxjar/backfill_transactions.rb +11 -0
  51. data/lib/super_good/solidus_taxjar/cached_api.rb +23 -0
  52. data/lib/super_good/solidus_taxjar/calculator_helper.rb +34 -5
  53. data/lib/super_good/solidus_taxjar/discount_calculator.rb +1 -1
  54. data/lib/super_good/solidus_taxjar/overrides/request_override.rb +15 -0
  55. data/lib/super_good/solidus_taxjar/reportable.rb +91 -0
  56. data/lib/super_good/solidus_taxjar/reporting.rb +44 -0
  57. data/lib/super_good/solidus_taxjar/spree/legacy_reporting_subscriber.rb +41 -0
  58. data/lib/super_good/solidus_taxjar/spree/reporting_subscriber.rb +40 -0
  59. data/lib/super_good/solidus_taxjar/tax_calculator.rb +10 -4
  60. data/lib/super_good/solidus_taxjar/testing_support/factories/address_factory.rb +11 -0
  61. data/lib/super_good/solidus_taxjar/testing_support/factories/configuration_factory.rb +11 -0
  62. data/lib/super_good/solidus_taxjar/testing_support/factories/order_transaction_factory.rb +22 -0
  63. data/lib/super_good/solidus_taxjar/testing_support/factories/refund_transaction_factory.rb +7 -0
  64. data/lib/super_good/solidus_taxjar/testing_support/factories/transaction_sync_batch_factory.rb +9 -0
  65. data/lib/super_good/solidus_taxjar/testing_support/factories/transaction_sync_log_factory.rb +18 -0
  66. data/lib/super_good/solidus_taxjar/transaction_id_generator.rb +45 -0
  67. data/lib/super_good/solidus_taxjar/version.rb +1 -1
  68. data/lib/super_good/solidus_taxjar.rb +30 -3
  69. data/spec/features/spree/admin/backfill_transactions_spec.rb +138 -0
  70. data/spec/features/spree/admin/refund_spec.rb +167 -0
  71. data/spec/features/spree/admin/reporting_to_taxjar_spec.rb +156 -0
  72. data/spec/features/spree/admin/taxjar_settings_spec.rb +90 -0
  73. data/spec/features/spree/checkout_spec.rb +58 -0
  74. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_nexus_regions/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_nexus_regions.yml +57 -0
  75. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_tax_categories/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_tax_categories.yml +57 -0
  76. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_is_set/shows_the_settings_page.yml +2437 -0
  77. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/doesn_t_show_any_other_TaxJar_features.yml +57 -0
  78. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/shows_a_descriptive_error_message.yml +57 -0
  79. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_reporting_is_enabled/shows_that_reporting_is_enabled.yml +2382 -0
  80. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/order_is_shipped/the_user_backfills_their_transactions.yml +2511 -0
  81. data/spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/the_user_navigates_to_the_TaxJar_Settings.yml +2382 -0
  82. data/spec/fixtures/cassettes/Admin_Transaction_Sync_Batches/user_has_a_shipped_order/starts_a_transaction_backfill.yml +370 -0
  83. data/spec/fixtures/cassettes/Reporting_orders_to_TaxJar/shipping_a_complete_and_paid_order.yml +310 -0
  84. data/spec/fixtures/cassettes/Reporting_orders_to_TaxJar/updating_an_order_which_was_not_reported_due_to_failure/it_reports_the_order_instead_of_trying_to_replace_it.yml +794 -0
  85. data/spec/fixtures/cassettes/Reporting_orders_to_TaxJar/with_an_order_with_invalid_zipcode/retry_of_a_previously_failed_transaction_sync.yml +418 -0
  86. data/spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_batch.yml +250 -0
  87. data/spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_log_in_the_batch_with_an_order.yml +250 -0
  88. data/spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/creates_a_batch.yml +250 -0
  89. data/spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/user_supplies_start_and_end_date/creates_a_batch.yml +250 -0
  90. data/spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_not_within_a_nexus_region/1_3_2_2_2_1.yml +58 -0
  91. data/spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_within_a_nexus_region/1_3_2_2_1_1.yml +58 -0
  92. data/spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/doesn_t_create_a_new_transaction.yml +393 -0
  93. data/spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/raises_an_error.yml +393 -0
  94. data/spec/fixtures/cassettes/Taxjar_API_Request/logging_is_disabled/doesn_t_call_the_logger.yml +158 -0
  95. data/spec/fixtures/cassettes/Taxjar_API_Request/logging_is_enabled/calls_the_logger.yml +158 -0
  96. data/spec/fixtures/cassettes/features/spree/admin/checkout.yml +238 -0
  97. data/spec/fixtures/cassettes/features/spree/admin/refund.yml +1162 -0
  98. data/spec/jobs/super_good/solidus_taxjar/backfill_transaction_sync_batch_job_spec.rb +117 -0
  99. data/spec/jobs/super_good/solidus_taxjar/replace_transaction_job_spec.rb +95 -0
  100. data/spec/jobs/super_good/solidus_taxjar/report_transaction_job_spec.rb +76 -0
  101. data/spec/models/super_good/solidus_taxjar/configuration_spec.rb +79 -0
  102. data/spec/models/super_good/solidus_taxjar/order_transaction_spec.rb +36 -0
  103. data/spec/models/super_good/solidus_taxjar/transaction_sync_batch_spec.rb +48 -0
  104. data/spec/requests/spree/admin/order_request_spec.rb +121 -0
  105. data/spec/requests/spree/admin/taxjar_settings_request_spec.rb +198 -0
  106. data/spec/requests/spree/admin/taxjar_transactions_request_spec.rb +62 -0
  107. data/spec/requests/spree/admin/transaction_sync_batches_request_spec.rb +82 -0
  108. data/spec/spec_helper.rb +47 -4
  109. data/spec/subscribers/super_good/solidus_taxjar/spree/reporting_subscriber_spec.rb +278 -0
  110. data/spec/super_good/solidus_taxjar/addresses_spec.rb +0 -14
  111. data/spec/super_good/solidus_taxjar/api_params_spec.rb +284 -80
  112. data/spec/super_good/solidus_taxjar/api_spec.rb +168 -28
  113. data/spec/super_good/solidus_taxjar/backfill_transactions_spec.rb +24 -0
  114. data/spec/super_good/solidus_taxjar/cached_api_spec.rb +58 -0
  115. data/spec/super_good/solidus_taxjar/calculator_helper_spec.rb +131 -0
  116. data/spec/super_good/solidus_taxjar/discount_calculator_spec.rb +19 -2
  117. data/spec/super_good/solidus_taxjar/reportable_spec.rb +194 -0
  118. data/spec/super_good/solidus_taxjar/reporting_spec.rb +243 -0
  119. data/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +19 -19
  120. data/spec/super_good/solidus_taxjar/tax_rate_calculator_spec.rb +8 -3
  121. data/spec/super_good/solidus_taxjar/transaction_id_generator_spec.rb +77 -0
  122. data/spec/super_good/solidus_taxjar_spec.rb +99 -0
  123. data/spec/support/checkoutable_store_shared_context.rb +19 -0
  124. data/spec/support/solidus_events_helper.rb +26 -0
  125. data/spec/taxjar/api/request_spec.rb +52 -0
  126. data/super_good-solidus_taxjar.gemspec +4 -3
  127. metadata +176 -14
@@ -5,6 +5,54 @@ RSpec.describe SuperGood::SolidusTaxjar do
5
5
  expect(SuperGood::SolidusTaxjar::VERSION).not_to be nil
6
6
  end
7
7
 
8
+ describe ".table_name_prefix" do
9
+ subject { described_class.table_name_prefix }
10
+
11
+ it { is_expected.to eq("solidus_taxjar_") }
12
+ end
13
+
14
+ describe ".api" do
15
+ subject { described_class.api }
16
+
17
+ it "returns an instance of the api client" do
18
+ expect(subject).to be_a(SuperGood::SolidusTaxjar::Api)
19
+ end
20
+ end
21
+
22
+ describe ".reporting" do
23
+ subject { described_class.reporting }
24
+
25
+ it "creates a new reporting" do
26
+ expect(subject).to be_a(::SuperGood::SolidusTaxjar::Reporting)
27
+ end
28
+ end
29
+
30
+ describe ".logger" do
31
+ subject { described_class.logger }
32
+
33
+ let(:logger_double) { instance_double(Logger) }
34
+
35
+ context "logger is set" do
36
+ before do
37
+ described_class.logger = logger_double
38
+ end
39
+
40
+ after do
41
+ described_class.logger = nil
42
+ end
43
+
44
+ it "returns the logger" do
45
+ expect(subject).to be(logger_double)
46
+ end
47
+ end
48
+
49
+ context "no logger is set" do
50
+ it "returns the Rails logger" do
51
+ expect(subject).to be(Rails.logger)
52
+ end
53
+ end
54
+ end
55
+
8
56
  describe "configuration" do
9
57
  describe ".cache_key" do
10
58
  subject { described_class.cache_key.call(order) }
@@ -21,6 +69,28 @@ RSpec.describe SuperGood::SolidusTaxjar do
21
69
  end
22
70
  end
23
71
 
72
+ describe ".cache_duration" do
73
+ subject { described_class.cache_duration }
74
+
75
+ it "returns the default cache duration" do
76
+ expect(subject).to eq(3.hours)
77
+ end
78
+
79
+ context "when set to another value" do
80
+ before do
81
+ described_class.cache_duration = 1.hour
82
+ end
83
+
84
+ it "returns the correct cache duration" do
85
+ expect(subject).to eq(1.hour)
86
+ end
87
+
88
+ after do
89
+ described_class.cache_duration = 3.hours
90
+ end
91
+ end
92
+ end
93
+
24
94
  describe ".discount_calculator" do
25
95
  subject { described_class.discount_calculator }
26
96
  it { is_expected.to eq SuperGood::SolidusTaxjar::DiscountCalculator }
@@ -73,5 +143,34 @@ RSpec.describe SuperGood::SolidusTaxjar do
73
143
  let(:spree_line_item) { Spree::LineItem.new }
74
144
  it { is_expected.to eq "Sales Tax" }
75
145
  end
146
+
147
+ describe ".shipping_calculator" do
148
+ subject { described_class.shipping_calculator.call(order) }
149
+
150
+ let(:order) { create :order }
151
+ let(:shipment) { create :shipment, order: order, cost: 20 }
152
+
153
+ before do
154
+ create :adjustment, order: order, adjustable: shipment, amount: -10, eligible: true, source: create(:shipping_rate, shipment: shipment)
155
+ end
156
+
157
+ it "returns the shipment total including promotions" do
158
+ expect(subject).to eq(10)
159
+ end
160
+ end
161
+
162
+ describe ".job_queue" do
163
+ subject { described_class.job_queue }
164
+
165
+ it { is_expected.to eq :default }
166
+ end
167
+
168
+ describe ".configuration" do
169
+ subject { described_class.configuration }
170
+
171
+ it "returns a Configuration instance" do
172
+ expect(subject).to be_instance_of(SuperGood::SolidusTaxjar::Configuration)
173
+ end
174
+ end
76
175
  end
77
176
  end
@@ -0,0 +1,19 @@
1
+ # Set up some data that a store needs to work and be realistic.
2
+ #
3
+ RSpec.shared_context "checkoutable store" do
4
+ let!(:default_store) { create :store, default: true }
5
+ let!(:taxjar_configuration) {
6
+ create :taxjar_configuration, :reporting_enabled
7
+ }
8
+
9
+ let!(:california) {
10
+ create :state,
11
+ country: create(:country, states_required: true),
12
+ state_code: "CA"
13
+ }
14
+
15
+ let!(:check_payment_method) { create :check_payment_method }
16
+ let!(:shipping_method) { create :shipping_method }
17
+ let!(:stock_location) { create :stock_location }
18
+ let!(:zone) { create :zone }
19
+ end
@@ -0,0 +1,26 @@
1
+ module SolidusEventsHelper
2
+ # We can use this helper method to ensure that events are not run until after
3
+ # the test setup has been completed. This helps us more easily test side
4
+ # effects from events or control unintended side effects when attempting to
5
+ # test functionality that is not event-driven but would otherwise emit events.
6
+ #
7
+ # @yield Any test setup you'd like to run without events being emitted.
8
+ # @return The return value of the test setup in your block.
9
+ def with_events_disabled(&block)
10
+ if SolidusSupport::LegacyEventCompat.using_legacy?
11
+ allow(Spree::Event).to receive(:fire).and_return(nil)
12
+ else
13
+ allow(Spree::Bus).to receive(:publish).and_return(nil)
14
+ end
15
+
16
+ object = yield block
17
+
18
+ if SolidusSupport::LegacyEventCompat.using_legacy?
19
+ allow(Spree::Event).to receive(:fire).and_call_original
20
+ else
21
+ allow(Spree::Bus).to receive(:publish).and_call_original
22
+ end
23
+
24
+ object
25
+ end
26
+ end
@@ -0,0 +1,52 @@
1
+ RSpec.describe Taxjar::API::Request, :vcr do
2
+ subject { Taxjar::API::Request.new(client, :get, '/v2/summary_rates', 'summary_rates').perform }
3
+
4
+ let(:logger) { double(Logger) }
5
+ let(:client) { Taxjar::Client.new(api_key: ENV["TAXJAR_API_KEY"], api_url: "https://api.sandbox.taxjar.com") }
6
+
7
+ before do
8
+ allow(SuperGood::SolidusTaxjar).to receive(:logger).and_return(logger)
9
+ end
10
+
11
+
12
+ context "logging is enabled" do
13
+ before do
14
+ allow(SuperGood::SolidusTaxjar).to receive(:logging_enabled).and_return(true)
15
+ end
16
+
17
+ it "calls the logger", :aggregate_failures do
18
+ allow(logger).to receive(:debug)
19
+ allow(logger).to receive(:info)
20
+
21
+ subject
22
+
23
+ # When recording a cassette with VCR for this spec, one extra log
24
+ # statement is generated. In general we expect this to be called twice,
25
+ # but specify at least 2 times so cassettes can be re-recorded.
26
+ expect(logger).to have_received(:debug).at_least(2).times do |&block|
27
+ expect(block.call)
28
+ .to match("Host: api.sandbox.taxjar.com")
29
+ .or(match(/"summary_rates":/))
30
+ end
31
+
32
+ expect(logger).to have_received(:info).at_least(2).times do |&block|
33
+ expect(block.call)
34
+ .to match("> GET https://api.sandbox.taxjar.com/v2/summary_rates")
35
+ .or(match("< 200 OK"))
36
+ end
37
+ end
38
+ end
39
+
40
+ context "logging is disabled" do
41
+ before do
42
+ allow(SuperGood::SolidusTaxjar).to receive(:logging_enabled).and_return(false)
43
+ end
44
+
45
+ it "doesn't call the logger" do
46
+ expect(logger).to_not receive(:debug)
47
+ expect(logger).to_not receive(:info)
48
+
49
+ subject
50
+ end
51
+ end
52
+ end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/SuperGoodSoft/solidus_taxjar"
14
14
  spec.license = 'BSD-3-Clause'
15
15
 
16
- spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
16
+ spec.required_ruby_version = ">= 2.5.0"
17
17
 
18
18
  # Specify which files should be added to the gem when it is released.
19
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -25,13 +25,14 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
+ spec.add_dependency "deface", ">= 1"
28
29
  spec.add_dependency "solidus_core", ">= 2.4.0"
29
- spec.add_dependency "solidus_support"
30
+ spec.add_dependency "solidus_support", ">= 0.9.0"
30
31
  spec.add_dependency "taxjar-ruby"
31
32
 
32
33
  spec.add_development_dependency "solidus_dev_support"
33
34
  spec.add_development_dependency "bundler"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rake"
35
36
  spec.add_development_dependency "rspec", "~> 3.0"
36
37
  spec.add_development_dependency "rspec-rails"
37
38
  spec.add_development_dependency "vcr", "~> 4.0"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_good-solidus_taxjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: deface
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: solidus_core
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,14 +44,14 @@ dependencies:
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: 0.9.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: 0.9.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: taxjar-ruby
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +98,16 @@ dependencies:
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -157,6 +171,7 @@ executables: []
157
171
  extensions: []
158
172
  extra_rdoc_files: []
159
173
  files:
174
+ - ".circleci/config.yml"
160
175
  - ".gitignore"
161
176
  - ".rspec"
162
177
  - ".travis.yml"
@@ -167,6 +182,30 @@ files:
167
182
  - PULL_REQUEST_TEMPLATE.md
168
183
  - README.md
169
184
  - Rakefile
185
+ - app/controllers/spree/admin/taxjar_settings_controller.rb
186
+ - app/controllers/spree/admin/taxjar_transactions_controller.rb
187
+ - app/controllers/spree/admin/transaction_sync_batches_controller.rb
188
+ - app/jobs/super_good/solidus_taxjar/backfill_transaction_sync_batch_job.rb
189
+ - app/jobs/super_good/solidus_taxjar/replace_transaction_job.rb
190
+ - app/jobs/super_good/solidus_taxjar/report_transaction_job.rb
191
+ - app/models/super_good/solidus_taxjar/configuration.rb
192
+ - app/models/super_good/solidus_taxjar/order_transaction.rb
193
+ - app/models/super_good/solidus_taxjar/refund_transaction.rb
194
+ - app/models/super_good/solidus_taxjar/transaction_sync_batch.rb
195
+ - app/models/super_good/solidus_taxjar/transaction_sync_log.rb
196
+ - app/overrides/spree/admin/orders_controller_override.rb
197
+ - app/overrides/spree/admin/shared/_order_submenu/add_taxjar_sync_history_tab.html.erb.deface
198
+ - app/overrides/spree/admin/shared/_order_summary/add_taxjar_reported_at.html.erb.deface
199
+ - app/overrides/spree/admin/shared/_taxes_tabs/add_configuration_menu_items.html.erb.deface
200
+ - app/overrides/super_good/solidus_taxjar/spree/order_override.rb
201
+ - app/views/spree/admin/orders/taxjar_transactions.html.erb
202
+ - app/views/spree/admin/shared/_transaction_sync_log_table.html.erb
203
+ - app/views/spree/admin/taxjar_settings/_nexus_regions.html.erb
204
+ - app/views/spree/admin/taxjar_settings/_tax_categories.html.erb
205
+ - app/views/spree/admin/taxjar_settings/edit.html.erb
206
+ - app/views/spree/admin/taxjar_settings/edit_no_api_key.html.erb
207
+ - app/views/spree/admin/transaction_sync_batches/index.html.erb
208
+ - app/views/spree/admin/transaction_sync_batches/show.html.erb
170
209
  - bin/console
171
210
  - bin/rails
172
211
  - bin/rails-engine
@@ -174,55 +213,178 @@ files:
174
213
  - bin/rake
175
214
  - bin/sandbox
176
215
  - bin/setup
216
+ - config/routes.rb
217
+ - db/migrate/20210908205201_create_taxjar_order_transactions.rb
218
+ - db/migrate/20211008175113_create_taxjar_refund_transaction.rb
219
+ - db/migrate/20211008183858_add_transaction_date_to_order_transaction.rb
220
+ - db/migrate/20211119143354_create_configuration.rb
221
+ - db/migrate/20220405213958_create_transaction_sync_batches.rb
222
+ - db/migrate/20220405215225_create_transaction_sync_logs.rb
223
+ - db/migrate/20220908181655_add_dates_to_transaction_sync_batch.rb
224
+ - db/migrate/20220912182210_allow_null_transaction_sync_batches_on_logs.rb
225
+ - db/migrate/20230320211309_add_refund_transaction_to_sync_logs.rb
226
+ - lib/generators/super_good/solidus_taxjar/install/install_generator.rb
177
227
  - lib/super_good-solidus_taxjar.rb
178
228
  - lib/super_good/engine.rb
179
229
  - lib/super_good/solidus_taxjar.rb
180
230
  - lib/super_good/solidus_taxjar/addresses.rb
181
231
  - lib/super_good/solidus_taxjar/api.rb
182
232
  - lib/super_good/solidus_taxjar/api_params.rb
233
+ - lib/super_good/solidus_taxjar/backfill_transactions.rb
234
+ - lib/super_good/solidus_taxjar/cached_api.rb
183
235
  - lib/super_good/solidus_taxjar/calculator_helper.rb
184
236
  - lib/super_good/solidus_taxjar/discount_calculator.rb
237
+ - lib/super_good/solidus_taxjar/overrides/request_override.rb
238
+ - lib/super_good/solidus_taxjar/reportable.rb
239
+ - lib/super_good/solidus_taxjar/reporting.rb
240
+ - lib/super_good/solidus_taxjar/spree/legacy_reporting_subscriber.rb
241
+ - lib/super_good/solidus_taxjar/spree/reporting_subscriber.rb
185
242
  - lib/super_good/solidus_taxjar/tax_calculator.rb
186
243
  - lib/super_good/solidus_taxjar/tax_rate_calculator.rb
244
+ - lib/super_good/solidus_taxjar/testing_support/factories/address_factory.rb
245
+ - lib/super_good/solidus_taxjar/testing_support/factories/configuration_factory.rb
246
+ - lib/super_good/solidus_taxjar/testing_support/factories/order_transaction_factory.rb
247
+ - lib/super_good/solidus_taxjar/testing_support/factories/refund_transaction_factory.rb
248
+ - lib/super_good/solidus_taxjar/testing_support/factories/transaction_sync_batch_factory.rb
249
+ - lib/super_good/solidus_taxjar/testing_support/factories/transaction_sync_log_factory.rb
250
+ - lib/super_good/solidus_taxjar/transaction_id_generator.rb
187
251
  - lib/super_good/solidus_taxjar/version.rb
252
+ - spec/features/spree/admin/backfill_transactions_spec.rb
253
+ - spec/features/spree/admin/refund_spec.rb
254
+ - spec/features/spree/admin/reporting_to_taxjar_spec.rb
255
+ - spec/features/spree/admin/taxjar_settings_spec.rb
256
+ - spec/features/spree/checkout_spec.rb
257
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_nexus_regions/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_nexus_regions.yml
258
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_tax_categories/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_tax_categories.yml
259
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_is_set/shows_the_settings_page.yml
260
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/doesn_t_show_any_other_TaxJar_features.yml
261
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/shows_a_descriptive_error_message.yml
262
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_reporting_is_enabled/shows_that_reporting_is_enabled.yml
263
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/order_is_shipped/the_user_backfills_their_transactions.yml
264
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/the_user_navigates_to_the_TaxJar_Settings.yml
265
+ - spec/fixtures/cassettes/Admin_Transaction_Sync_Batches/user_has_a_shipped_order/starts_a_transaction_backfill.yml
266
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/shipping_a_complete_and_paid_order.yml
267
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/updating_an_order_which_was_not_reported_due_to_failure/it_reports_the_order_instead_of_trying_to_replace_it.yml
268
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/with_an_order_with_invalid_zipcode/retry_of_a_previously_failed_transaction_sync.yml
269
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_batch.yml
270
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_log_in_the_batch_with_an_order.yml
271
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/creates_a_batch.yml
272
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/user_supplies_start_and_end_date/creates_a_batch.yml
273
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_not_within_a_nexus_region/1_3_2_2_2_1.yml
274
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_within_a_nexus_region/1_3_2_2_1_1.yml
275
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/doesn_t_create_a_new_transaction.yml
276
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/raises_an_error.yml
277
+ - spec/fixtures/cassettes/Taxjar_API_Request/logging_is_disabled/doesn_t_call_the_logger.yml
278
+ - spec/fixtures/cassettes/Taxjar_API_Request/logging_is_enabled/calls_the_logger.yml
279
+ - spec/fixtures/cassettes/features/spree/admin/checkout.yml
280
+ - spec/fixtures/cassettes/features/spree/admin/refund.yml
281
+ - spec/jobs/super_good/solidus_taxjar/backfill_transaction_sync_batch_job_spec.rb
282
+ - spec/jobs/super_good/solidus_taxjar/replace_transaction_job_spec.rb
283
+ - spec/jobs/super_good/solidus_taxjar/report_transaction_job_spec.rb
284
+ - spec/models/super_good/solidus_taxjar/configuration_spec.rb
285
+ - spec/models/super_good/solidus_taxjar/order_transaction_spec.rb
286
+ - spec/models/super_good/solidus_taxjar/transaction_sync_batch_spec.rb
287
+ - spec/requests/spree/admin/order_request_spec.rb
288
+ - spec/requests/spree/admin/taxjar_settings_request_spec.rb
289
+ - spec/requests/spree/admin/taxjar_transactions_request_spec.rb
290
+ - spec/requests/spree/admin/transaction_sync_batches_request_spec.rb
188
291
  - spec/spec_helper.rb
292
+ - spec/subscribers/super_good/solidus_taxjar/spree/reporting_subscriber_spec.rb
189
293
  - spec/super_good/solidus_taxjar/addresses_spec.rb
190
294
  - spec/super_good/solidus_taxjar/api_params_spec.rb
191
295
  - spec/super_good/solidus_taxjar/api_spec.rb
296
+ - spec/super_good/solidus_taxjar/backfill_transactions_spec.rb
297
+ - spec/super_good/solidus_taxjar/cached_api_spec.rb
298
+ - spec/super_good/solidus_taxjar/calculator_helper_spec.rb
192
299
  - spec/super_good/solidus_taxjar/discount_calculator_spec.rb
300
+ - spec/super_good/solidus_taxjar/reportable_spec.rb
301
+ - spec/super_good/solidus_taxjar/reporting_spec.rb
193
302
  - spec/super_good/solidus_taxjar/tax_calculator_spec.rb
194
303
  - spec/super_good/solidus_taxjar/tax_rate_calculator_spec.rb
304
+ - spec/super_good/solidus_taxjar/transaction_id_generator_spec.rb
195
305
  - spec/super_good/solidus_taxjar_spec.rb
306
+ - spec/support/checkoutable_store_shared_context.rb
307
+ - spec/support/solidus_events_helper.rb
308
+ - spec/taxjar/api/request_spec.rb
196
309
  - super_good-solidus_taxjar.gemspec
197
310
  homepage: https://github.com/SuperGoodSoft/solidus_taxjar
198
311
  licenses:
199
312
  - BSD-3-Clause
200
313
  metadata: {}
201
- post_install_message:
314
+ post_install_message:
202
315
  rdoc_options: []
203
316
  require_paths:
204
317
  - lib
205
318
  required_ruby_version: !ruby/object:Gem::Requirement
206
319
  requirements:
207
- - - "~>"
320
+ - - ">="
208
321
  - !ruby/object:Gem::Version
209
- version: '2.5'
322
+ version: 2.5.0
210
323
  required_rubygems_version: !ruby/object:Gem::Requirement
211
324
  requirements:
212
325
  - - ">="
213
326
  - !ruby/object:Gem::Version
214
327
  version: '0'
215
328
  requirements: []
216
- rubygems_version: 3.1.4
217
- signing_key:
329
+ rubygems_version: 3.4.19
330
+ signing_key:
218
331
  specification_version: 4
219
332
  summary: Support for using TaxJar to handle tax calculations in Solidus
220
333
  test_files:
334
+ - spec/features/spree/admin/backfill_transactions_spec.rb
335
+ - spec/features/spree/admin/refund_spec.rb
336
+ - spec/features/spree/admin/reporting_to_taxjar_spec.rb
337
+ - spec/features/spree/admin/taxjar_settings_spec.rb
338
+ - spec/features/spree/checkout_spec.rb
339
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_nexus_regions/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_nexus_regions.yml
340
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/GET_sync_tax_categories/Taxjar_API_token_is_not_set/doesn_t_make_a_request_for_the_tax_categories.yml
341
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_is_set/shows_the_settings_page.yml
342
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/doesn_t_show_any_other_TaxJar_features.yml
343
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_API_token_isn_t_set/shows_a_descriptive_error_message.yml
344
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/Taxjar_reporting_is_enabled/shows_that_reporting_is_enabled.yml
345
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/order_is_shipped/the_user_backfills_their_transactions.yml
346
+ - spec/fixtures/cassettes/Admin_TaxJar_Settings/Taxjar_settings_tab/the_user_navigates_to_the_TaxJar_Settings.yml
347
+ - spec/fixtures/cassettes/Admin_Transaction_Sync_Batches/user_has_a_shipped_order/starts_a_transaction_backfill.yml
348
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/shipping_a_complete_and_paid_order.yml
349
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/updating_an_order_which_was_not_reported_due_to_failure/it_reports_the_order_instead_of_trying_to_replace_it.yml
350
+ - spec/fixtures/cassettes/Reporting_orders_to_TaxJar/with_an_order_with_invalid_zipcode/retry_of_a_previously_failed_transaction_sync.yml
351
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_batch.yml
352
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/creates_a_log_in_the_batch_with_an_order.yml
353
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/creates_a_batch.yml
354
+ - spec/fixtures/cassettes/Spree_Admin_TransactionSyncBatchesController/_create/user_supplies_a_start_date/user_supplies_start_and_end_date/creates_a_batch.yml
355
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_not_within_a_nexus_region/1_3_2_2_2_1.yml
356
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_CalculatorHelper/_taxable_address_/when_taxable_address_check_returns_true/with_US_address/when_the_address_is_within_a_nexus_region/1_3_2_2_1_1.yml
357
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/doesn_t_create_a_new_transaction.yml
358
+ - spec/fixtures/cassettes/SuperGood_SolidusTaxjar_Reporting/_refund_and_create_transaction/when_Taxjar_cannot_create_a_refund_transaction/raises_an_error.yml
359
+ - spec/fixtures/cassettes/Taxjar_API_Request/logging_is_disabled/doesn_t_call_the_logger.yml
360
+ - spec/fixtures/cassettes/Taxjar_API_Request/logging_is_enabled/calls_the_logger.yml
361
+ - spec/fixtures/cassettes/features/spree/admin/checkout.yml
362
+ - spec/fixtures/cassettes/features/spree/admin/refund.yml
363
+ - spec/jobs/super_good/solidus_taxjar/backfill_transaction_sync_batch_job_spec.rb
364
+ - spec/jobs/super_good/solidus_taxjar/replace_transaction_job_spec.rb
365
+ - spec/jobs/super_good/solidus_taxjar/report_transaction_job_spec.rb
366
+ - spec/models/super_good/solidus_taxjar/configuration_spec.rb
367
+ - spec/models/super_good/solidus_taxjar/order_transaction_spec.rb
368
+ - spec/models/super_good/solidus_taxjar/transaction_sync_batch_spec.rb
369
+ - spec/requests/spree/admin/order_request_spec.rb
370
+ - spec/requests/spree/admin/taxjar_settings_request_spec.rb
371
+ - spec/requests/spree/admin/taxjar_transactions_request_spec.rb
372
+ - spec/requests/spree/admin/transaction_sync_batches_request_spec.rb
221
373
  - spec/spec_helper.rb
374
+ - spec/subscribers/super_good/solidus_taxjar/spree/reporting_subscriber_spec.rb
222
375
  - spec/super_good/solidus_taxjar/addresses_spec.rb
223
376
  - spec/super_good/solidus_taxjar/api_params_spec.rb
224
377
  - spec/super_good/solidus_taxjar/api_spec.rb
378
+ - spec/super_good/solidus_taxjar/backfill_transactions_spec.rb
379
+ - spec/super_good/solidus_taxjar/cached_api_spec.rb
380
+ - spec/super_good/solidus_taxjar/calculator_helper_spec.rb
225
381
  - spec/super_good/solidus_taxjar/discount_calculator_spec.rb
382
+ - spec/super_good/solidus_taxjar/reportable_spec.rb
383
+ - spec/super_good/solidus_taxjar/reporting_spec.rb
226
384
  - spec/super_good/solidus_taxjar/tax_calculator_spec.rb
227
385
  - spec/super_good/solidus_taxjar/tax_rate_calculator_spec.rb
386
+ - spec/super_good/solidus_taxjar/transaction_id_generator_spec.rb
228
387
  - spec/super_good/solidus_taxjar_spec.rb
388
+ - spec/support/checkoutable_store_shared_context.rb
389
+ - spec/support/solidus_events_helper.rb
390
+ - spec/taxjar/api/request_spec.rb