spree_avatax_official 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env-sample +4 -0
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/.rubocop.yml +77 -0
- data/.travis.yml +78 -0
- data/Appraisals +49 -0
- data/Gemfile +16 -0
- data/LICENSE +26 -0
- data/README.md +173 -0
- data/Rakefile +21 -0
- data/app/controllers/spree/admin/avalara_entity_use_codes_controller.rb +61 -0
- data/app/controllers/spree/admin/avatax_pings_controller.rb +19 -0
- data/app/controllers/spree/admin/avatax_settings_controller.rb +26 -0
- data/app/controllers/spree/admin/users_controller_decorator.rb +27 -0
- data/app/helpers/spree_avatax_official/http_helper.rb +17 -0
- data/app/helpers/spree_avatax_official/tax_adjustment_label_helper.rb +30 -0
- data/app/models/avatax/request_decorator.rb +34 -0
- data/app/models/spree_avatax_official/avatax_log.rb +57 -0
- data/app/models/spree_avatax_official/calculator/avatax_transaction_calculator.rb +28 -0
- data/app/models/spree_avatax_official/configuration.rb +20 -0
- data/app/models/spree_avatax_official/entity_use_code.rb +7 -0
- data/app/models/spree_avatax_official/has_uuid.rb +22 -0
- data/app/models/spree_avatax_official/spree/address_decorator.rb +31 -0
- data/app/models/spree_avatax_official/spree/inventory_unit_decorator.rb +11 -0
- data/app/models/spree_avatax_official/spree/line_item_decorator.rb +27 -0
- data/app/models/spree_avatax_official/spree/order_decorator.rb +91 -0
- data/app/models/spree_avatax_official/spree/refund_decorator.rb +22 -0
- data/app/models/spree_avatax_official/spree/shipment_decorator.rb +25 -0
- data/app/models/spree_avatax_official/spree/tax_category_decorator.rb +14 -0
- data/app/models/spree_avatax_official/spree/user_decorator.rb +11 -0
- data/app/models/spree_avatax_official/transaction.rb +27 -0
- data/app/overrides/spree/admin/shared/sub_menu/_configuration.rb +10 -0
- data/app/overrides/spree/admin/sidebar.rb +14 -0
- data/app/presenters/spree_avatax_official/address_presenter.rb +40 -0
- data/app/presenters/spree_avatax_official/item_presenter.rb +92 -0
- data/app/presenters/spree_avatax_official/ship_to_address_presenter.rb +22 -0
- data/app/presenters/spree_avatax_official/transactions/adjust_presenter.rb +31 -0
- data/app/presenters/spree_avatax_official/transactions/create_presenter.rb +80 -0
- data/app/presenters/spree_avatax_official/transactions/full_refund_presenter.rb +32 -0
- data/app/presenters/spree_avatax_official/transactions/partial_refund_presenter.rb +46 -0
- data/app/services/spree_avatax_official/address/validate.rb +27 -0
- data/app/services/spree_avatax_official/base.rb +71 -0
- data/app/services/spree_avatax_official/create_tax_adjustments_service.rb +133 -0
- data/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb +94 -0
- data/app/services/spree_avatax_official/get_tax_service.rb +20 -0
- data/app/services/spree_avatax_official/settings/update_service.rb +36 -0
- data/app/services/spree_avatax_official/transactions/adjust_service.rb +36 -0
- data/app/services/spree_avatax_official/transactions/create_service.rb +47 -0
- data/app/services/spree_avatax_official/transactions/find_order_transaction_service.rb +23 -0
- data/app/services/spree_avatax_official/transactions/full_refund_service.rb +36 -0
- data/app/services/spree_avatax_official/transactions/get_by_code_service.rb +32 -0
- data/app/services/spree_avatax_official/transactions/partial_refund_service.rb +33 -0
- data/app/services/spree_avatax_official/transactions/refund_service.rb +87 -0
- data/app/services/spree_avatax_official/transactions/void_service.rb +28 -0
- data/app/services/spree_avatax_official/utilities/ping_service.rb +9 -0
- data/app/views/spree/admin/avalara_entity_use_codes/_form.html.erb +20 -0
- data/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb +12 -0
- data/app/views/spree/admin/avalara_entity_use_codes/index.html.erb +35 -0
- data/app/views/spree/admin/avalara_entity_use_codes/new.html.erb +12 -0
- data/app/views/spree/admin/avatax_settings/edit.html.erb +99 -0
- data/app/views/spree/admin/users/avalara_information.html.erb +39 -0
- data/app/views/spree/admin/zones/_form.html.erb +58 -0
- data/bin/rails +8 -0
- data/config/initializers/spree_permitted_attributes.rb +5 -0
- data/config/locales/en.yml +40 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20190118155953_add_exemption_number_to_spree_users.rb +7 -0
- data/db/migrate/20190118160653_create_spree_avalara_entity_use_codes.rb +11 -0
- data/db/migrate/20190118161318_add_avalara_entity_use_code_reference_to_users.rb +7 -0
- data/db/migrate/20190118162345_add_vat_id_to_spree_users.rb +7 -0
- data/db/migrate/20190122154119_create_spree_avatax_official_transactions.rb +10 -0
- data/db/migrate/20190201123706_add_tax_code_to_spree_tax_categories.rb +7 -0
- data/db/migrate/20190208130136_add_avatax_company_code_to_spree_stores.rb +8 -0
- data/db/migrate/20190225145808_add_uuid_to_spree_line_items_and_spree_shipments.rb +13 -0
- data/db/migrate/20190329071439_add_included_in_price_to_spree_zones.rb +5 -0
- data/db/migrate/20191001085458_remove_spree_avalara_entity_use_codes_table.rb +12 -0
- data/db/migrate/20191001092353_create_spree_avatax_official_entity_use_codes_table.rb +18 -0
- data/db/seeds.rb +1 -0
- data/gemfiles/spree_3_1.gemfile +16 -0
- data/gemfiles/spree_3_7.gemfile +13 -0
- data/gemfiles/spree_4_0.gemfile +14 -0
- data/gemfiles/spree_4_1.gemfile +14 -0
- data/gemfiles/spree_4_2.gemfile +14 -0
- data/gemfiles/spree_master.gemfile +14 -0
- data/lib/generators/spree_avatax_official/install/install_generator.rb +38 -0
- data/lib/generators/spree_avatax_official/install/templates/config/initializers/spree_avatax_official.rb +9 -0
- data/lib/spree_avatax_official.rb +5 -0
- data/lib/spree_avatax_official/engine.rb +32 -0
- data/lib/spree_avatax_official/factories.rb +9 -0
- data/lib/spree_avatax_official/seeder.rb +51 -0
- data/lib/spree_avatax_official/version.rb +11 -0
- data/lib/tasks/load_seeds.rake +6 -0
- data/spec/.rubocop.yml +36 -0
- data/spec/factories/canada_address_factory.rb +23 -0
- data/spec/factories/europe_address_factory.rb +22 -0
- data/spec/factories/spree/avatax_global_zone_factory.rb +16 -0
- data/spec/factories/spree/avatax_order_factory.rb +69 -0
- data/spec/factories/spree/avatax_shipment_factory.rb +31 -0
- data/spec/factories/spree/avatax_shipping_method_factory.rb +35 -0
- data/spec/factories/spree/avatax_tax_category_factory.rb +17 -0
- data/spec/factories/spree/avatax_tax_rate_factory.rb +23 -0
- data/spec/factories/spree/line_item_factory.rb +13 -0
- data/spec/factories/spree/promotion_factory.rb +35 -0
- data/spec/factories/spree/shipping_calculator_factory.rb +10 -0
- data/spec/factories/spree_avatax_official/avalara_entity_use_code_factory.rb +7 -0
- data/spec/factories/spree_avatax_official/calculator/avatax_transaction_calculator_factory.rb +3 -0
- data/spec/factories/spree_avatax_official/transaction_factory.rb +12 -0
- data/spec/factories/usa_address_factory.rb +34 -0
- data/spec/features/admin/edit_avatax_settings_spec.rb +11 -0
- data/spec/features/admin/update_avatax_settings_spec.rb +200 -0
- data/spec/features/spree/admin/avalara_entity_use_codes_controller_spec.rb +71 -0
- data/spec/features/spree/admin/users_controller_spec.rb +34 -0
- data/spec/helpers/spree_avatax_official/tax_adjustment_label_helper_spec.rb +81 -0
- data/spec/lib/spree_avatax_official/seeder_spec.rb +23 -0
- data/spec/models/spree/line_item_spec.rb +76 -0
- data/spec/models/spree/order_spec.rb +210 -0
- data/spec/models/spree/shipment_spec.rb +11 -0
- data/spec/models/spree_avatax_official/avatax_log_spec.rb +87 -0
- data/spec/models/spree_avatax_official/entity_use_code_spec.rb +9 -0
- data/spec/models/spree_avatax_official/has_uuid_spec.rb +21 -0
- data/spec/models/spree_avatax_official/spree/refund_decorator_spec.rb +31 -0
- data/spec/models/spree_avatax_official/transaction_spec.rb +9 -0
- data/spec/presenters/spree_avatax_official/address_presenter_spec.rb +53 -0
- data/spec/presenters/spree_avatax_official/item_presenter_spec.rb +159 -0
- data/spec/presenters/spree_avatax_official/ship_to_address_presenter_spec.rb +34 -0
- data/spec/presenters/spree_avatax_official/transactions/adjust_presenter_spec.rb +39 -0
- data/spec/presenters/spree_avatax_official/transactions/create_presenter_spec.rb +110 -0
- data/spec/presenters/spree_avatax_official/transactions/full_refund_presenter_spec.rb +30 -0
- data/spec/presenters/spree_avatax_official/transactions/partial_refund_presenter_spec.rb +48 -0
- data/spec/services/spree_avatax_official/address/validate_spec.rb +47 -0
- data/spec/services/spree_avatax_official/create_tax_adjustments_service_spec.rb +444 -0
- data/spec/services/spree_avatax_official/generate_transaction_cache_key_service_spec.rb +29 -0
- data/spec/services/spree_avatax_official/get_tax_service_spec.rb +33 -0
- data/spec/services/spree_avatax_official/settings/update_service_spec.rb +131 -0
- data/spec/services/spree_avatax_official/transactions/adjust_service_spec.rb +55 -0
- data/spec/services/spree_avatax_official/transactions/create_service_spec.rb +262 -0
- data/spec/services/spree_avatax_official/transactions/find_order_transaction_service_spec.rb +38 -0
- data/spec/services/spree_avatax_official/transactions/full_refund_service_spec.rb +24 -0
- data/spec/services/spree_avatax_official/transactions/get_by_code_service_spec.rb +74 -0
- data/spec/services/spree_avatax_official/transactions/partial_refund_service_spec.rb +33 -0
- data/spec/services/spree_avatax_official/transactions/refund_service_spec.rb +65 -0
- data/spec/services/spree_avatax_official/transactions/void_service_spec.rb +33 -0
- data/spec/services/spree_avatax_official/utilities/ping_service_spec.rb +35 -0
- data/spec/spec_helper.rb +104 -0
- data/spec/support/avatax.rb +15 -0
- data/spec/support/capybara.rb +21 -0
- data/spec/support/database_cleaner.rb +25 -0
- data/spec/support/factory_bot.rb +9 -0
- data/spec/support/vcr.rb +17 -0
- data/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 +44 -0
- data/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 +48 -0
- data/spec/vcr/spree_avatax_official/address/validate_failure.yml +46 -0
- data/spec/vcr/spree_avatax_official/address/validate_success.yml +43 -0
- data/spec/vcr/spree_avatax_official/address/zipcode_failure.yml +45 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/californian_stock_location.yml +60 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/completed_order_line_item_update.yml +62 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/order_adjustment_promotion.yml +61 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/shipment_adjustment_promotion.yml +60 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/simple_completed_order.yml +60 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/line_item_adjustment_promotion.yml +59 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/line_item_and_shipment.yml +60 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/multiple_line_items_multiple_quantity.yml +59 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/single_line_item.yml +55 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/line_item_adjustment_promotion.yml +59 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/line_item_and_shipment.yml +60 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/multiple_line_items_multiple_quantity.yml +59 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/single_line_item.yml +55 -0
- data/spec/vcr/spree_avatax_official/create_tax_adjustments/with_incorrect_address.yml +97 -0
- data/spec/vcr/spree_avatax_official/get_tax/error.yml +49 -0
- data/spec/vcr/spree_avatax_official/get_tax/sucsess.yml +55 -0
- data/spec/vcr/spree_avatax_official/transactions/adjust/failure.yml +101 -0
- data/spec/vcr/spree_avatax_official/transactions/adjust/invoice_order_success.yml +117 -0
- data/spec/vcr/spree_avatax_official/transactions/create/complete_order_success.yml +60 -0
- data/spec/vcr/spree_avatax_official/transactions/create/gst/canada_to_canada.yml +55 -0
- data/spec/vcr/spree_avatax_official/transactions/create/gst/canada_to_us.yml +57 -0
- data/spec/vcr/spree_avatax_official/transactions/create/gst/us_to_canada.yml +56 -0
- data/spec/vcr/spree_avatax_official/transactions/create/invoice_order_success.yml +60 -0
- data/spec/vcr/spree_avatax_official/transactions/create/sales_order_success.yml +60 -0
- data/spec/vcr/spree_avatax_official/transactions/create/timeout.yml +54 -0
- data/spec/vcr/spree_avatax_official/transactions/create/vat/europe_to_europe.yml +57 -0
- data/spec/vcr/spree_avatax_official/transactions/create/vat/europe_to_us.yml +57 -0
- data/spec/vcr/spree_avatax_official/transactions/create/vat/us_to_europe.yml +58 -0
- data/spec/vcr/spree_avatax_official/transactions/get_by_code/error.yml +44 -0
- data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_custom_code_success.yml +49 -0
- data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_number_success.yml +49 -0
- data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_type_success.yml +48 -0
- data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_without_type_success.yml +48 -0
- data/spec/vcr/spree_avatax_official/transactions/refund/full_refund_success.yml +114 -0
- data/spec/vcr/spree_avatax_official/transactions/refund/partial_refund_success.yml +58 -0
- data/spec/vcr/spree_avatax_official/transactions/refund/partial_refund_with_refund_success.yml +58 -0
- data/spec/vcr/spree_avatax_official/transactions/void/success.yml +112 -0
- data/spec/vcr/spree_avatax_official/utilities/ping.yml +41 -0
- data/spec/vcr/spree_avatax_official/utilities/ping_unauthorized.yml +42 -0
- data/spec/vcr/spree_line_item/update_tax_charge/decrease_quantity.yml +55 -0
- data/spec/vcr/spree_line_item/update_tax_charge/increase_quantity.yml +55 -0
- data/spec/vcr/spree_order/california_order.yml +67 -0
- data/spec/vcr/spree_order/complete_order.yml +60 -0
- data/spec/vcr/spree_order/order_transition_to_completed.yml +112 -0
- data/spec/vcr/spree_order/order_with_line_item_adjustment.yml +57 -0
- data/spec/vcr/spree_order/order_with_order_adjustment.yml +57 -0
- data/spec/vcr/spree_order/simple_order_with_single_line_item.yml +55 -0
- data/spec/vcr/spree_order/simple_order_with_single_line_item_and_shipment.yml +57 -0
- data/spec/vcr/spree_order/update_tax_charge/create_line_item.yml +55 -0
- data/spree_avatax_official.gemspec +43 -0
- metadata +486 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= link_to @user.email, spree.edit_admin_user_url(@user) %> /
|
3
|
+
<%= Spree.t('avalara_entity_use_codes') %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= render partial: 'spree/admin/users/sidebar', locals: { current: :avalara_informtion } %>
|
7
|
+
|
8
|
+
<fieldset data-hook="admin_user_edit_general_settings" class="alpha twelve columns">
|
9
|
+
<div data-hook="admin_user_edit_form_header">
|
10
|
+
<%= render partial: 'spree/shared/error_messages', locals: { target: @user } %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div data-hook="admin_user_edit_form">
|
14
|
+
<%= form_for [:admin, @user], method: :put do |f| %>
|
15
|
+
<div class="form-group">
|
16
|
+
<%= label_tag :avatax_entity_use_code_id, Spree.t(:avalara_entity_use_code) %><br />
|
17
|
+
<%= f.select(:avatax_entity_use_code_id, @use_codes, { include_blank: true }, class: 'form-control' ) %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="form-group">
|
21
|
+
<%= f.label :exemption_number, Spree.t(:exemption_number) %>
|
22
|
+
<%= f.text_field :exemption_number, class: 'form-control' %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="form-group">
|
26
|
+
<%= f.label :vat_id, Spree.t(:vat_identification_number) %>
|
27
|
+
<%= f.text_field :vat_id, class: 'form-control' %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="form-group">
|
31
|
+
<% if can?(:update, @user) %>
|
32
|
+
<div data-hook="admin_user_edit_form_button">
|
33
|
+
<%= render partial: 'spree/admin/shared/edit_resource_links', locals: { collection_url: admin_users_url } %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
39
|
+
</fieldset>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-12 col-lg-6" data-hook="admin_zone_form_fields">
|
3
|
+
<div class="card mb-3">
|
4
|
+
<div class="card-header">
|
5
|
+
<h1 class="card-title mb-0 h5"><%= Spree.t(:general_settings)%></h1>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="card-body">
|
9
|
+
<%= zone_form.field_container :name, class: ['form-group'] do %>
|
10
|
+
<%= zone_form.label :name, Spree.t(:name) %>
|
11
|
+
<%= zone_form.text_field :name, class: 'form-control' %>
|
12
|
+
<%= zone_form.error_message_on :name %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= zone_form.field_container :description, class: ['form-group'] do %>
|
16
|
+
<%= zone_form.label :description, Spree.t(:description) %>
|
17
|
+
<%= zone_form.text_field :description, class: 'form-control' %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<div data-hook="default" class="form-group checkbox">
|
21
|
+
<%= label_tag "zone[#{:default_tax}" do %>
|
22
|
+
<%= zone_form.check_box :default_tax %>
|
23
|
+
<%= Spree.t(:default_tax_zone) %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<% if Spree::Zone.method_defined?(:included_in_price) %>
|
28
|
+
<div data-hook="default" class="form-group checkbox">
|
29
|
+
<%= label_tag "zone[#{:included_in_price}" do %>
|
30
|
+
<%= zone_form.check_box :included_in_price %>
|
31
|
+
<%= Spree.t(:included_in_price) %>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<div data-hook="type" class="form-group">
|
37
|
+
<strong><%= Spree.t(:type) %></strong>
|
38
|
+
<div class="radio my-2">
|
39
|
+
<%= label_tag :country_based do %>
|
40
|
+
<%= zone_form.radio_button('kind', 'country', { id: 'country_based' }) %>
|
41
|
+
<%= Spree.t(:country_based) %>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
<div class="radio my-2">
|
45
|
+
<%= label_tag :state_based do %>
|
46
|
+
<%= zone_form.radio_button('kind', 'state', { id: 'state_based' }) %>
|
47
|
+
<%= Spree.t(:state_based) %>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
<div class="col-12 col-lg-6">
|
55
|
+
<%= render partial: 'state_members', locals: { zone_form: zone_form }%>
|
56
|
+
<%= render partial: 'country_members', locals: { zone_form: zone_form } %>
|
57
|
+
</div>
|
58
|
+
</div>
|
data/bin/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" from the root of your extension
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
5
|
+
ENGINE_PATH = File.expand_path('../lib/spree_avatax_official/engine', __dir__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
spree:
|
6
|
+
spree_avatax_official:
|
7
|
+
void_service:
|
8
|
+
missing_sales_invoice_transaction: Order is missing SalesInvoice transaction
|
9
|
+
get_by_code_service:
|
10
|
+
missing_code: Transaction code for these params is missing
|
11
|
+
create_tax_adjustments:
|
12
|
+
adjustment_description: Completed order contents were changed
|
13
|
+
order_canceled: Cannot calculate tax for a canceled order
|
14
|
+
tax_calculation_unnecessary: Order is missing tax address or line items
|
15
|
+
tax_calculation_failed: AvaTax failed to calculate tax
|
16
|
+
line_item_tax_adjustment_default_label: Sales %{included_label}Tax
|
17
|
+
shipment_tax_adjustment_default_label: Shipping %{included_label}Tax
|
18
|
+
avatax_credentials: Avatax Credentials
|
19
|
+
company_code: Company code
|
20
|
+
account_number: Account number
|
21
|
+
license_key: License key
|
22
|
+
endpoint_urls: Avatax Endpoint urls
|
23
|
+
endpoint: Endpoint
|
24
|
+
settings: Avatax Settings
|
25
|
+
ship_from_address: Ship from address
|
26
|
+
address_validation: Address validation
|
27
|
+
enable_address_validation: Enable address validation
|
28
|
+
settings_updated: Updated AvaTax configuration
|
29
|
+
save_preferences: Save AvaTax preferences
|
30
|
+
commit_transaction_enabled: Enable commiting transactions
|
31
|
+
connected_successful: Connected successfully
|
32
|
+
unauthorized: Connected but unauthorized
|
33
|
+
connection_rejected: Avatax rejected connection
|
34
|
+
entity_use_code_created: Entity use code created
|
35
|
+
entity_use_code_updated: Entity use code updated
|
36
|
+
entity_use_code_removed: Entity use code removed
|
37
|
+
information_url: Avalara Information
|
38
|
+
avalara_entity_use_code: Avalara Entity Use Code
|
39
|
+
ping_avatax: Ping AvaTax
|
40
|
+
wrong_endpoint_url: Endpoint URL seems to be invalid
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Spree::Core::Engine.add_routes do
|
2
|
+
namespace :admin do
|
3
|
+
resource :avatax_settings, only: %i[edit update]
|
4
|
+
resource :avatax_ping, only: :create
|
5
|
+
|
6
|
+
resources :users do
|
7
|
+
member do
|
8
|
+
get :avalara_information
|
9
|
+
put :avalara_information
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
resources :avalara_entity_use_codes, except: :show
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateSpreeAvalaraEntityUseCodes < SpreeExtension::Migration[4.2]
|
2
|
+
def change
|
3
|
+
return if table_exists?(:spree_avalara_entity_use_codes)
|
4
|
+
|
5
|
+
create_table :spree_avalara_entity_use_codes do |t|
|
6
|
+
t.string :use_code
|
7
|
+
t.string :use_code_description
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateSpreeAvataxOfficialTransactions < SpreeExtension::Migration[4.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_avatax_official_transactions do |t|
|
4
|
+
t.references :order, null: false, index: true
|
5
|
+
t.string :transaction_type, null: false, index: true
|
6
|
+
t.string :code, null: false, index: { unique: true }
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddUuidToSpreeLineItemsAndSpreeShipments < SpreeExtension::Migration[4.2]
|
2
|
+
def change
|
3
|
+
unless column_exists?(:spree_line_items, :avatax_uuid)
|
4
|
+
add_column :spree_line_items, :avatax_uuid, :string
|
5
|
+
add_index :spree_line_items, :avatax_uuid, unique: true
|
6
|
+
end
|
7
|
+
|
8
|
+
return if column_exists?(:spree_shipments, :avatax_uuid)
|
9
|
+
|
10
|
+
add_column :spree_shipments, :avatax_uuid, :string
|
11
|
+
add_index :spree_shipments, :avatax_uuid, unique: true
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RemoveSpreeAvalaraEntityUseCodesTable < SpreeExtension::Migration[4.2]
|
2
|
+
def change
|
3
|
+
return unless table_exists?(:spree_avalara_entity_use_codes)
|
4
|
+
|
5
|
+
drop_table :spree_avalara_entity_use_codes do |t|
|
6
|
+
t.string :use_code, index: true
|
7
|
+
t.string :use_code_description
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateSpreeAvataxOfficialEntityUseCodesTable < SpreeExtension::Migration[4.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_avatax_official_entity_use_codes do |t|
|
4
|
+
t.string :code, index: true, required: true, unique: true
|
5
|
+
t.string :name, index: true, required: true, unique: true
|
6
|
+
|
7
|
+
t.text :description
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
return if column_exists?(:spree_users, :avatax_entity_use_code_id)
|
13
|
+
|
14
|
+
change_table :spree_users do |t|
|
15
|
+
t.integer :avatax_entity_use_code_id, index: { unique: true }, foreign_key: true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SpreeAvataxOfficial::Seeder.new.seed!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", "~> 3.3"
|
9
|
+
gem "spree_backend", "~> 3.1.0"
|
10
|
+
gem "spree_core", "~> 3.1.0"
|
11
|
+
gem "sass-rails"
|
12
|
+
gem "pg", "~> 0.18"
|
13
|
+
gem "factory_girl"
|
14
|
+
gem "rails_test_params_backport"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", "~> 3.5"
|
9
|
+
gem "spree_backend", "~> 3.7.0"
|
10
|
+
gem "spree_core", "~> 3.7.0"
|
11
|
+
gem "sass-rails"
|
12
|
+
|
13
|
+
gemspec path: "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", "~> 4.0.0.rc2"
|
9
|
+
gem "spree_backend", "~> 4.0.0"
|
10
|
+
gem "spree_core", "~> 4.0.0.rc1"
|
11
|
+
gem "sass-rails"
|
12
|
+
gem "rspec-rails", "~> 4.0.0.beta2"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", "~> 4.1.0"
|
9
|
+
gem "spree_backend", "~> 4.1.0"
|
10
|
+
gem "spree_core", "~> 4.1.0"
|
11
|
+
gem "sass-rails"
|
12
|
+
gem "rspec-rails", "~> 4.0.0.beta2"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", "~> 4.2.0"
|
9
|
+
gem "spree_backend", "~> 4.2.0.beta"
|
10
|
+
gem "spree_core", "~> 4.2.0.beta"
|
11
|
+
gem "sass-rails"
|
12
|
+
gem "rspec-rails", "~> 4.0.0.beta2"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rails-controller-testing"
|
6
|
+
gem "rubocop", "~> 0.63.0", require: false
|
7
|
+
gem "rubocop-rspec", require: false
|
8
|
+
gem "spree_auth_devise", branch: "master", git: "https://github.com/spree/spree_auth_devise.git"
|
9
|
+
gem "spree_backend", branch: "master", git: "https://github.com/spree/spree.git"
|
10
|
+
gem "spree_core", branch: "master", git: "https://github.com/spree/spree.git"
|
11
|
+
gem "sass-rails"
|
12
|
+
gem "rspec-rails", "~> 4.0.0.beta2"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SpreeAvataxOfficial
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
class_option :run_migrations, type: :boolean, default: true
|
5
|
+
class_option :run_seeds, type: :boolean, default: true
|
6
|
+
|
7
|
+
def self.source_paths
|
8
|
+
paths = superclass.source_paths
|
9
|
+
paths << File.expand_path('templates', __dir__)
|
10
|
+
paths.flatten
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_migrations
|
14
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_avatax_official'
|
15
|
+
end
|
16
|
+
|
17
|
+
def run_migrations
|
18
|
+
if options[:run_migrations]
|
19
|
+
run 'bundle exec rake db:migrate'
|
20
|
+
else
|
21
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_seeds
|
26
|
+
if options[:run_seeds]
|
27
|
+
run 'bundle exec rake spree_avatax_official:load_seeds'
|
28
|
+
else
|
29
|
+
puts 'Skipping seeds, you can run them through bundle exec rake spree_avatax_official:load_seeds'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def copy_initializer
|
34
|
+
template 'config/initializers/spree_avatax_official.rb', 'config/initializers/spree_avatax_official.rb'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|