Skip to content

Instantly share code, notes, and snippets.

@johndstein
Created August 30, 2016 16:23
Show Gist options
  • Select an option

  • Save johndstein/2789c30e9f93581dfca788df4893cf54 to your computer and use it in GitHub Desktop.

Select an option

Save johndstein/2789c30e9f93581dfca788df4893cf54 to your computer and use it in GitHub Desktop.
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