Class: Solidus::Returnly::Refund::AmountCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus/returnly/refund/amount_calculator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(refund) ⇒ AmountCalculator

Returns a new instance of AmountCalculator.



7
8
9
# File 'lib/solidus/returnly/refund/amount_calculator.rb', line 7

def initialize(refund)
  self.refund = refund
end

Instance Attribute Details

#refund ⇒ Object

Returns the value of attribute refund.



5
6
7
# File 'lib/solidus/returnly/refund/amount_calculator.rb', line 5

def refund
  @refund
end

Instance Method Details

#return_item_refund_amount(return_item) ⇒ Object



11
12
13
# File 'lib/solidus/returnly/refund/amount_calculator.rb', line 11

def return_item_refund_amount(return_item)
  refund.refund_amount_per_item - Money.from_amount(return_item.total - return_item.pre_tax_amount)
end