Last active
September 26, 2019 07:26
-
-
Save thombergs/d7c29c4556f6574e98198bbddcb8fbd2 to your computer and use it in GitHub Desktop.
Account.java
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
package buckpal.domain; | |
@AllArgsConstructor(access = AccessLevel.PRIVATE) | |
public class Account { | |
@Getter private final AccountId id; | |
@Getter private final ActivityWindow activityWindow; | |
private final Money baselineBalance; | |
public static Account withoutId( | |
Money baselineBalance, | |
ActivityWindow activityWindow) { | |
return new Account(null, baselineBalance, activityWindow); | |
} | |
public static Account withId( | |
AccountId accountId, | |
Money baselineBalance, | |
ActivityWindow activityWindow) { | |
return new Account(accountId, baselineBalance, activityWindow); | |
} | |
public Money calculateBalance() { | |
// ... | |
} | |
public boolean withdraw(Money money, AccountId targetAccountId) { | |
// ... | |
} | |
public boolean deposit(Money money, AccountId sourceAccountId) { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment