added customer-command-side

This commit is contained in:
dartpopikyardo
2016-02-03 23:04:15 +03:00
parent cbee50658e
commit e0691a61a2
13 changed files with 245 additions and 55 deletions

View File

@@ -22,7 +22,7 @@ public class AccountController {
@RequestMapping(method = RequestMethod.POST)
public Observable<CreateAccountResponse> createAccount(@Validated @RequestBody CreateAccountRequest request) {
return accountService.openAccount(request.getInitialBalance())
return accountService.openAccount(request.getCustomerId(), request.getInitialBalance())
.map(entityAndEventInfo -> new CreateAccountResponse(entityAndEventInfo.getEntityIdentifier().getId()));
}
}

View File

@@ -7,6 +7,9 @@ import java.math.BigDecimal;
public class CreateAccountRequest {
@NotNull
private String customerId;
@NotNull
@DecimalMin("0")
private BigDecimal initialBalance;
@@ -14,11 +17,19 @@ public class CreateAccountRequest {
public CreateAccountRequest() {
}
public CreateAccountRequest(BigDecimal initialBalance) {
public CreateAccountRequest(String customerId, BigDecimal initialBalance) {
this.initialBalance = initialBalance;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public BigDecimal getInitialBalance() {
return initialBalance;
}