Table name: transactions
id :integer not null, primary key from_user_id :integer to_user_id :integer created_at :datetime updated_at :datetime university_id :integer description :string(255) payable_amount :integer charged :boolean default(FALSE) paid :boolean default(FALSE)
Returns chargeable amount.
# File app/models/transaction.rb, line 33 def chargeable_amount amount + Money.new(100) end
Method to pay the tutor
# File app/models/transaction.rb, line 38 def pay_tutor if AccountBalance.credit(self.to_user, self, true, self.payable_amount) self.paid = true self.save(validate: false) self.create_activity key: 'transaction.paytutor', owner: user, recipient: tutor, type: 'Notification' return true end end