Class: Dune::Balanced::Bankaccount::TransactionFeeCalculatorBase
- Inherits:
-
Object
- Object
- Dune::Balanced::Bankaccount::TransactionFeeCalculatorBase
- Defined in:
- app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb
Direct Known Subclasses
TransactionAdditionalFeeCalculator, TransactionInclusiveFeeCalculator
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#fees ⇒ Object
Base calculation of fees 1% + 30¢ ($5 cap).
- #gross_amount ⇒ Object
-
#initialize(transaction_value) ⇒ TransactionFeeCalculatorBase
constructor
A new instance of TransactionFeeCalculatorBase.
- #net_amount ⇒ Object
Constructor Details
#initialize(transaction_value) ⇒ TransactionFeeCalculatorBase
Returns a new instance of TransactionFeeCalculatorBase.
9 10 11 |
# File 'app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb', line 9 def initialize(transaction_value) @transaction_value = transaction_value end |
Instance Attribute Details
#transaction_value ⇒ Object
13 14 15 |
# File 'app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb', line 13 def transaction_value @transaction_value.to_f.floor_with_two_decimal_places end |
Instance Method Details
#fees ⇒ Object
Base calculation of fees 1% + 30¢ ($5 cap)
27 28 29 30 31 32 |
# File 'app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb', line 27 def fees [ (net_amount * 0.01 + 0.3).ceil_with_two_decimal_places, 5.0 ].min end |
#gross_amount ⇒ Object
17 18 19 |
# File 'app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb', line 17 def gross_amount net_amount + fees end |
#net_amount ⇒ Object
21 22 23 |
# File 'app/models/dune/balanced/bankaccount/transaction_fee_calculator_base.rb', line 21 def net_amount raise NotImplementedError end |