Last active
          February 22, 2017 13:49 
        
      - 
      
- 
        Save tyronewilson/109261b3cc98d6888f114162471b6186 to your computer and use it in GitHub Desktop. 
    example bank account class
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module Banking | |
| module PaymentMethods | |
| class BankAccount < ActiveRecord::Base | |
| belongs_to :user | |
| has_many :transactions, class_name: 'Banking::Transaction' | |
| def debit(amount) | |
| Processing::Debit.execute(amount, self) | |
| # Or Processing::Debit.new(amount, self).process! depending on your desired API | |
| end | |
| def credit(amount) | |
| Processing::Credit.execute(amount, self) | |
| # Or Processing::Credit.new(amount, self).process! | |
| end | |
| end | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment