Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from spree-contrib:master #1

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
608731d
updated
himanshumishra31 Apr 10, 2018
c1e46bc
upated readme and upgraded to 3.2 3.3 3.4
himanshumishra31 Apr 11, 2018
0060702
spec fixed
himanshumishra31 Apr 13, 2018
1e1f235
deploy button added
himanshumishra31 Apr 18, 2018
26c23f4
cr fix
himanshumishra31 Apr 23, 2018
3f2fb73
appraise master added
himanshumishra31 Apr 23, 2018
f00d95c
deploy buttons added
himanshumishra31 Apr 23, 2018
ebb53f5
pr fix
himanshumishra31 Apr 24, 2018
2d5b305
pr fix
himanshumishra31 Apr 24, 2018
75d4730
Merge pull request #37 from himanshumishra31/appraise
himanshumishra31 Apr 24, 2018
f2a907f
Update factory_girl to factory_bot
padi May 28, 2018
ae59136
Upgrade taxjar-ruby from ~> 1.5 (latest: 1.7.1) to 2.0.0
padi May 28, 2018
ca09352
branch updated in readme
himanshumishra31 May 29, 2018
e0bb95c
Merge pull request #39 from padi/upgrade-factory-bot
sawangupta92 May 29, 2018
d91978e
Merge pull request #40 from padi/upgrade-taxjar-ruby
sawangupta92 May 29, 2018
c97a307
Update README.md
adhirajgautam Oct 15, 2018
e9fb318
Merge pull request #43 from vinsol-spree-contrib/youtube-patch-1
tanmay3011 Oct 15, 2018
c6123fd
check spree configuration management permission to show sidebar menu …
bhtabor Oct 14, 2019
c38b08d
Merge pull request #48 from bhtabor/master
nimish13 Oct 14, 2019
e95cbd9
Replace class_eval with prepend approach for extended model classes
nnande Mar 6, 2020
f5268a0
Move app_configuration_decorator to initializer
nnande Mar 6, 2020
aae133d
Set spree version dependency as '~>4.1' - work with 4.1.rc3
nnande Mar 6, 2020
d543a64
Removed factories.rb file (no factories defined by gem)
nnande Mar 9, 2020
9b792ab
Fixed specs
nnande Mar 9, 2020
f97ae6c
Use default Rails logger for logging
nnande Mar 10, 2020
7746407
Merge pull request #5 from spark-solutions/spree_4_1_0_rc3
damianlegawiec Mar 20, 2020
822e24a
Update README.md
damianlegawiec Mar 20, 2020
5829fac
Fixed 500 errors when tax_address isn't present
damianlegawiec Mar 20, 2020
d1624a7
Bump taxjar-ruby dependency to ~> 2.1.0
nnande Apr 15, 2020
924e2d8
Introduce taxjar_sandbox_environment_enabled spree preference
nnande Apr 15, 2020
663294e
Adjust Spree::Taxjar model to work on sandbox mode
nnande Apr 15, 2020
0042e61
Merge pull request #6 from spark-solutions/bumped_taxjar_ruby_to_2_1
damianlegawiec Apr 15, 2020
5cac670
Bumped taxjar-ruby
nnande Apr 20, 2020
40753d9
Merge pull request #7 from spark-solutions/bump_taxjar_ruby_gem
damianlegawiec Apr 20, 2020
f445385
Set default taxjar-ruby client timeout settings via spree initializer
nnande Apr 22, 2020
d3b5ba1
Update config/initializers/app_configuration.rb
nnande Apr 22, 2020
e251bb5
Merge pull request #8 from spark-solutions/feature/add_taxjar_client_…
damianlegawiec Apr 22, 2020
683aa4b
Spree::Taxjar -> format string form Date object properly before reque…
nnande Apr 29, 2020
dd7fefc
fixed spec
nnande Apr 29, 2020
65d21ee
Merge pull request #9 from spark-solutions/feature/fixed_list_refunds
damianlegawiec Apr 29, 2020
ebaa3ad
Spree::Taxjar#return_items_params - try to HTML sanitize return_items…
nnande May 19, 2020
f7f07af
Merge pull request #10 from spark-solutions/fixed/taxjar_rb
damianlegawiec May 19, 2020
24c97d6
Update taxjar-ruby requirement from ~> 2.6.0 to >= 2.6, < 3.1
dependabot-preview[bot] Feb 8, 2021
ffbe098
Merge pull request #14 from spree-contrib/dependabot/bundler/taxjar-r…
dependabot-preview[bot] Feb 8, 2021
61dd96f
Upgrade to GitHub-native Dependabot
dependabot-preview[bot] Apr 29, 2021
61923d6
Update to Spree 4
Jun 1, 2021
5e0b65d
Merge pull request #21 from spree-contrib/feature/spree-4-update
damianlegawiec Jun 1, 2021
f5c7fbd
Rename travis.yml to .travis.yml
damianlegawiec Jun 1, 2021
84cbe70
Merge pull request #19 from spree-contrib/dependabot/add-v2-config-file
damianlegawiec Jun 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
58 changes: 58 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
os: linux
dist: bionic

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

services:
- mysql
- postgresql

language: ruby

rvm:
- 2.7
- 3.0

env:
- DB=mysql
- DB=postgres

gemfile:
- gemfiles/spree_3_2.gemfile
- gemfiles/spree_3_3.gemfile
- gemfiles/spree_3_4.gemfile
- gemfiles/spree_3_7.gemfile
- gemfiles/spree_4.gemfile
- gemfiles/spree_master.gemfile

jobs:
allow_failures:
- gemfile: gemfiles/spree_master.gemfile
exclude:
- rvm: 3.0
gemfile: gemfiles/spree_3_2.gemfile
- rvm: 3.0
gemfile: gemfiles/spree_3_3.gemfile
- rvm: 3.0
gemfile: gemfiles/spree_3_4.gemfile
- rvm: 3.0
gemfile: gemfiles/spree_3_7.gemfile

before_install:
- mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"

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
24 changes: 24 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
appraise "spree-3-2" do
gem 'spree', '~> 3.2.0'
end

appraise "spree-3-3" do
gem 'spree', '~> 3.3.0'
end

appraise "spree-3-4" do
gem 'spree', '~> 3.4.0'
end

appraise "spree-3-7" do
gem 'spree', '~> 3.7.0'
end

appraise 'spree-4' do
gem 'spree', '~> 4.2'
gem 'rails-controller-testing'
end

appraise "spree-master" do
gem 'spree', github: 'spree/spree', branch: 'master'
end
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
source 'https://rubygems.org'

gem 'spree', github: 'spree/spree', branch: '3-2-stable'
# Provides basic authentication functionality for testing parts of your engine
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: 'master'

group :test do
gem 'rails-controller-testing'
gem 'byebug'
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ Spree::Taxjar is a sales tax extension for Spree using [SmartCalcs by TaxJar](ht

1. Add this extension to your Gemfile with this line:

```ruby
gem 'spree_taxjar', github: 'vinsol-spree-contrib/spree_taxjar', branch: <spree-version-compatible>
```

*The `branch` option is important:* it must match the version of Spree you're using. For example, use `3-1-stable` if you're using Spree `3-1-stable` or any `3.1.x` version.
```ruby
gem 'spree_taxjar', github: 'spree-contrib/spree_taxjar'
```

2. Install the gem using Bundler:

```ruby
bundle install
```
```ruby
bundle install
```

3. Copy & run migrations

```ruby
bundle exec rails g spree_taxjar:install
```
```ruby
bundle exec rails g spree_taxjar:install
```

4. Restart your server

Expand All @@ -42,6 +40,7 @@ Spree::Taxjar is a sales tax extension for Spree using [SmartCalcs by TaxJar](ht
- Check the `TAXJAR ENABLED` checkbox
- Optionally, check `TAXJAR DEBUG ENABLED` for debugging issues
- Not recommended for production use unless debugging production issues
- Update tax rates to Spree/Taxjar calculator.

## Developing / Debugging Extension

Expand Down Expand Up @@ -75,6 +74,11 @@ bundle
bundle exec rake
```

## See It In Action
<a href="http://www.youtube.com/watch?feature=player_embedded&v=xh__bVxTw3Q
" target="_blank"><img src="http://img.youtube.com/vi/xh__bVxTw3Q/0.jpg"
alt="Youtube Video Tutorial" /></a>

## Credits

[![vinsol.com: Ruby on Rails, iOS and Android developers](http://vinsol.com/vin_logo.png "Ruby on Rails, iOS and Android developers")](http://vinsol.com)
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/spree/admin/taxjar_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ module Spree
module Admin
class TaxjarSettingsController < Spree::Admin::BaseController
def edit
@preferences_api = [:taxjar_api_key, :taxjar_enabled, :taxjar_debug_enabled]
@preferences_api = %i[taxjar_api_key taxjar_enabled taxjar_debug_enabled taxjar_sandbox_environment_enabled]
end

def update
Spree::Config[:taxjar_api_key] = params[:taxjar_api_key]
Spree::Config[:taxjar_enabled] = params[:taxjar_enabled]
Spree::Config[:taxjar_debug_enabled] = params[:taxjar_debug_enabled]
Spree::Config[:taxjar_sandbox_environment_enabled] = params[:taxjar_sandbox_environment_enabled]

flash[:success] = Spree.t(:taxjar_settings_updated)
redirect_to edit_admin_taxjar_settings_path
Expand Down
11 changes: 3 additions & 8 deletions app/helpers/taxjar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,16 @@ def context
class TaxjarLog
attr_reader :logger

def initialize(path_name, file_name, log_info = nil, schedule = "weekly")
@logger ||= Logger.new("#{Rails.root}/log/#{path_name}.log", schedule)
def initialize(logdev)
@logger ||= Logger.new(logdev)
@logger.formatter = Pretty.new
progname(file_name.split("/").last.chomp(".rb"))
info(log_info) unless log_info.nil?
@logger.progname = 'spree_taxjar extension'
end

def logger_enabled?
Spree::Config[:taxjar_debug_enabled]
end

def progname(progname = nil)
progname.nil? ? logger.progname : logger.progname = progname
end

def info(log_info = nil)
if logger_enabled?
logger.info log_info unless log_info.nil?
Expand Down
12 changes: 12 additions & 0 deletions app/models/concerns/spree_taxjar/taxable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module SpreeTaxjar
module Taxable
extend ActiveSupport::Concern

private

def taxjar_applicable?(order)
::Spree::TaxRate.match(order.tax_zone).any? { |rate| rate.calculator_type == "Spree::Calculator::TaxjarCalculator" }
end
end
end

8 changes: 0 additions & 8 deletions app/models/concerns/taxable.rb

This file was deleted.

6 changes: 3 additions & 3 deletions app/models/spree/calculator/taxjar_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def cache_response(taxjar_response, order, address, item = nil)
## better to use Rails.cache.fetch for order and wrapping lookup based on line_item id
res = nil
taxjar_response.breakdown.line_items.each do |line_item|
item_from_db = Spree::LineItem.find_by(id: line_item.id)
item_from_db = Spree::LineItem.includes(:adjustments).find_by(id: line_item.id)
if item && item_from_db.id == item.id
res = line_item.tax_collectable
end
Expand All @@ -94,9 +94,9 @@ def cache_response(taxjar_response, order, address, item = nil)

def cache_key(order, item, address)
if item.is_a?(Spree::LineItem)
['Spree::LineItem', order.id, item.id, address.state.id, address.zipcode, item.amount, :amount_to_collect]
[Spree::LineItem.to_s, order.id, item.id, address.state_id, address.zipcode, item.taxable_amount, :amount_to_collect]
else
['Spree::Shipment', order.id, item.id, address.state.id, address.zipcode, item.cost, :amount_to_collect]
[Spree::Shipment.to_s, order.id, item.id, address.state_id, address.zipcode, item.cost, item.adjustments.select { |adjustment| adjustment.source_type != Spree::TaxRate.to_s }.map(&:amount).sum.to_f, :amount_to_collect]
end
end
end
Expand Down
23 changes: 0 additions & 23 deletions app/models/spree/order_decorator.rb

This file was deleted.

13 changes: 0 additions & 13 deletions app/models/spree/reimbursment_decorator.rb

This file was deleted.

Loading