diff --git a/app/models/spree_avatax_official/spree/order_decorator.rb b/app/models/spree_avatax_official/spree/order_decorator.rb index 0c15947d..d0afd971 100644 --- a/app/models/spree_avatax_official/spree/order_decorator.rb +++ b/app/models/spree_avatax_official/spree/order_decorator.rb @@ -88,4 +88,6 @@ def void_in_avatax end end -::Spree::Order.prepend ::SpreeAvataxOfficial::Spree::OrderDecorator +unless ::Spree::Order.ancestors.include?(::SpreeAvataxOfficial::Spree::OrderDecorator) + ::Spree::Order.prepend(::SpreeAvataxOfficial::Spree::OrderDecorator) +end diff --git a/app/models/spree_avatax_official/spree/return_authorization_decorator.rb b/app/models/spree_avatax_official/spree/return_authorization_decorator.rb index 8e3abbb7..b913ba22 100644 --- a/app/models/spree_avatax_official/spree/return_authorization_decorator.rb +++ b/app/models/spree_avatax_official/spree/return_authorization_decorator.rb @@ -20,4 +20,6 @@ def refund_in_avatax end end -::Spree::ReturnAuthorization.prepend(::SpreeAvataxOfficial::Spree::ReturnAuthorizationDecorator) unless 'Spree::Refund'.safe_constantize +unless ::Spree::ReturnAuthorization.ancestors.include?(::SpreeAvataxOfficial::Spree::ReturnAuthorizationDecorator) + ::Spree::ReturnAuthorization.prepend(::SpreeAvataxOfficial::Spree::ReturnAuthorizationDecorator) unless 'Spree::Refund'.safe_constantize +end diff --git a/spree_avatax_official.gemspec b/spree_avatax_official.gemspec index 10aa1aff..0786249b 100644 --- a/spree_avatax_official.gemspec +++ b/spree_avatax_official.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'avatax', '~> 19.3' + s.add_dependency 'avatax', '>= 19.3' spree_version = '>= 2.1.0'