Class: Bitsy::PaymentTransaction

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bitsy/payment_transaction.rb

Instance Method Summary collapse

Instance Method Details

#forward_tax_feeObject



32
33
34
35
36
37
38
# File 'app/models/bitsy/payment_transaction.rb', line 32

def forward_tax_fee
  ForwardTaxCalculator.calculate(self.amount,
                                 self.payment_depot_min_payment,
                                 self.payment_depot_total_received_amount,
                                 self.payment_depot_initial_tax_rate,
                                 self.payment_depot_added_tax_rate)
end

#owner_feeObject



40
41
42
# File 'app/models/bitsy/payment_transaction.rb', line 40

def owner_fee
  self.amount - self.forward_tax_fee
end

#update_payment_depot_cacheObject



44
45
46
47
48
49
# File 'app/models/bitsy/payment_transaction.rb', line 44

def update_payment_depot_cache
  if payment_type == "receive"
    payment_depot.total_received_amount_cache += amount
    payment_depot.save
  end
end