Module: Vpago::PaymentAmountCalculator

Included in:
Acleda::Base, AcledaMobile::Base, WingSdk::Base
Defined in:
lib/vpago/payment_amount_calculator.rb

Instance Method Summary collapse

Instance Method Details

#amountObject



3
4
5
# File 'lib/vpago/payment_amount_calculator.rb', line 3

def amount
  @payment.amount
end

#amount_with_feeObject



7
8
9
# File 'lib/vpago/payment_amount_calculator.rb', line 7

def amount_with_fee
  format('%.2f', (amount + transaction_fee))
end

#transaction_feeObject



19
20
21
# File 'lib/vpago/payment_amount_calculator.rb', line 19

def transaction_fee
  transaction_fee_fix + ((amount * transaction_fee_percentage) / 100)
end

#transaction_fee_fixObject



11
12
13
# File 'lib/vpago/payment_amount_calculator.rb', line 11

def transaction_fee_fix
  @payment.payment_method.preferences[:transaction_fee_fix].to_f
end

#transaction_fee_percentageObject



15
16
17
# File 'lib/vpago/payment_amount_calculator.rb', line 15

def transaction_fee_percentage
  @payment.payment_method.preferences[:transaction_fee_percentage].to_f
end