- updated swagger description
- changed customer registration endpoint - updated tests
This commit is contained in:
@@ -8,12 +8,16 @@ import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Cust
|
|||||||
*/
|
*/
|
||||||
public class CustomerCreatedEvent implements Event {
|
public class CustomerCreatedEvent implements Event {
|
||||||
|
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
private CustomerInfo customerInfo;
|
private CustomerInfo customerInfo;
|
||||||
|
|
||||||
public CustomerCreatedEvent() {
|
public CustomerCreatedEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomerCreatedEvent(CustomerInfo customerInfo) {
|
public CustomerCreatedEvent( String firstName, String lastName, CustomerInfo customerInfo) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
this.customerInfo = customerInfo;
|
this.customerInfo = customerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,4 +28,20 @@ public class CustomerCreatedEvent implements Event {
|
|||||||
public void setCustomerInfo(CustomerInfo customerInfo) {
|
public void setCustomerInfo(CustomerInfo customerInfo) {
|
||||||
this.customerInfo = customerInfo;
|
this.customerInfo = customerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class AccountOpenEventSerializationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldSerde() {
|
public void shouldSerde() {
|
||||||
AccountOpenedEvent event = new AccountOpenedEvent(new BigDecimal(55));
|
AccountOpenedEvent event = new AccountOpenedEvent("00000000-00000000", "My Account", new BigDecimal(55));
|
||||||
String json = JSonMapper.toJson(event, EventStoreCommonObjectMapping.getObjectMapper());
|
String json = JSonMapper.toJson(event, EventStoreCommonObjectMapping.getObjectMapper());
|
||||||
System.out.println("json=" + json);
|
System.out.println("json=" + json);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
|
||||||
compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion"
|
compile "net.chrisrichardson.eventstore.client:eventstore-java-client_2.10:$eventStoreClientVersion"
|
||||||
|
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.11'
|
testCompile group: 'junit', name: 'junit', version: '4.11'
|
||||||
|
|||||||
@@ -3,15 +3,20 @@ package net.chrisrichardson.eventstore.javaexamples.banking.common.customers;
|
|||||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by popikyardo on 02.02.16.
|
* Created by popikyardo on 02.02.16.
|
||||||
*/
|
*/
|
||||||
public class Address {
|
public class Address {
|
||||||
|
@NotNull
|
||||||
private String street1;
|
private String street1;
|
||||||
private String street2;
|
private String street2;
|
||||||
|
@NotNull
|
||||||
private String city;
|
private String city;
|
||||||
|
@NotNull
|
||||||
private String state;
|
private String state;
|
||||||
|
@NotNull
|
||||||
private String zipCode;
|
private String zipCode;
|
||||||
|
|
||||||
public Address() {
|
public Address() {
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ package net.chrisrichardson.eventstore.javaexamples.banking.common.customers;
|
|||||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by popikyardo on 03.02.16.
|
* Created by popikyardo on 03.02.16.
|
||||||
*/
|
*/
|
||||||
public class CustomerInfo {
|
public class CustomerInfo {
|
||||||
|
@NotNull
|
||||||
protected String email;
|
protected String email;
|
||||||
|
@NotNull
|
||||||
protected String ssn;
|
protected String ssn;
|
||||||
|
@NotNull
|
||||||
protected String phoneNumber;
|
protected String phoneNumber;
|
||||||
protected Address address;
|
protected Address address;
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,25 @@ import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Cust
|
|||||||
* Created by popikyardo on 02.02.16.
|
* Created by popikyardo on 02.02.16.
|
||||||
*/
|
*/
|
||||||
public class CreateCustomerCommand implements CustomerCommand {
|
public class CreateCustomerCommand implements CustomerCommand {
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
private CustomerInfo customerInfo;
|
private CustomerInfo customerInfo;
|
||||||
|
|
||||||
public CreateCustomerCommand(CustomerInfo customerInfo) {
|
public CreateCustomerCommand(String firstName, String lastName, CustomerInfo customerInfo) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
this.customerInfo = customerInfo;
|
this.customerInfo = customerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomerInfo getCustomerInfo() {
|
public CustomerInfo getCustomerInfo() {
|
||||||
return customerInfo;
|
return customerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Customer extends ReflectiveMutableCommandProcessingAggregate<Custom
|
|||||||
|
|
||||||
|
|
||||||
public List<Event> process(CreateCustomerCommand cmd) {
|
public List<Event> process(CreateCustomerCommand cmd) {
|
||||||
return EventUtil.events(new CustomerCreatedEvent(cmd.getCustomerInfo()));
|
return EventUtil.events(new CustomerCreatedEvent(cmd.getFirstName(), cmd.getLastName(), cmd.getCustomerInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(CustomerCreatedEvent event) {
|
public void apply(CustomerCreatedEvent event) {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ public class CustomerService {
|
|||||||
this.accountRepository = accountRepository;
|
this.accountRepository = accountRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public rx.Observable<EntityWithIdAndVersion<Customer>> createCustomer(CustomerInfo customerInfo) {
|
public rx.Observable<EntityWithIdAndVersion<Customer>> createCustomer(String firstName, String lastName, CustomerInfo customerInfo) {
|
||||||
return accountRepository.save(new CreateCustomerCommand(customerInfo));
|
return accountRepository.save(new CreateCustomerCommand(firstName, lastName, customerInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
public rx.Observable<EntityWithIdAndVersion<Customer>> addToAccount(String customerId, String accountId, String title, String owner) {
|
public rx.Observable<EntityWithIdAndVersion<Customer>> addToAccount(String customerId, String accountId, String title, String owner) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.
|
|||||||
import net.chrisrichardson.eventstore.CommandProcessingAggregates;
|
import net.chrisrichardson.eventstore.CommandProcessingAggregates;
|
||||||
import net.chrisrichardson.eventstore.Event;
|
import net.chrisrichardson.eventstore.Event;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.AccountOpenedEvent;
|
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.AccountOpenedEvent;
|
||||||
|
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerCreatedEvent;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Address;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Address;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@@ -19,10 +20,10 @@ public class CustomerTest {
|
|||||||
|
|
||||||
CustomerInfo customerInfo = generateCustomerInfo();
|
CustomerInfo customerInfo = generateCustomerInfo();
|
||||||
|
|
||||||
List<Event> events = CommandProcessingAggregates.processToList(customer, new CreateCustomerCommand(customerInfo));
|
List<Event> events = CommandProcessingAggregates.processToList(customer, new CreateCustomerCommand("John", "Doe", customerInfo));
|
||||||
|
|
||||||
Assert.assertEquals(1, events.size());
|
Assert.assertEquals(1, events.size());
|
||||||
Assert.assertEquals(AccountOpenedEvent.class, events.get(0).getClass());
|
Assert.assertEquals(CustomerCreatedEvent.class, events.get(0).getClass());
|
||||||
|
|
||||||
customer.applyEvent(events.get(0));
|
customer.applyEvent(events.get(0));
|
||||||
Assert.assertEquals(customerInfo, customer.getCustomerInfo());
|
Assert.assertEquals(customerInfo, customer.getCustomerInfo());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.chrisrichardson.eventstore.javaexamples.banking.web;
|
|||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Address;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Address;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
|
||||||
|
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers.CreateCustomerRequest;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -35,7 +36,7 @@ public class CustomersCommandSideServiceIntegrationTest {
|
|||||||
public void shouldCreateCustomer() {
|
public void shouldCreateCustomer() {
|
||||||
CustomerInfo customerInfo = generateCustomerInfo();
|
CustomerInfo customerInfo = generateCustomerInfo();
|
||||||
|
|
||||||
final CustomerResponse customerResponse = restTemplate.postForEntity(baseUrl("/customers"),customerInfo, CustomerResponse.class).getBody();
|
final CustomerResponse customerResponse = restTemplate.postForEntity(baseUrl("/customers"),new CreateCustomerRequest("John", "Doe", customerInfo), CustomerResponse.class).getBody();
|
||||||
final String customerId = customerResponse.getId();
|
final String customerId = customerResponse.getId();
|
||||||
|
|
||||||
Assert.assertNotNull(customerId);
|
Assert.assertNotNull(customerId);
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers;
|
||||||
|
|
||||||
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Main on 09.02.2016.
|
||||||
|
*/
|
||||||
|
public class CreateCustomerRequest {
|
||||||
|
@NotNull
|
||||||
|
private String firstName;
|
||||||
|
@NotNull
|
||||||
|
private String lastName;
|
||||||
|
private CustomerInfo customerInfo;
|
||||||
|
|
||||||
|
public CreateCustomerRequest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateCustomerRequest(String firstName, String lastName, CustomerInfo customerInfo) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
|
this.customerInfo = customerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomerInfo getCustomerInfo() {
|
||||||
|
return customerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerInfo(CustomerInfo customerInfo) {
|
||||||
|
this.customerInfo = customerInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers;
|
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers;
|
||||||
|
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerService;
|
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerService;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
|
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
|
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -24,9 +23,9 @@ public class CustomerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST)
|
@RequestMapping(method = RequestMethod.POST)
|
||||||
public Observable<CustomerResponse> createCustomer(@Validated @RequestBody CustomerInfo request) {
|
public Observable<CustomerResponse> createCustomer(@Validated @RequestBody CreateCustomerRequest request) {
|
||||||
return customerService.createCustomer(request)
|
return customerService.createCustomer(request.getFirstName(), request.getLastName(), request.getCustomerInfo())
|
||||||
.map(entityAndEventInfo -> new CustomerResponse(entityAndEventInfo.getEntityIdentifier().getId(), request));
|
.map(entityAndEventInfo -> new CustomerResponse(entityAndEventInfo.getEntityIdentifier().getId(), request.getCustomerInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{id}/toaccounts", method = RequestMethod.POST)
|
@RequestMapping(value = "/{id}/toaccounts", method = RequestMethod.POST)
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ public class CustomerInfoUpdateService {
|
|||||||
this.mongoTemplate = mongoTemplate;
|
this.mongoTemplate = mongoTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(String id, CustomerInfo customerInfo) {
|
public void create(String id, String firstName, String lastName, CustomerInfo customerInfo) {
|
||||||
try {
|
try {
|
||||||
accountInfoRepository.save(new QuerySideCustomer(id,
|
accountInfoRepository.save(new QuerySideCustomer(id,
|
||||||
"",
|
firstName,
|
||||||
"",
|
lastName,
|
||||||
customerInfo.getEmail(),
|
customerInfo.getEmail(),
|
||||||
customerInfo.getSsn(),
|
customerInfo.getSsn(),
|
||||||
customerInfo.getPhoneNumber(),
|
customerInfo.getPhoneNumber(),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class CustomerQueryWorkflow implements CompoundEventHandler {
|
|||||||
CustomerCreatedEvent event = de.event();
|
CustomerCreatedEvent event = de.event();
|
||||||
String id = de.getEntityIdentifier().getId();
|
String id = de.getEntityIdentifier().getId();
|
||||||
|
|
||||||
customerInfoUpdateService.create(id, event.getCustomerInfo());
|
customerInfoUpdateService.create(id, event.getFirstName(), event.getLastName(), event.getCustomerInfo());
|
||||||
return Observable.just(null);
|
return Observable.just(null);
|
||||||
}
|
}
|
||||||
@EventHandlerMethod
|
@EventHandlerMethod
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class QuerySideCustomerConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CustomerInfoUpdateService customerInfoUpdateService(QuerySideCustomerRepository querySideCustomerRepository) {
|
public CustomerInfoUpdateService customerInfoUpdateService(QuerySideCustomerRepository querySideCustomerRepository, MongoTemplate mongoTemplate) {
|
||||||
return new CustomerInfoUpdateService(querySideCustomerRepository);
|
return new CustomerInfoUpdateService(querySideCustomerRepository, mongoTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.chrisrichardson.eventstore.javaexamples.banking.web;
|
package net.chrisrichardson.eventstore.javaexamples.banking.web;
|
||||||
|
|
||||||
import net.chrisrichardson.eventstore.client.config.EventStoreHttpClientConfiguration;
|
import net.chrisrichardson.eventstore.client.config.EventStoreHttpClientConfiguration;
|
||||||
|
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers.QuerySideCustomerConfiguration;
|
||||||
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
|
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
||||||
@@ -12,7 +13,7 @@ import org.springframework.http.converter.HttpMessageConverter;
|
|||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import({CustomersQuerySideServiceConfiguration.class, EventStoreHttpClientConfiguration.class, CommonSwaggerConfiguration.class})
|
@Import({QuerySideCustomerConfiguration.class, EventStoreHttpClientConfiguration.class, CommonSwaggerConfiguration.class})
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class CustomersQuerySideServiceConfiguration {
|
public class CustomersQuerySideServiceConfiguration {
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public class EndToEndTest {
|
|||||||
BigDecimal finalFromAccountBalance = initialFromAccountBalance.subtract(amountToTransfer);
|
BigDecimal finalFromAccountBalance = initialFromAccountBalance.subtract(amountToTransfer);
|
||||||
BigDecimal finalToAccountBalance = initialToAccountBalance.add(amountToTransfer);
|
BigDecimal finalToAccountBalance = initialToAccountBalance.add(amountToTransfer);
|
||||||
|
|
||||||
final CreateAccountResponse fromAccount = restTemplate.postForEntity(accountsCommandSideBaseUrl("/accounts"), new CreateAccountRequest(initialFromAccountBalance), CreateAccountResponse.class).getBody();
|
final CreateAccountResponse fromAccount = restTemplate.postForEntity(accountsCommandSideBaseUrl("/accounts"), new CreateAccountRequest("00000000-00000000", "My Account", initialFromAccountBalance), CreateAccountResponse.class).getBody();
|
||||||
final String fromAccountId = fromAccount.getAccountId();
|
final String fromAccountId = fromAccount.getAccountId();
|
||||||
|
|
||||||
CreateAccountResponse toAccount = restTemplate.postForEntity(accountsCommandSideBaseUrl("/accounts"), new CreateAccountRequest(initialToAccountBalance), CreateAccountResponse.class).getBody();
|
CreateAccountResponse toAccount = restTemplate.postForEntity(accountsCommandSideBaseUrl("/accounts"), new CreateAccountRequest("00000000-00000000", "My Account", initialToAccountBalance), CreateAccountResponse.class).getBody();
|
||||||
String toAccountId = toAccount.getAccountId();
|
String toAccountId = toAccount.getAccountId();
|
||||||
|
|
||||||
Assert.assertNotNull(fromAccountId);
|
Assert.assertNotNull(fromAccountId);
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ public class BankingWebIntegrationTest {
|
|||||||
BigDecimal finalFromAccountBalance = initialFromAccountBalance.subtract(amountToTransfer);
|
BigDecimal finalFromAccountBalance = initialFromAccountBalance.subtract(amountToTransfer);
|
||||||
BigDecimal finalToAccountBalance = initialToAccountBalance.add(amountToTransfer);
|
BigDecimal finalToAccountBalance = initialToAccountBalance.add(amountToTransfer);
|
||||||
|
|
||||||
final CreateAccountResponse fromAccount = restTemplate.postForEntity(baseUrl("/accounts"), new CreateAccountRequest(initialFromAccountBalance), CreateAccountResponse.class).getBody();
|
final CreateAccountResponse fromAccount = restTemplate.postForEntity(baseUrl("/accounts"), new CreateAccountRequest("00000000-00000000", "My Account", initialFromAccountBalance), CreateAccountResponse.class).getBody();
|
||||||
final String fromAccountId = fromAccount.getAccountId();
|
final String fromAccountId = fromAccount.getAccountId();
|
||||||
|
|
||||||
CreateAccountResponse toAccount = restTemplate.postForEntity(baseUrl("/accounts"), new CreateAccountRequest(initialToAccountBalance), CreateAccountResponse.class).getBody();
|
CreateAccountResponse toAccount = restTemplate.postForEntity(baseUrl("/accounts"), new CreateAccountRequest("00000000-00000000", "My Account", initialToAccountBalance), CreateAccountResponse.class).getBody();
|
||||||
String toAccountId = toAccount.getAccountId();
|
String toAccountId = toAccount.getAccountId();
|
||||||
|
|
||||||
Assert.assertNotNull(fromAccountId);
|
Assert.assertNotNull(fromAccountId);
|
||||||
|
|||||||
@@ -34,80 +34,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/register/step_1": {
|
|
||||||
"post": {
|
|
||||||
"tags": [
|
|
||||||
"auth-controller"
|
|
||||||
],
|
|
||||||
"summary": "doRegisterStep1",
|
|
||||||
"operationId": "doRegisterStep1UsingPOST",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"*/*"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"in": "body",
|
|
||||||
"name": "request",
|
|
||||||
"description": "request",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/RegisterStep1Request"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/CustomerResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Validation error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/register/step_2": {
|
|
||||||
"post": {
|
|
||||||
"tags": [
|
|
||||||
"auth-controller"
|
|
||||||
],
|
|
||||||
"summary": "doRegisterStep1",
|
|
||||||
"operationId": "doRegisterStep1UsingPOST",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"*/*"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"in": "body",
|
|
||||||
"name": "request",
|
|
||||||
"description": "request",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/RegisterStep2Request"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/CustomerResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Validation error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/login": {
|
"/login": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -224,7 +150,7 @@
|
|||||||
"description": "customer",
|
"description": "customer",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/CustomerInfo"
|
"$ref": "#/definitions/CreateCustomerRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -389,8 +315,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"RegisterStep1Request": {
|
"CreateCustomerRequest": {
|
||||||
"required": [ "email" ],
|
"required": [ "email", "ssn", "phoneNumber" ],
|
||||||
"properties": {
|
"properties": {
|
||||||
"firstName": {
|
"firstName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -400,12 +326,7 @@
|
|||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
"RegisterStep2Request": {
|
|
||||||
"required": [ "ssn", "phoneNumber" ],
|
|
||||||
"properties": {
|
|
||||||
"ssn": {
|
"ssn": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -432,6 +353,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Address": {
|
"Address": {
|
||||||
|
"required": [ "street1", "city", "state", "zipCode" ],
|
||||||
"properties": {
|
"properties": {
|
||||||
"street1": {
|
"street1": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
Reference in New Issue
Block a user