Class: Credit

Inherits:
Adjustment show all
Defined in:
app/models/credit.rb

Instance Method Summary collapse

Methods inherited from Adjustment

#amount, #update_amount

Instance Method Details

#calculate_adjustmentObject



4
5
6
7
8
9
10
11
12
13
# File 'app/models/credit.rb', line 4

def calculate_adjustment
  if adjustment_source
    case adjustment_source_type
    when "Coupon"
     calculate_coupon_credit
    else
      super
    end
  end
end

#inverse_amountObject



15
16
17
18
# File 'app/models/credit.rb', line 15

def inverse_amount
  x = self.amount > 0 ? -1 : 1
  self.amount = self.amount * x
end