spree_avatax_official 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/.env-sample +4 -0
  3. data/.gitignore +22 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +77 -0
  6. data/.travis.yml +78 -0
  7. data/Appraisals +49 -0
  8. data/Gemfile +16 -0
  9. data/LICENSE +26 -0
  10. data/README.md +173 -0
  11. data/Rakefile +21 -0
  12. data/app/controllers/spree/admin/avalara_entity_use_codes_controller.rb +61 -0
  13. data/app/controllers/spree/admin/avatax_pings_controller.rb +19 -0
  14. data/app/controllers/spree/admin/avatax_settings_controller.rb +26 -0
  15. data/app/controllers/spree/admin/users_controller_decorator.rb +27 -0
  16. data/app/helpers/spree_avatax_official/http_helper.rb +17 -0
  17. data/app/helpers/spree_avatax_official/tax_adjustment_label_helper.rb +30 -0
  18. data/app/models/avatax/request_decorator.rb +34 -0
  19. data/app/models/spree_avatax_official/avatax_log.rb +57 -0
  20. data/app/models/spree_avatax_official/calculator/avatax_transaction_calculator.rb +28 -0
  21. data/app/models/spree_avatax_official/configuration.rb +20 -0
  22. data/app/models/spree_avatax_official/entity_use_code.rb +7 -0
  23. data/app/models/spree_avatax_official/has_uuid.rb +22 -0
  24. data/app/models/spree_avatax_official/spree/address_decorator.rb +31 -0
  25. data/app/models/spree_avatax_official/spree/inventory_unit_decorator.rb +11 -0
  26. data/app/models/spree_avatax_official/spree/line_item_decorator.rb +27 -0
  27. data/app/models/spree_avatax_official/spree/order_decorator.rb +91 -0
  28. data/app/models/spree_avatax_official/spree/refund_decorator.rb +22 -0
  29. data/app/models/spree_avatax_official/spree/shipment_decorator.rb +25 -0
  30. data/app/models/spree_avatax_official/spree/tax_category_decorator.rb +14 -0
  31. data/app/models/spree_avatax_official/spree/user_decorator.rb +11 -0
  32. data/app/models/spree_avatax_official/transaction.rb +27 -0
  33. data/app/overrides/spree/admin/shared/sub_menu/_configuration.rb +10 -0
  34. data/app/overrides/spree/admin/sidebar.rb +14 -0
  35. data/app/presenters/spree_avatax_official/address_presenter.rb +40 -0
  36. data/app/presenters/spree_avatax_official/item_presenter.rb +92 -0
  37. data/app/presenters/spree_avatax_official/ship_to_address_presenter.rb +22 -0
  38. data/app/presenters/spree_avatax_official/transactions/adjust_presenter.rb +31 -0
  39. data/app/presenters/spree_avatax_official/transactions/create_presenter.rb +80 -0
  40. data/app/presenters/spree_avatax_official/transactions/full_refund_presenter.rb +32 -0
  41. data/app/presenters/spree_avatax_official/transactions/partial_refund_presenter.rb +46 -0
  42. data/app/services/spree_avatax_official/address/validate.rb +27 -0
  43. data/app/services/spree_avatax_official/base.rb +71 -0
  44. data/app/services/spree_avatax_official/create_tax_adjustments_service.rb +133 -0
  45. data/app/services/spree_avatax_official/generate_transaction_cache_key_service.rb +94 -0
  46. data/app/services/spree_avatax_official/get_tax_service.rb +20 -0
  47. data/app/services/spree_avatax_official/settings/update_service.rb +36 -0
  48. data/app/services/spree_avatax_official/transactions/adjust_service.rb +36 -0
  49. data/app/services/spree_avatax_official/transactions/create_service.rb +47 -0
  50. data/app/services/spree_avatax_official/transactions/find_order_transaction_service.rb +23 -0
  51. data/app/services/spree_avatax_official/transactions/full_refund_service.rb +36 -0
  52. data/app/services/spree_avatax_official/transactions/get_by_code_service.rb +32 -0
  53. data/app/services/spree_avatax_official/transactions/partial_refund_service.rb +33 -0
  54. data/app/services/spree_avatax_official/transactions/refund_service.rb +87 -0
  55. data/app/services/spree_avatax_official/transactions/void_service.rb +28 -0
  56. data/app/services/spree_avatax_official/utilities/ping_service.rb +9 -0
  57. data/app/views/spree/admin/avalara_entity_use_codes/_form.html.erb +20 -0
  58. data/app/views/spree/admin/avalara_entity_use_codes/edit.html.erb +12 -0
  59. data/app/views/spree/admin/avalara_entity_use_codes/index.html.erb +35 -0
  60. data/app/views/spree/admin/avalara_entity_use_codes/new.html.erb +12 -0
  61. data/app/views/spree/admin/avatax_settings/edit.html.erb +99 -0
  62. data/app/views/spree/admin/users/avalara_information.html.erb +39 -0
  63. data/app/views/spree/admin/zones/_form.html.erb +58 -0
  64. data/bin/rails +8 -0
  65. data/config/initializers/spree_permitted_attributes.rb +5 -0
  66. data/config/locales/en.yml +40 -0
  67. data/config/routes.rb +15 -0
  68. data/db/migrate/20190118155953_add_exemption_number_to_spree_users.rb +7 -0
  69. data/db/migrate/20190118160653_create_spree_avalara_entity_use_codes.rb +11 -0
  70. data/db/migrate/20190118161318_add_avalara_entity_use_code_reference_to_users.rb +7 -0
  71. data/db/migrate/20190118162345_add_vat_id_to_spree_users.rb +7 -0
  72. data/db/migrate/20190122154119_create_spree_avatax_official_transactions.rb +10 -0
  73. data/db/migrate/20190201123706_add_tax_code_to_spree_tax_categories.rb +7 -0
  74. data/db/migrate/20190208130136_add_avatax_company_code_to_spree_stores.rb +8 -0
  75. data/db/migrate/20190225145808_add_uuid_to_spree_line_items_and_spree_shipments.rb +13 -0
  76. data/db/migrate/20190329071439_add_included_in_price_to_spree_zones.rb +5 -0
  77. data/db/migrate/20191001085458_remove_spree_avalara_entity_use_codes_table.rb +12 -0
  78. data/db/migrate/20191001092353_create_spree_avatax_official_entity_use_codes_table.rb +18 -0
  79. data/db/seeds.rb +1 -0
  80. data/gemfiles/spree_3_1.gemfile +16 -0
  81. data/gemfiles/spree_3_7.gemfile +13 -0
  82. data/gemfiles/spree_4_0.gemfile +14 -0
  83. data/gemfiles/spree_4_1.gemfile +14 -0
  84. data/gemfiles/spree_4_2.gemfile +14 -0
  85. data/gemfiles/spree_master.gemfile +14 -0
  86. data/lib/generators/spree_avatax_official/install/install_generator.rb +38 -0
  87. data/lib/generators/spree_avatax_official/install/templates/config/initializers/spree_avatax_official.rb +9 -0
  88. data/lib/spree_avatax_official.rb +5 -0
  89. data/lib/spree_avatax_official/engine.rb +32 -0
  90. data/lib/spree_avatax_official/factories.rb +9 -0
  91. data/lib/spree_avatax_official/seeder.rb +51 -0
  92. data/lib/spree_avatax_official/version.rb +11 -0
  93. data/lib/tasks/load_seeds.rake +6 -0
  94. data/spec/.rubocop.yml +36 -0
  95. data/spec/factories/canada_address_factory.rb +23 -0
  96. data/spec/factories/europe_address_factory.rb +22 -0
  97. data/spec/factories/spree/avatax_global_zone_factory.rb +16 -0
  98. data/spec/factories/spree/avatax_order_factory.rb +69 -0
  99. data/spec/factories/spree/avatax_shipment_factory.rb +31 -0
  100. data/spec/factories/spree/avatax_shipping_method_factory.rb +35 -0
  101. data/spec/factories/spree/avatax_tax_category_factory.rb +17 -0
  102. data/spec/factories/spree/avatax_tax_rate_factory.rb +23 -0
  103. data/spec/factories/spree/line_item_factory.rb +13 -0
  104. data/spec/factories/spree/promotion_factory.rb +35 -0
  105. data/spec/factories/spree/shipping_calculator_factory.rb +10 -0
  106. data/spec/factories/spree_avatax_official/avalara_entity_use_code_factory.rb +7 -0
  107. data/spec/factories/spree_avatax_official/calculator/avatax_transaction_calculator_factory.rb +3 -0
  108. data/spec/factories/spree_avatax_official/transaction_factory.rb +12 -0
  109. data/spec/factories/usa_address_factory.rb +34 -0
  110. data/spec/features/admin/edit_avatax_settings_spec.rb +11 -0
  111. data/spec/features/admin/update_avatax_settings_spec.rb +200 -0
  112. data/spec/features/spree/admin/avalara_entity_use_codes_controller_spec.rb +71 -0
  113. data/spec/features/spree/admin/users_controller_spec.rb +34 -0
  114. data/spec/helpers/spree_avatax_official/tax_adjustment_label_helper_spec.rb +81 -0
  115. data/spec/lib/spree_avatax_official/seeder_spec.rb +23 -0
  116. data/spec/models/spree/line_item_spec.rb +76 -0
  117. data/spec/models/spree/order_spec.rb +210 -0
  118. data/spec/models/spree/shipment_spec.rb +11 -0
  119. data/spec/models/spree_avatax_official/avatax_log_spec.rb +87 -0
  120. data/spec/models/spree_avatax_official/entity_use_code_spec.rb +9 -0
  121. data/spec/models/spree_avatax_official/has_uuid_spec.rb +21 -0
  122. data/spec/models/spree_avatax_official/spree/refund_decorator_spec.rb +31 -0
  123. data/spec/models/spree_avatax_official/transaction_spec.rb +9 -0
  124. data/spec/presenters/spree_avatax_official/address_presenter_spec.rb +53 -0
  125. data/spec/presenters/spree_avatax_official/item_presenter_spec.rb +159 -0
  126. data/spec/presenters/spree_avatax_official/ship_to_address_presenter_spec.rb +34 -0
  127. data/spec/presenters/spree_avatax_official/transactions/adjust_presenter_spec.rb +39 -0
  128. data/spec/presenters/spree_avatax_official/transactions/create_presenter_spec.rb +110 -0
  129. data/spec/presenters/spree_avatax_official/transactions/full_refund_presenter_spec.rb +30 -0
  130. data/spec/presenters/spree_avatax_official/transactions/partial_refund_presenter_spec.rb +48 -0
  131. data/spec/services/spree_avatax_official/address/validate_spec.rb +47 -0
  132. data/spec/services/spree_avatax_official/create_tax_adjustments_service_spec.rb +444 -0
  133. data/spec/services/spree_avatax_official/generate_transaction_cache_key_service_spec.rb +29 -0
  134. data/spec/services/spree_avatax_official/get_tax_service_spec.rb +33 -0
  135. data/spec/services/spree_avatax_official/settings/update_service_spec.rb +131 -0
  136. data/spec/services/spree_avatax_official/transactions/adjust_service_spec.rb +55 -0
  137. data/spec/services/spree_avatax_official/transactions/create_service_spec.rb +262 -0
  138. data/spec/services/spree_avatax_official/transactions/find_order_transaction_service_spec.rb +38 -0
  139. data/spec/services/spree_avatax_official/transactions/full_refund_service_spec.rb +24 -0
  140. data/spec/services/spree_avatax_official/transactions/get_by_code_service_spec.rb +74 -0
  141. data/spec/services/spree_avatax_official/transactions/partial_refund_service_spec.rb +33 -0
  142. data/spec/services/spree_avatax_official/transactions/refund_service_spec.rb +65 -0
  143. data/spec/services/spree_avatax_official/transactions/void_service_spec.rb +33 -0
  144. data/spec/services/spree_avatax_official/utilities/ping_service_spec.rb +35 -0
  145. data/spec/spec_helper.rb +104 -0
  146. data/spec/support/avatax.rb +15 -0
  147. data/spec/support/capybara.rb +21 -0
  148. data/spec/support/database_cleaner.rb +25 -0
  149. data/spec/support/factory_bot.rb +9 -0
  150. data/spec/support/vcr.rb +17 -0
  151. 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
  152. 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
  153. data/spec/vcr/spree_avatax_official/address/validate_failure.yml +46 -0
  154. data/spec/vcr/spree_avatax_official/address/validate_success.yml +43 -0
  155. data/spec/vcr/spree_avatax_official/address/zipcode_failure.yml +45 -0
  156. data/spec/vcr/spree_avatax_official/create_tax_adjustments/californian_stock_location.yml +60 -0
  157. data/spec/vcr/spree_avatax_official/create_tax_adjustments/completed_order_line_item_update.yml +62 -0
  158. data/spec/vcr/spree_avatax_official/create_tax_adjustments/order_adjustment_promotion.yml +61 -0
  159. data/spec/vcr/spree_avatax_official/create_tax_adjustments/shipment_adjustment_promotion.yml +60 -0
  160. data/spec/vcr/spree_avatax_official/create_tax_adjustments/simple_completed_order.yml +60 -0
  161. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/line_item_adjustment_promotion.yml +59 -0
  162. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/line_item_and_shipment.yml +60 -0
  163. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/multiple_line_items_multiple_quantity.yml +59 -0
  164. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_excluded/single_line_item.yml +55 -0
  165. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/line_item_adjustment_promotion.yml +59 -0
  166. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/line_item_and_shipment.yml +60 -0
  167. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/multiple_line_items_multiple_quantity.yml +59 -0
  168. data/spec/vcr/spree_avatax_official/create_tax_adjustments/tax_included/single_line_item.yml +55 -0
  169. data/spec/vcr/spree_avatax_official/create_tax_adjustments/with_incorrect_address.yml +97 -0
  170. data/spec/vcr/spree_avatax_official/get_tax/error.yml +49 -0
  171. data/spec/vcr/spree_avatax_official/get_tax/sucsess.yml +55 -0
  172. data/spec/vcr/spree_avatax_official/transactions/adjust/failure.yml +101 -0
  173. data/spec/vcr/spree_avatax_official/transactions/adjust/invoice_order_success.yml +117 -0
  174. data/spec/vcr/spree_avatax_official/transactions/create/complete_order_success.yml +60 -0
  175. data/spec/vcr/spree_avatax_official/transactions/create/gst/canada_to_canada.yml +55 -0
  176. data/spec/vcr/spree_avatax_official/transactions/create/gst/canada_to_us.yml +57 -0
  177. data/spec/vcr/spree_avatax_official/transactions/create/gst/us_to_canada.yml +56 -0
  178. data/spec/vcr/spree_avatax_official/transactions/create/invoice_order_success.yml +60 -0
  179. data/spec/vcr/spree_avatax_official/transactions/create/sales_order_success.yml +60 -0
  180. data/spec/vcr/spree_avatax_official/transactions/create/timeout.yml +54 -0
  181. data/spec/vcr/spree_avatax_official/transactions/create/vat/europe_to_europe.yml +57 -0
  182. data/spec/vcr/spree_avatax_official/transactions/create/vat/europe_to_us.yml +57 -0
  183. data/spec/vcr/spree_avatax_official/transactions/create/vat/us_to_europe.yml +58 -0
  184. data/spec/vcr/spree_avatax_official/transactions/get_by_code/error.yml +44 -0
  185. data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_custom_code_success.yml +49 -0
  186. data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_number_success.yml +49 -0
  187. data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_with_type_success.yml +48 -0
  188. data/spec/vcr/spree_avatax_official/transactions/get_by_code/order_without_type_success.yml +48 -0
  189. data/spec/vcr/spree_avatax_official/transactions/refund/full_refund_success.yml +114 -0
  190. data/spec/vcr/spree_avatax_official/transactions/refund/partial_refund_success.yml +58 -0
  191. data/spec/vcr/spree_avatax_official/transactions/refund/partial_refund_with_refund_success.yml +58 -0
  192. data/spec/vcr/spree_avatax_official/transactions/void/success.yml +112 -0
  193. data/spec/vcr/spree_avatax_official/utilities/ping.yml +41 -0
  194. data/spec/vcr/spree_avatax_official/utilities/ping_unauthorized.yml +42 -0
  195. data/spec/vcr/spree_line_item/update_tax_charge/decrease_quantity.yml +55 -0
  196. data/spec/vcr/spree_line_item/update_tax_charge/increase_quantity.yml +55 -0
  197. data/spec/vcr/spree_order/california_order.yml +67 -0
  198. data/spec/vcr/spree_order/complete_order.yml +60 -0
  199. data/spec/vcr/spree_order/order_transition_to_completed.yml +112 -0
  200. data/spec/vcr/spree_order/order_with_line_item_adjustment.yml +57 -0
  201. data/spec/vcr/spree_order/order_with_order_adjustment.yml +57 -0
  202. data/spec/vcr/spree_order/simple_order_with_single_line_item.yml +55 -0
  203. data/spec/vcr/spree_order/simple_order_with_single_line_item_and_shipment.yml +57 -0
  204. data/spec/vcr/spree_order/update_tax_charge/create_line_item.yml +55 -0
  205. data/spree_avatax_official.gemspec +43 -0
  206. metadata +486 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c11e32278f060728b89bad98e554c869b8751b109ec0d991912160292c950440
4
+ data.tar.gz: b5c21921f675f85d46fe99065eeaead6ddbfd0c580b77d35457fdefa1bb4e4a8
5
+ SHA512:
6
+ metadata.gz: 3f598d0d05a4a729b3fc7e2a0a2ae94ef166858ce7aac5c766197644589254d0cdca7aecd041b0679a8537ab9edc4c20fb38f1f7ec0d59b7229e92c62eb10fb0
7
+ data.tar.gz: dc9688d27b5d809dadff25212deaed7231d1648fc4c0f7765048c92458d65f344ffb783c4f5ead8a91ad6a6cd828ce5387fc376e29d006d54c126d883ba893c2
data/.env-sample ADDED
@@ -0,0 +1,4 @@
1
+ AVATAX_ENDPOINT=https://sandbox-rest.avatax.com
2
+ AVATAX_USERNAME=
3
+ AVATAX_PASSWORD=
4
+ AVATAX_COMPANY_CODE=
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .localeapp/locales
7
+ .project
8
+ .vscode
9
+ coverage
10
+ default
11
+ Gemfile.lock
12
+ tmp
13
+ nbproject
14
+ pkg
15
+ *.sw?
16
+ spec/dummy
17
+ .rvmrc
18
+ .sass-cache
19
+ public/spree
20
+ .ruby-version
21
+ .ruby-gemset
22
+ gemfiles/*.gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ -r spec_helper
3
+ -f documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,77 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ TargetRubyVersion: 2.3
4
+ Exclude:
5
+ - 'spec/dummy/**/*'
6
+ - 'lib/generators/**/*'
7
+ - 'vendor/bundle/**/*'
8
+ - 'tmp/**/*'
9
+ - 'gemfiles/vendor/bundle/**/*'
10
+
11
+ Rails:
12
+ Enabled: true
13
+
14
+ # == Metrics == #
15
+ Metrics/LineLength:
16
+ Max: 150
17
+
18
+ Metrics/MethodLength:
19
+ Max: 10
20
+
21
+ Metrics/ClassLength:
22
+ Max: 100
23
+
24
+ Metrics/ModuleLength:
25
+ Max: 100
26
+
27
+ Metrics/ParameterLists:
28
+ Max: 5
29
+
30
+ # == Layout == #
31
+ Layout/AlignHash:
32
+ EnforcedHashRocketStyle: table
33
+ EnforcedColonStyle: table
34
+
35
+ Layout/EmptyLineAfterGuardClause:
36
+ Enabled: true
37
+
38
+ Layout/ExtraSpacing:
39
+ ForceEqualSignAlignment: true
40
+
41
+ Layout/Tab:
42
+ IndentationWidth: 2
43
+
44
+ # == Style == #
45
+ Style/SymbolArray:
46
+ Enabled: true
47
+
48
+ Style/HashSyntax:
49
+ EnforcedStyle: ruby19_no_mixed_keys
50
+
51
+ Style/CollectionMethods:
52
+ Enabled: true
53
+
54
+ Style/NumericLiterals:
55
+ MinDigits: 4
56
+
57
+ Style/StringLiterals:
58
+ EnforcedStyle: single_quotes
59
+
60
+ # == Disabled Cops == #
61
+ Rails/SkipsModelValidations:
62
+ Enabled: false
63
+
64
+ Rails/ApplicationRecord:
65
+ Enabled: false
66
+
67
+ Style/Documentation:
68
+ Enabled: false
69
+
70
+ Style/FrozenStringLiteralComment:
71
+ Enabled: false
72
+
73
+ Gemspec/RequiredRubyVersion:
74
+ Enabled: false
75
+
76
+ Style/ClassAndModuleChildren:
77
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,78 @@
1
+ os: linux
2
+ dist: bionic
3
+
4
+ addons:
5
+ apt:
6
+ sources:
7
+ - google-chrome
8
+ packages:
9
+ - google-chrome-stable
10
+
11
+ services:
12
+ - mysql
13
+ - postgresql
14
+
15
+ language: ruby
16
+
17
+ rvm:
18
+ - 3.0
19
+ - 2.7
20
+ - 2.5
21
+ - 2.3
22
+
23
+ env:
24
+ - DB=mysql
25
+ - DB=postgres
26
+
27
+ gemfile:
28
+ - gemfiles/spree_3_1.gemfile
29
+ - gemfiles/spree_3_7.gemfile
30
+ - gemfiles/spree_4_0.gemfile
31
+ - gemfiles/spree_4_1.gemfile
32
+ - gemfiles/spree_4_2.gemfile
33
+ - gemfiles/spree_master.gemfile
34
+
35
+ jobs:
36
+ fast_finish: true
37
+ allow_failures:
38
+ - gemfile: gemfiles/spree_master.gemfile
39
+ exclude:
40
+ - rvm: 3.0
41
+ gemfile: gemfiles/spree_3_1.gemfile
42
+ - rvm: 3.0
43
+ gemfile: gemfiles/spree_3_7.gemfile
44
+ - rvm: 3.0
45
+ gemfile: gemfiles/spree_4_0.gemfile
46
+ - rvm: 3.0
47
+ gemfile: gemfiles/spree_4_1.gemfile
48
+ - rvm: 2.7
49
+ gemfile: gemfiles/spree_3_1.gemfile
50
+ - rvm: 2.5
51
+ gemfile: gemfiles/spree_3_1.gemfile
52
+ - rvm: 2.5
53
+ gemfile: gemfiles/spree_master.gemfile
54
+ - rvm: 2.3
55
+ gemfile: gemfiles/spree_3_7.gemfile
56
+ - rvm: 2.3
57
+ gemfile: gemfiles/spree_4_0.gemfile
58
+ - rvm: 2.3
59
+ gemfile: gemfiles/spree_4_1.gemfile
60
+ - rvm: 2.3
61
+ gemfile: gemfiles/spree_4_2.gemfile
62
+ - rvm: 2.3
63
+ gemfile: gemfiles/spree_master.gemfile
64
+
65
+ before_script:
66
+ - CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
67
+ - CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
68
+ - curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O
69
+ - unzip chromedriver_linux64.zip -d ~/bin
70
+ - nvm install 14
71
+
72
+ script:
73
+ - bundle exec rake test_app
74
+ - bundle exec rake spec
75
+
76
+ before_install:
77
+ - sudo apt-get install libmysqlclient-dev
78
+ - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
data/Appraisals ADDED
@@ -0,0 +1,49 @@
1
+ appraise 'spree-3-1' do
2
+ gem 'spree_core', '~> 3.1.0'
3
+ gem 'spree_backend', '~> 3.1.0'
4
+ gem 'pg', '~> 0.18'
5
+ gem 'spree_auth_devise', '~> 3.3'
6
+ gem 'factory_girl'
7
+ gem 'rails_test_params_backport'
8
+ end
9
+
10
+ appraise 'spree-3-7' do
11
+ gem 'spree_core', '~> 3.7.0'
12
+ gem 'spree_backend', '~> 3.7.0'
13
+ gem 'spree_auth_devise', '~> 3.5'
14
+ gem 'rails-controller-testing'
15
+ gem 'sass-rails'
16
+ end
17
+
18
+ appraise 'spree-4-0' do
19
+ gem 'spree_core', '~> 4.0.0.rc1'
20
+ gem 'spree_backend', '~> 4.0.0'
21
+ gem 'spree_auth_devise', '~> 4.0.0.rc2'
22
+ gem 'rails-controller-testing'
23
+ gem 'rspec-rails', '~> 4.0.0.beta2'
24
+ end
25
+
26
+ appraise 'spree-4-1' do
27
+ gem 'spree_core', '~> 4.1.0'
28
+ gem 'spree_backend', '~> 4.1.0'
29
+ gem 'spree_auth_devise', '~> 4.1.0'
30
+ gem 'rails-controller-testing'
31
+ gem 'rspec-rails', '~> 4.0.0.beta2'
32
+ end
33
+
34
+ appraise 'spree-4-2' do
35
+ gem 'spree_core', '~> 4.2.0.beta'
36
+ gem 'spree_backend', '~> 4.2.0.beta'
37
+ gem 'spree_auth_devise', '~> 4.2.0'
38
+ gem 'rails-controller-testing'
39
+ gem 'sass-rails'
40
+ gem 'rspec-rails', '~> 4.0.0.beta2'
41
+ end
42
+
43
+ appraise 'spree-master' do
44
+ gem 'spree_core', github: 'spree/spree', branch: 'master'
45
+ gem 'spree_backend', github: 'spree/spree', branch: 'master'
46
+ gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: 'master'
47
+ gem 'rails-controller-testing'
48
+ gem 'rspec-rails', '~> 4.0.0.beta2'
49
+ end
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) do |repo_name|
4
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
5
+ "https://github.com/#{repo_name}.git"
6
+ end
7
+
8
+ gem 'rails-controller-testing'
9
+ gem 'rubocop', '~> 0.63.0', require: false
10
+ gem 'rubocop-rspec', require: false
11
+ gem 'spree_auth_devise'
12
+ gem 'spree_backend'
13
+ gem 'spree_core'
14
+ gem 'sass-rails'
15
+
16
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2019 Spark Solutions
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Spree Avalara AvaTax official extension
2
+
3
+ [![Build Status](https://travis-ci.org/spree-contrib/spree_avatax_official.svg?branch=master)](https://travis-ci.org/spree-contrib/spree_avatax_official)
4
+
5
+ The new officially supported Avalara AvaTax extension for [Spree Commerce](https://spreecommerce.org/) using [Avalara REST API v2](https://developer.avalara.com/api-reference/avatax/rest/v2/).
6
+ * [Introduction](#introduction)
7
+ * [Maintenance & support](#maintenance--support)
8
+ * [Features](#features)
9
+ * [Installation](#installation)
10
+ * [Setup](#setup)
11
+ * [Migrating from spree_avatax_certified](#migrating-from-spree_avatax_certified)
12
+ * [Testing](#testing)
13
+ * [Contributing](#contributing)
14
+ * [About Spark Solutions](#about-spark-solutions)
15
+
16
+ ## Introduction
17
+
18
+ <img src="https://spreecommerce.org/wp-content/uploads/2019/11/AvalaraCertifiedBadge_Refunds.png" width=150 align=right> <img src="https://spreecommerce.org/wp-content/uploads/2019/11/AvalaraCertifiedBadge_SalesTax.png" width=150 align=right> Avalara AvaTax is a cloud-based solution automating transaction tax calculations and the tax filing process. Avalara provides real-time tax calculation using tax content from more than 12,000 US taxing jurisdictions and over 200 countries, ensuring your transaction tax is calculated based on the most current tax rules.
19
+
20
+ The new officially certified Spree AvaTax extension helps Spree users and developers to switch from the old Avalara REST API V1 to the latest [Avalara REST API v2](https://developer.avalara.com/api-reference/avatax/rest/v2/). In the words of Avalara developers "the benefits are huge" as the new API V2 offers improved AvaTax performance, reliability and a wide range of new functionality.
21
+
22
+ And since AvaTax delivers sales and use tax calculations at the time of checkout or billing — in real time — the business benefits from implementing the new Spree AvaTax V2 extension are significant, potentially improving conversion rates and sales results.
23
+
24
+ ## Maintenance & support
25
+
26
+ The new extension comes with technical support from both Spree Commerce core team and Avalara and will be maintained to keep up with the innovations introduced by Avalara in the future. The old extension will no longer be maintained or supported.
27
+
28
+ For more information, support and guidance on how to implement Spree AvaTax V2 extension feel free to:
29
+ * reach out through the [Spree contact form](https://spreecommerce.org/contact/)
30
+ * join the Spree slack channel #spree-avatax at [slack.spreecommerce.org](http://slack.spreecommerce.org)
31
+
32
+ ## Features
33
+
34
+ 1. Tax calculation (additional/included tax), US state tax, Canadian HST, VAT supported
35
+ 2. Address validation for US & Canada
36
+ 3. Commiting complete orders
37
+ 4. Cancelling (voiding) orders
38
+ 5. Refunding orders
39
+ 6. GetByCodeService for getting SalesInvoice for order from Avatax
40
+ 7. GetTaxService for getting totalTaxCalculated for order from Avatax
41
+ 8. AvataxLog for logging API calls
42
+ 9. Caching responses for improved performance
43
+ 10. Multiple company (store) support
44
+
45
+ ## Installation
46
+
47
+ 1. Add this extension to your `Gemfile` with this line:
48
+ ```ruby
49
+ gem 'spree_avatax_official', github: 'spree-contrib/spree_avatax_official'
50
+ ```
51
+
52
+ 2. Install the gem using Bundler:
53
+
54
+ ```bash
55
+ bundle install
56
+ ```
57
+
58
+ 3. Run the install generator
59
+
60
+ ```bash
61
+ bundle exec rails g spree_avatax_official:install
62
+ ```
63
+
64
+ 4. Restart your server
65
+
66
+ If your server was running, restart it so that it can find the assets properly.
67
+
68
+ ## Setup
69
+
70
+ In order to configure tax calculation you need to:
71
+ 1. [Connect Spree to AvaTax](#connect-spree-to-avatax)
72
+ 2. [Configure Spree Stock Location](#configure-spree-stock-location)
73
+ 3. [Configure AvaTax settings](#configure-avalara-avatax)
74
+ 4. [Assign an AvaTax System Tax Code to a Tax Category](#assign-an-avatax-system-tax-code-to-a-tax-category)
75
+
76
+ ### Connect Spree to AvaTax
77
+
78
+ In order to use `spree_avatax_official` extension, you need to configure your
79
+ Avatax credentials. To do so, open spree admin panel and go to **Configurations**
80
+ and then **Avatax Settings**.
81
+
82
+ <img width="1053" alt="Zrzut ekranu 2019-10-15 o 12 46 14" src="https://user-images.githubusercontent.com/581569/66825661-fcd5d000-ef4a-11e9-84b1-993b1a5c1996.png">
83
+
84
+ Company code, account number and license key can be
85
+ configured in the **Avatax Credentials** section of the form.
86
+
87
+ <img width="1053" alt="Zrzut ekranu 2019-10-16 o 12 20 14" src="https://user-images.githubusercontent.com/581569/66910959-da59ba80-f00f-11e9-8b96-ad2fa45b01ae.png">
88
+
89
+ * **Account Number:** Provided during your AvaTax account activation process.
90
+ * **License Key:** Provided during your AvaTax account activation process.
91
+ * **Company Code:** Company profile identifier in the AvaTax Admin Console.
92
+
93
+ **Service URL** is an URL to connect to the Development or Production AvaTax services. It can be configured in the **Avatax Endpoint urls** section below.
94
+
95
+ <img width="1053" alt="Zrzut ekranu 2019-10-16 o 12 24 35" src="https://user-images.githubusercontent.com/581569/66911009-fa897980-f00f-11e9-8524-1c64540a9a0f.png">
96
+
97
+ You can test settings you provided using the **Ping Avatax** button under the form
98
+
99
+ <img width="1053" alt="Zrzut ekranu 2019-10-16 o 12 25 26" src="https://user-images.githubusercontent.com/581569/66911077-17be4800-f010-11e9-89e0-e1982dd84e25.png">
100
+
101
+ ### Configure Spree Stock Locations
102
+
103
+ In order for extension to be able to calculate the taxes, you need to set your stock locations addresses properly.
104
+ To do so, in Spree admin panel, go to `Configurations -> Stock Locations` and edit addresses of all Stock Locations visible on the list.
105
+
106
+ ### Configure Avalara AvaTax
107
+
108
+ Once connected, you configure additional settings.
109
+
110
+ <img width="1053" alt="Zrzut ekranu 2019-10-16 o 12 26 54" src="https://user-images.githubusercontent.com/581569/66911217-5c49e380-f010-11e9-86e7-f6fee2f0795d.png">
111
+
112
+ * **Enable Commiting Transactions:** Enables tax document submission to **Avalara’s AvaTax** service for record keeping. With this setting enabled, transactions will be posted and committed to the **AvaTax Admin Console**.
113
+ * **Enable Address Validation:** Option to enable or disable address validation
114
+
115
+ ### Assign an AvaTax System Tax Code to a Tax Category
116
+
117
+ In order to assign **AvaTax System Tax Code** to **Spree Tax Category**, you need to open **Tax Categories** settings screen (`Configurations -> Tax Categories`), pick up existing or create a new **Tax Category** and fill the **Tax Code** input with the applicable **AvaTax System Tax Code**.
118
+
119
+ <img width="1053" alt="Zrzut ekranu 2019-10-15 o 12 51 04" src="https://user-images.githubusercontent.com/581569/66825678-095a2880-ef4b-11e9-840c-0a86dbc721b4.png">
120
+
121
+ If left blank, the **Tax Code** will
122
+ default to `P0000000`.
123
+
124
+ To see a listing of all available **AvaTax System** tax codes, see http://taxcode.avatax.avalara.com
125
+
126
+ ## Migrating from spree_avatax_certified
127
+
128
+ The old extension spree_avatax_certified using the old Avalara REST API V1 will no longer be maintained or supported by the Spree team.
129
+
130
+ If you need to migrate from the old spree_avatax_certified to the new spree_avatax_official, in order to take advantage of the improved AvaTax performance, reliability and new functionality, there are various ways of ensuring backwards compatibility of Orders (eg. for refund purposes) which were committed to Avatax using the old extension.
131
+
132
+ Please reach out through the [Spree contact form](https://spreecommerce.org/contact/) to discuss an optimal strategy for your use case.
133
+
134
+ ## Testing
135
+
136
+ First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
137
+
138
+ ```shell
139
+ bundle
140
+ bundle exec rake
141
+ ```
142
+
143
+ When testing your applications integration with this extension you may use it's factories.
144
+ Simply add this require statement to your spec_helper:
145
+
146
+ ```ruby
147
+ require 'spree_avatax_official/factories'
148
+ ```
149
+
150
+ ## Contributing
151
+
152
+ If you'd like to contribute, please take a look at the
153
+ [instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
154
+ pull request.
155
+
156
+ ## License
157
+
158
+ Spree Avatax Official is copyright © 2019 [Spark Solutions Sp. z o.o.][spark].
159
+ It is free software, and may be redistributed under the terms specified in the
160
+ [LICENCE](LICENSE) file.
161
+
162
+ [LICENSE]: https://github.com/spree-contrib/spree_avatax_official/blob/master/LICENSE
163
+
164
+ ## About Spark Solutions
165
+
166
+ [![Spark Solutions](http://sparksolutions.co/wp-content/uploads/2015/01/logo-ss-tr-221x100.png)][spark]
167
+
168
+ Spree Avatax Official is maintained by [Spark Solutions Sp. z o.o.](http://sparksolutions.co?utm_source=github) and
169
+ supported by [Avalara Inc.](https://www.avalara.com/us/en/index.html). The names and logos are trademarks of Avalara Inc.
170
+
171
+ We are passionate about open source software and [available for hire][spark].
172
+
173
+ [spark]:http://sparksolutions.co?utm_source=github