diff --git a/core/app/models/spree/calculator/returns/default_refund_amount.rb b/core/app/models/spree/calculator/returns/default_refund_amount.rb index b92da1fd105..fc3833560fc 100644 --- a/core/app/models/spree/calculator/returns/default_refund_amount.rb +++ b/core/app/models/spree/calculator/returns/default_refund_amount.rb @@ -14,7 +14,7 @@ def compute(return_item) private def weighted_order_adjustment_amount(inventory_unit) - inventory_unit.order.adjustments.eligible.non_tax.sum(:amount) * percentage_of_order_total(inventory_unit) + inventory_unit.order.adjustments.non_tax.sum(:amount) * percentage_of_order_total(inventory_unit) end def weighted_line_item_amount(inventory_unit) diff --git a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_calculator_returns_default_refund_amount_decorator.rb b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_calculator_returns_default_refund_amount_decorator.rb new file mode 100644 index 00000000000..0a1726a9c6c --- /dev/null +++ b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_calculator_returns_default_refund_amount_decorator.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module SolidusLegacyPromotions + module SpreeCalculatorReturnsDefaultRefundAmountDecorator + private + + def weighted_order_adjustment_amount(inventory_unit) + inventory_unit.order.adjustments.eligible.non_tax.sum(:amount) * percentage_of_order_total(inventory_unit) + end + + Spree::Calculator::Returns::DefaultRefundAmount.prepend self + end +end