Sha256: 8d357cd2d02fef1081e2001c75f84da5015b87fb933bb87d81661e3618d337ea
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
module CatarsePagarme::FeeCalculatorConcern extend ActiveSupport::Concern included do def get_fee return nil if self.payment.payment_method.blank? # We always depend on the payment_choice transaction = PagarMe::Transaction.find(self.payment.gateway_id) payables = transaction.payables cost = transaction.cost.to_f / 100.00 payables_fee = payables_fee.to_a.sum(&:fee).to_f / 100.00 if self.payment.payment_method == ::CatarsePagarme::PaymentType::SLIP cost + payables_fee else payables_fee == 0 ? cost : payables_fee end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
catarse_pagarme-2.15.0 | app/models/catarse_pagarme/fee_calculator_concern.rb |