- updated swagger description
- added /customers/{id}/toaccounts endpoint
This commit is contained in:
@@ -16,7 +16,7 @@ public class Account extends ReflectiveMutableCommandProcessingAggregate<Account
|
||||
private BigDecimal balance;
|
||||
|
||||
public List<Event> process(OpenAccountCommand cmd) {
|
||||
return EventUtil.events(new AccountOpenedEvent(cmd.getCustomerId(), cmd.getInitialBalance()));
|
||||
return EventUtil.events(new AccountOpenedEvent(cmd.getCustomerId(), cmd.getTitle(), cmd.getInitialBalance()));
|
||||
}
|
||||
|
||||
public List<Event> process(DebitAccountCommand cmd) {
|
||||
|
||||
@@ -14,8 +14,8 @@ public class AccountService {
|
||||
this.accountRepository = accountRepository;
|
||||
}
|
||||
|
||||
public rx.Observable<EntityWithIdAndVersion<Account>> openAccount(String customerId, BigDecimal initialBalance) {
|
||||
return accountRepository.save(new OpenAccountCommand(customerId, initialBalance));
|
||||
public rx.Observable<EntityWithIdAndVersion<Account>> openAccount(String customerId, String title, BigDecimal initialBalance) {
|
||||
return accountRepository.save(new OpenAccountCommand(customerId, title, initialBalance));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@ import java.math.BigDecimal;
|
||||
public class OpenAccountCommand implements AccountCommand {
|
||||
|
||||
private String customerId;
|
||||
private String title;
|
||||
private BigDecimal initialBalance;
|
||||
|
||||
public OpenAccountCommand(String customerId, BigDecimal initialBalance) {
|
||||
public OpenAccountCommand(String customerId, String title, BigDecimal initialBalance) {
|
||||
this.customerId = customerId;
|
||||
this.title = title;
|
||||
this.initialBalance = initialBalance;
|
||||
}
|
||||
|
||||
@@ -19,4 +22,8 @@ public class OpenAccountCommand implements AccountCommand {
|
||||
public String getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ public class AccountTest {
|
||||
@Test
|
||||
public void testSomething() {
|
||||
Account account = new Account();
|
||||
String title = "My Account";
|
||||
String customerId = "00000000-00000000";
|
||||
BigDecimal initialBalance = new BigDecimal(512);
|
||||
List<Event> events = CommandProcessingAggregates.processToList(account, (AccountCommand)new OpenAccountCommand(customerId, initialBalance));
|
||||
List<Event> events = CommandProcessingAggregates.processToList(account, (AccountCommand)new OpenAccountCommand(customerId, title, initialBalance));
|
||||
|
||||
Assert.assertEquals(1, events.size());
|
||||
Assert.assertEquals(AccountOpenedEvent.class, events.get(0).getClass());
|
||||
|
||||
Reference in New Issue
Block a user