From 202c7c8e17fda745132777e3945224c27cb674e5 Mon Sep 17 00:00:00 2001 From: Damian Legawiec Date: Thu, 25 Apr 2024 19:02:53 +0200 Subject: [PATCH] Fixed Spree 4 compatibility (#183) * Fixed Spree 4 compatibility * fixes * Update usa_address_factory.rb * fixes * fixes * Fixed #178 * Update vcr.rb * require spree 4.3+ --- .circleci/config.yml | 173 +++++++++++------- .travis.yml | 78 -------- Appraisals | 21 --- Gemfile | 21 ++- LICENSE | 2 +- .../spree/admin/avatax_settings_controller.rb | 2 +- .../spree/user_decorator.rb | 2 +- .../generate_transaction_cache_key_service.rb | 2 +- .../avalara_entity_use_codes/edit.html.erb | 2 +- .../avalara_entity_use_codes/new.html.erb | 2 +- .../admin/users/avalara_information.html.erb | 4 +- gemfiles/spree_4_2.gemfile | 14 -- gemfiles/spree_4_3.gemfile | 17 -- spec/factories/spree/avatax_order_factory.rb | 2 + spec/factories/usa_address_factory.rb | 2 +- spec/lib/spree_avatax_official/seeder_spec.rb | 1 - spec/spec_helper.rb | 3 + spec/support/vcr.rb | 13 ++ .../returns_failure.yml | 48 ++++- ...creates_a_new_SalesInvoice_transaction.yml | 48 ++++- spree_avatax_official.gemspec | 2 +- 21 files changed, 237 insertions(+), 222 deletions(-) delete mode 100644 .travis.yml delete mode 100644 Appraisals delete mode 100644 gemfiles/spree_4_2.gemfile delete mode 100644 gemfiles/spree_4_3.gemfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 1db23101..bf2c2056 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,84 +1,115 @@ version: 2.1 +defaults: &defaults + environment: &environment + CIRCLE_TEST_REPORTS: /tmp/test-results + CIRCLE_ARTIFACTS: /tmp/test-artifacts + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 + BUNDLE_PATH: ~/spree/vendor/bundle + working_directory: ~/spree + docker: + - image: &ruby_image cimg/ruby:3.3-browsers + +run_tests: &run_tests + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - spree-bundle-{{ .Branch }} + - spree-bundle + - run: + name: Add keyserver + command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B + - run: + name: Install libvips + command: sudo apt-get update && sudo apt-get install libvips + - run: + name: Set bundle path + command: bundle config --local path vendor/bundle + - run: + name: Ensure bundle Install + command: | + bundle check || bundle install + - run: + name: Create test app + command: | + bundle exec rake test_app + - run: + name: Run Rspec + command: | + TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) + bundle exec rspec --format documentation \ + --format RspecJunitFormatter \ + -o ~/rspec/rspec.xml \ + -- ${TESTFILES} + - store_test_results: + path: ~/rspec + - store_artifacts: + path: tmp/capybara + jobs: - rspec: - parameters: - ruby-version: - type: string - gemfile: - type: string - database: - type: string - docker: - - image: circleci/ruby:<< parameters.ruby-version >>-node-browsers - environment: - DB: << parameters.database >> - - image: circleci/mysql:5.7-ram - environment: - MYSQL_DATABASE: avatax - MYSQL_USER: avatax - MYSQL_PASSWORD: password - - image: circleci/postgres:9.6-alpine - environment: - POSTGRES_USER: 'avatax' - POSTGRES_PASSWORD: 'password' - POSTGRES_DB: 'avatax' + bundle: + <<: *defaults steps: - checkout - - when: - condition: - equal: ["mysql", << parameters.database >>] - steps: - - run: - name: Configure MySQL2 - # Hack to set environment variable for later steps https://circleci.com/docs/2.0/env-vars/#example-configuration-of-environment-variables - command: echo 'export DATABASE_URL="mysql2://avatax:password@127.0.0.1/avatax"' >> $BASH_ENV - - when: - condition: - equal: ["postgres", << parameters.database >>] - steps: - - run: - name: Configure Postgres - command: echo 'export DATABASE_URL="postgresql://avatax:password@127.0.0.1/avatax"' >> $BASH_ENV - - run: - name: Configure bundler - command: bundle config --local path '~/.bundle' - - run: - name: Select Gemfile - command: cp gemfiles/<< parameters.gemfile >>.gemfile gemfiles/ci.gemfile - restore_cache: keys: - - bundler-v10-<< parameters.ruby-version >>-<< parameters.gemfile >>-{{ checksum "gemfiles/ci.gemfile" }} - - bundler-v10-<< parameters.ruby-version >>-<< parameters.gemfile >> + - spree-bundle-{{ .Branch }} + - spree-bundle - run: - name: Install dependencies - command: bundle install --gemfile=gemfiles/ci.gemfile - - save_cache: - key: bundler-v10-<< parameters.ruby-version >>-<< parameters.gemfile >>-{{ checksum "gemfiles/ci.gemfile" }} - paths: - - "~/.bundle" + name: Add keyserver + command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B - run: - name: Setup test app - command: bundle exec --gemfile=gemfiles/ci.gemfile rake test_app + name: Install libvips + command: sudo apt-get update && sudo apt-get install libvips - run: - name: Run RSpec - command: bundle exec --gemfile=gemfiles/ci.gemfile rake spec -workflows: - all-specs: - jobs: - - rspec: - matrix: - parameters: - database: - - mysql - - postgres - gemfile: - - spree_4_2 - - spree_4_3 - ruby-version: - - "3.0" - - "2.7" - + name: Set bundle path + command: bundle config --local path vendor/bundle + - run: + name: Bundle Install + command: | + bundle check || bundle install + - save_cache: + paths: + - vendor/bundle + key: spree-bundle-{{ checksum "Gemfile.lock" }} + tests_postgres: &tests_postgres + <<: *run_tests + environment: &postgres_environment + <<: *environment + DB: postgres + DB_HOST: localhost + DB_USERNAME: postgres + docker: + - image: *ruby_image + - image: &postgres_image cimg/postgres:16.2 + environment: + POSTGRES_USER: postgres + tests_mysql: &tests_mysql + <<: *run_tests + environment: &mysql_environment + <<: *environment + DB: mysql + DB_HOST: 127.0.0.1 + DB_USERNAME: root + COVERAGE: true + COVERAGE_DIR: /tmp/workspace/simplecov + docker: + - image: *ruby_image + - image: &mysql_image cimg/mysql:8.0 +workflows: + version: 2 + main: + jobs: + - bundle + - tests_postgres: + requires: + - bundle + - tests_mysql: + requires: + - bundle \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 19372415..00000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -os: linux -dist: bionic - -addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable - -services: - - mysql - - postgresql - -language: ruby - -rvm: - - 3.0 - - 2.7 - - 2.5 - - 2.3 - -env: - - DB=mysql - - DB=postgres - -gemfile: - - gemfiles/spree_3_1.gemfile - - gemfiles/spree_3_7.gemfile - - gemfiles/spree_4_0.gemfile - - gemfiles/spree_4_1.gemfile - - gemfiles/spree_4_2.gemfile - - gemfiles/spree_master.gemfile - -jobs: - fast_finish: true - allow_failures: - - gemfile: gemfiles/spree_master.gemfile - exclude: - - rvm: 3.0 - gemfile: gemfiles/spree_3_1.gemfile - - rvm: 3.0 - gemfile: gemfiles/spree_3_7.gemfile - - rvm: 3.0 - gemfile: gemfiles/spree_4_0.gemfile - - rvm: 3.0 - gemfile: gemfiles/spree_4_1.gemfile - - rvm: 2.7 - gemfile: gemfiles/spree_3_1.gemfile - - rvm: 2.5 - gemfile: gemfiles/spree_3_1.gemfile - - rvm: 2.5 - gemfile: gemfiles/spree_master.gemfile - - rvm: 2.3 - gemfile: gemfiles/spree_3_7.gemfile - - rvm: 2.3 - gemfile: gemfiles/spree_4_0.gemfile - - rvm: 2.3 - gemfile: gemfiles/spree_4_1.gemfile - - rvm: 2.3 - gemfile: gemfiles/spree_4_2.gemfile - - rvm: 2.3 - gemfile: gemfiles/spree_master.gemfile - -before_script: - - CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'` - - CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"` - - curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O - - unzip chromedriver_linux64.zip -d ~/bin - - nvm install 14 - -script: - - bundle exec rake test_app - - bundle exec rake spec - -before_install: - - sudo apt-get install libmysqlclient-dev - - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';" diff --git a/Appraisals b/Appraisals deleted file mode 100644 index 1da5c8ff..00000000 --- a/Appraisals +++ /dev/null @@ -1,21 +0,0 @@ -appraise 'spree-4-2' do - gem 'spree_core', '~> 4.2.0.beta' - gem 'spree_backend', '~> 4.2.0.beta' - gem 'spree_auth_devise', '~> 4.2.0' - gem 'rails-controller-testing' - gem 'sass-rails' - gem 'rspec-rails', '~> 4.0.0.beta2' -end - -appraise 'spree-4-3' do - gem 'spree_core', '~> 4.3.0' - gem 'spree_backend', '~> 4.3.0' - gem 'spree_frontend', '~> 4.3' - gem 'spree_auth_devise', '~> 4.3.0' - gem 'spree_emails', '>= 4.3' - gem "redis", "~> 4.0" - gem 'rails-controller-testing' - gem 'sass-rails' - gem 'rspec-rails', '~> 4.0.0.beta2' -end - diff --git a/Gemfile b/Gemfile index f1237d2c..fe1e7191 100644 --- a/Gemfile +++ b/Gemfile @@ -6,11 +6,20 @@ git_source(:github) do |repo_name| end gem 'rails-controller-testing' -gem 'rubocop', '~> 0.63.0', require: false -gem 'rubocop-rspec', require: false -gem 'spree_auth_devise' -gem 'spree_backend' -gem 'spree_core' -gem 'sass-rails' +gem 'spree', github: 'spree/spree', branch: 'main' +gem 'spree_backend', github: 'spree/spree_backend', branch: 'main' +gem 'spree_emails', github: 'spree/spree', branch: 'main' +gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: 'main' + +if ENV['DB'] == 'mysql' + gem 'mysql2' +elsif ENV['DB'] == 'postgres' + gem 'pg' +else + gem 'sqlite3', '~> 1.4' +end + +gem 'webdrivers' +gem 'pry' gemspec diff --git a/LICENSE b/LICENSE index e20baaf3..adaa5cf9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019 Spark Solutions +Copyright (c) 2019-2024 Spark Solutions Sp. z o.o. All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/app/controllers/spree/admin/avatax_settings_controller.rb b/app/controllers/spree/admin/avatax_settings_controller.rb index 126ba121..a5e23f93 100644 --- a/app/controllers/spree/admin/avatax_settings_controller.rb +++ b/app/controllers/spree/admin/avatax_settings_controller.rb @@ -4,7 +4,7 @@ class AvataxSettingsController < Spree::Admin::BaseController def edit @ship_from_address = SpreeAvataxOfficial::Config.ship_from_address @country = if @ship_from_address[:country].blank? - Spree::Country.default + current_store.default_country else Spree::Country.find_by(iso3: @ship_from_address[:country]) end diff --git a/app/models/spree_avatax_official/spree/user_decorator.rb b/app/models/spree_avatax_official/spree/user_decorator.rb index 9a9a6e28..ea0f5bc4 100644 --- a/app/models/spree_avatax_official/spree/user_decorator.rb +++ b/app/models/spree_avatax_official/spree/user_decorator.rb @@ -8,4 +8,4 @@ def self.prepended(base) end end -::Spree::User.prepend ::SpreeAvataxOfficial::Spree::UserDecorator +Spree.user_class.prepend ::SpreeAvataxOfficial::Spree::UserDecorator diff --git a/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb b/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb index 26c9d02d..2df7677c 100644 --- a/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb +++ b/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb @@ -82,7 +82,7 @@ def stock_location_cache_key(stock_location) end def avatax_preferences_cache_key(order) - ship_from_address_timestamp = ship_from_address_preference.try(:updated_at).try(:utc).try(:to_s, :number) + ship_from_address_timestamp = ship_from_address_preference.try(:updated_at).try(:utc).try(:to_i) "#{company_code(order)}-#{ship_from_address_timestamp}" end diff --git a/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb b/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb index 1b7c2015..c26ab898 100644 --- a/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb +++ b/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb @@ -2,7 +2,7 @@ <%= Spree.t('avalara_entity_use_codes') %> <% end %> -<%= render 'spree/shared/error_messages', target: @use_code %> +<%= render 'spree/admin/shared/error_messages', target: @use_code %> <%= form_for @use_code, url: admin_avalara_entity_use_code_path(@use_code), method: :put do |f| %>
diff --git a/app/views/spree/admin/avalara_entity_use_codes/new.html.erb b/app/views/spree/admin/avalara_entity_use_codes/new.html.erb index bf9331ed..ae7ca309 100644 --- a/app/views/spree/admin/avalara_entity_use_codes/new.html.erb +++ b/app/views/spree/admin/avalara_entity_use_codes/new.html.erb @@ -2,7 +2,7 @@ <%= Spree.t('avalara_entity_use_codes') %> <% end %> -<%= render 'spree/shared/error_messages', target: @use_code %> +<%= render 'spree/admin/shared/error_messages', target: @use_code %> <%= form_for @use_code, url: admin_avalara_entity_use_codes_path, html: { multipart: true } do |f| %>
diff --git a/app/views/spree/admin/users/avalara_information.html.erb b/app/views/spree/admin/users/avalara_information.html.erb index 7f5ed590..2b465123 100644 --- a/app/views/spree/admin/users/avalara_information.html.erb +++ b/app/views/spree/admin/users/avalara_information.html.erb @@ -3,11 +3,11 @@ <%= Spree.t('avalara_entity_use_codes') %> <% end %> -<%= render partial: 'spree/admin/users/sidebar', locals: { current: :avalara_informtion } %> +<%#= render partial: 'spree/admin/users/sidebar', locals: { current: :avalara_informtion } %>
- <%= render partial: 'spree/shared/error_messages', locals: { target: @user } %> + <%= render partial: 'spree/admin/shared/error_messages', locals: { target: @user } %>
diff --git a/gemfiles/spree_4_2.gemfile b/gemfiles/spree_4_2.gemfile deleted file mode 100644 index 37e52975..00000000 --- a/gemfiles/spree_4_2.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails-controller-testing" -gem "rubocop", "~> 0.63.0", require: false -gem "rubocop-rspec", require: false -gem "spree_auth_devise", "~> 4.2.0" -gem "spree_backend", "~> 4.2.0.beta" -gem "spree_core", "~> 4.2.0.beta" -gem "sass-rails" -gem "rspec-rails", "~> 4.0.0.beta2" - -gemspec path: "../" diff --git a/gemfiles/spree_4_3.gemfile b/gemfiles/spree_4_3.gemfile deleted file mode 100644 index 1e08cb6e..00000000 --- a/gemfiles/spree_4_3.gemfile +++ /dev/null @@ -1,17 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails-controller-testing" -gem "rubocop", "~> 0.63.0", require: false -gem "rubocop-rspec", require: false -gem "spree_auth_devise", "~> 4.3.0" -gem "spree_backend", "~> 4.3.0" -gem "spree_core", "~> 4.3.0" -gem "sass-rails" -gem "spree_frontend", "~> 4.3" -gem "spree_emails", ">= 4.3" -gem "redis", "~> 4.0" -gem "rspec-rails", "~> 4.0.0.beta2" - -gemspec path: "../" diff --git a/spec/factories/spree/avatax_order_factory.rb b/spec/factories/spree/avatax_order_factory.rb index c60fa36a..a0a26927 100644 --- a/spec/factories/spree/avatax_order_factory.rb +++ b/spec/factories/spree/avatax_order_factory.rb @@ -6,6 +6,8 @@ completed_at { nil } email { user.email } state { 'cart' } + currency { 'USD' } + store { Spree::Store.first || create(:store) } transient do line_items_price { 10.0 } diff --git a/spec/factories/usa_address_factory.rb b/spec/factories/usa_address_factory.rb index 6602d96f..e7f87b83 100644 --- a/spec/factories/usa_address_factory.rb +++ b/spec/factories/usa_address_factory.rb @@ -15,7 +15,7 @@ country do usa_attributes = { name: 'United States', iso_name: 'UNITED STATES', iso: 'US', iso3: 'USA' } - Spree::Country.find_by(usa_attributes) || create(:country, usa_attributes) + Spree::Country.find_by(iso: 'US') || create(:country, usa_attributes) end trait :from_california do diff --git a/spec/lib/spree_avatax_official/seeder_spec.rb b/spec/lib/spree_avatax_official/seeder_spec.rb index a20d5000..1919af99 100644 --- a/spec/lib/spree_avatax_official/seeder_spec.rb +++ b/spec/lib/spree_avatax_official/seeder_spec.rb @@ -4,7 +4,6 @@ describe '#seed!' do subject { described_class.new.seed! } - let!(:usa) { create(:country, name: 'United States', iso3: 'USA') } let!(:pennslyvania) { create(:state, name: 'Pennsylvania', abbr: 'PA') } let!(:shipping_method) { create(:shipping_method, tax_category: nil) } let(:clothing_tax_category) { Spree::TaxCategory.find_by(name: 'Clothing') } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5823132d..1ddaedb8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -92,6 +92,9 @@ config.before do Rails.cache.clear + + create(:country, name: 'United States', iso_name: 'UNITED STATES', iso: 'US', states_required: true) + create(:store, default_currency: 'USD', default_country_id: Spree::Country.first.id) end config.before(type: :feature) do diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb index a65ace76..67d93c31 100644 --- a/spec/support/vcr.rb +++ b/spec/support/vcr.rb @@ -1,3 +1,8 @@ +require 'vcr' +require 'webmock/rspec' +require 'uri' +require 'webdrivers' + VCR.configure do |config| config.allow_http_connections_when_no_cassette = false config.cassette_library_dir = 'spec/vcr' @@ -7,6 +12,14 @@ config.configure_rspec_metadata! config.hook_into :webmock + # webdrivers fix + driver_hosts = Webdrivers::Common.subclasses.map { |driver| URI(driver.base_url).host } + driver_hosts << 'googlechromelabs.github.io' + driver_hosts << 'edgedl.me.gvt1.com' + driver_hosts << 'storage.googleapis.com' + + config.ignore_hosts(*driver_hosts) + config.filter_sensitive_data('') do |interaction| interaction.request.headers['Authorization'].first end diff --git a/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_does_NOT_exist_in_avatax/returns_failure.yml b/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_does_NOT_exist_in_avatax/returns_failure.yml index 1efa7f23..95f2f575 100644 --- a/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_does_NOT_exist_in_avatax/returns_failure.yml +++ b/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_does_NOT_exist_in_avatax/returns_failure.yml @@ -39,6 +39,50 @@ http_interactions: string: '{"error":{"code":"EntityNotFoundError","message":"Transaction not found.","target":"HttpRequest","details":[{"code":"EntityNotFoundError","number":4,"message":"Transaction not found.","description":"The Transaction with code ''test1:not-existing-number'' was not found.","faultCode":"Client","helpLink":"http://developer.avalara.com/avatax/errors/EntityNotFoundError","severity":"Error"}]}}' - http_version: recorded_at: Fri, 20 Sep 2019 09:03:57 GMT -recorded_with: VCR 4.0.0 +- request: + method: get + uri: https://sandbox-rest.avatax.com/api/v2/companies/test1/transactions/NOT-EXISTING-NUMBER + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json; charset=utf-8 + User-Agent: + - AvaTax Ruby Gem 24.4.2 + X-Avalara-Client: + - a0o0b000005HsXPAA0;Spree by Spark;RubySdk;24.4.2; + Authorization: + - "" + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Date: + - Wed, 24 Apr 2024 18:01:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + X-Content-Type-Options: + - nosniff + X-Correlation-Id: + - 62404d35-57bf-4a26-9f10-339d39d221e5 + X-Avalara-Uid: + - 62404d35-57bf-4a26-9f10-339d39d221e5 + body: + encoding: UTF-8 + string: '{"error": {"code": "AuthenticationException","message": "Authentication + failed.","details": [{"code": "AuthenticationException","message": "Authentication + failed.","description": "Missing authentication or unable to authenticate + the user or the account.","faultCode": "Client","helpLink": "http://developer.avalara.com/avatax/errors/AuthenticationException"}]}}' + recorded_at: Wed, 24 Apr 2024 18:01:04 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_exists_in_avatax/returns_success_and_creates_a_new_SalesInvoice_transaction.yml b/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_exists_in_avatax/returns_success_and_creates_a_new_SalesInvoice_transaction.yml index 05f18664..630ca741 100644 --- a/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_exists_in_avatax/returns_success_and_creates_a_new_SalesInvoice_transaction.yml +++ b/spec/vcr/SpreeAvataxOfficial_Transactions_FindOrderTransactionService/_call/with_Spree_Order/when_order_does_NOT_have_a_SalesInvoice_transaction/when_transaction_exists_in_avatax/returns_success_and_creates_a_new_SalesInvoice_transaction.yml @@ -43,6 +43,50 @@ http_interactions: Market St","line2":"","line3":"","city":"San Francisco","region":"CA","postalCode":"94111","country":"US","taxRegionId":2128434,"latitude":"37.793815","longitude":"-122.395832"},{"id":11594662439,"transactionId":4810140820,"boundaryLevel":"Zip5","line1":"123 Main Street","line2":"","line3":"","city":"Irvine","region":"CA","postalCode":"92615","country":"US","taxRegionId":2127863,"latitude":"33.657808","longitude":"-117.968489"}],"locationTypes":[{"documentLocationTypeId":10848111441,"documentId":4810140820,"documentAddressId":11594662439,"locationTypeCode":"ShipFrom"},{"documentLocationTypeId":4644330636,"documentId":4810140820,"documentAddressId":9389168836,"locationTypeCode":"ShipTo"}],"summary":[{"country":"US","region":"CA","jurisType":"State","jurisCode":"06","jurisName":"CALIFORNIA","taxAuthorityType":45,"stateAssignedNo":"","taxType":"Sales","taxSubType":"S","taxName":"CA STATE TAX","rateType":"General","taxable":0.00,"rate":0.000000,"tax":0.00,"taxCalculated":0.00,"nonTaxable":120.00,"exemption":0.00}]}' - http_version: recorded_at: Fri, 20 Sep 2019 09:03:59 GMT -recorded_with: VCR 4.0.0 +- request: + method: get + uri: https://sandbox-rest.avatax.com/api/v2/companies/test1/transactions/TEST123 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json; charset=utf-8 + User-Agent: + - AvaTax Ruby Gem 24.4.2 + X-Avalara-Client: + - a0o0b000005HsXPAA0;Spree by Spark;RubySdk;24.4.2; + Authorization: + - "" + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Date: + - Wed, 24 Apr 2024 18:01:03 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + X-Content-Type-Options: + - nosniff + X-Correlation-Id: + - ab04f5ef-e37e-429f-bf3c-b83abce27784 + X-Avalara-Uid: + - ab04f5ef-e37e-429f-bf3c-b83abce27784 + body: + encoding: UTF-8 + string: '{"error": {"code": "AuthenticationException","message": "Authentication + failed.","details": [{"code": "AuthenticationException","message": "Authentication + failed.","description": "Missing authentication or unable to authenticate + the user or the account.","faultCode": "Client","helpLink": "http://developer.avalara.com/avatax/errors/AuthenticationException"}]}}' + recorded_at: Wed, 24 Apr 2024 18:01:03 GMT +recorded_with: VCR 6.2.0 diff --git a/spree_avatax_official.gemspec b/spree_avatax_official.gemspec index 21882b52..60bf6196 100644 --- a/spree_avatax_official.gemspec +++ b/spree_avatax_official.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength s.add_dependency 'avatax', '>= 19.3' - spree_version = '>= 2.1.0' + spree_version = '>= 4.3' s.add_dependency 'spree_backend', spree_version s.add_dependency 'spree_core', spree_version