Class: Returnly::Refund::AmountCalculator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(refund) ⇒ AmountCalculator

Returns a new instance of AmountCalculator.



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

def initialize(refund)
  self.refund = refund
end

Instance Attribute Details

#refundObject

Returns the value of attribute refund.



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

def refund
  @refund
end

Instance Method Details

#return_item_refund_amount(return_item) ⇒ Object



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

def return_item_refund_amount(return_item)
  (item_price(return_item) * item_price_percentage / 100).round(2, :down)
end