Created
August 30, 2016 16:23
-
-
Save johndstein/2789c30e9f93581dfca788df4893cf54 to your computer and use it in GitHub Desktop.
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
| public with sharing class DuesCalculator { | |
| public DuesCalculator() { | |
| } | |
| public Decimal getAnnualDues(Id contactId) { | |
| return 1; | |
| } | |
| public Decimal getLifetimeDues(Id contactId) { | |
| return 1; | |
| } | |
| public List<Account> getAccountHierarchy(Id accountId, List<Account> accounts) { | |
| Account a = [ | |
| select Id, ParentId, Name, Type | |
| from Account | |
| where Id = :accountId | |
| ]; | |
| if (accounts == null) { | |
| accounts = new List<Account>(); | |
| } | |
| accounts.add(a); | |
| if (a.Parent != null) { | |
| return this.getAccountHierarchy(a.ParentId, accounts); | |
| } else { | |
| return accounts; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment