-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v1.2' of github.com:boomerdigital/solidus_avatax_certif…
…ied into v1.2
- Loading branch information
Showing
17 changed files
with
180 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Spree::Admin::UsersController.class_eval do | ||
def avalara_information | ||
if request.put? | ||
if @user.update_attributes(user_params) | ||
flash.now[:success] = Spree.t(:account_updated) | ||
end | ||
end | ||
|
||
render :avalara_information | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Spree::Address.class_eval do | ||
def validation_enabled? | ||
Spree::AvalaraPreference.address_validation.is_true? && country_validation_enabled? | ||
end | ||
|
||
def country_validation_enabled? | ||
Spree::Address.validation_enabled_countries.include?(country.try(:name)) | ||
end | ||
|
||
def self.validation_enabled_countries | ||
Spree::AvalaraPreference.validation_enabled_countries_array | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
gem_version = File.read(File.expand_path('../../../GEM_VERSION',__FILE__)).strip | ||
solidus_version = File.read(File.expand_path('../../../SOLIDUS_VERSION',__FILE__)).strip | ||
|
||
AVATAX_CLIENT_VERSION = "SolidusV#{solidus_version}-ExtV#{gem_version}" | ||
AVATAX_CLIENT_VERSION = "a0o33000004FH8l" | ||
AVATAX_SERVICEPATH_ADDRESS = '/1.0/address/' | ||
AVATAX_SERVICEPATH_TAX = '/1.0/tax/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
resources :users do | ||
member do | ||
get :avalara_information | ||
put :avalara_information | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'spec_helper' | ||
|
||
describe Spree::Address, type: :model do | ||
let(:address) { create(:address) } | ||
|
||
describe '#validation_enabled?' do | ||
it 'returns true if preference is true and country validation is enabled' do | ||
Spree::AvalaraPreference.address_validation.update_attributes(value: 'true') | ||
Spree::AvalaraPreference.validation_enabled_countries.update_attributes(value: 'United States,Canada') | ||
|
||
expect(address.validation_enabled?).to be_truthy | ||
end | ||
|
||
it 'returns false if address validation preference is false' do | ||
Spree::AvalaraPreference.address_validation.update_attributes(value: 'false') | ||
|
||
expect(address.validation_enabled?).to be_falsey | ||
end | ||
|
||
it 'returns false if enabled country is not present' do | ||
Spree::AvalaraPreference.validation_enabled_countries.update_attributes(value: 'Canada') | ||
|
||
expect(address.validation_enabled?).to be_falsey | ||
end | ||
end | ||
|
||
describe '#country_validation_enabled?' do | ||
it 'returns true if the current country is enabled' do | ||
expect(address.country_validation_enabled?).to be_truthy | ||
end | ||
end | ||
|
||
describe '#validation_enabled_countries' do | ||
it 'returns an array' do | ||
expect(Spree::Address.validation_enabled_countries).to be_kind_of(Array) | ||
end | ||
|
||
it 'includes United States' do | ||
Spree::AvalaraPreference.validation_enabled_countries.update_attributes(value: 'United States,Canada') | ||
|
||
expect(Spree::Address.validation_enabled_countries).to include('United States') | ||
end | ||
end | ||
end |
Oops, something went wrong.