Exploring Customer Services Controllers
Overview of Customer Services Controllers
Controllers in the Customer Services Interface are responsible for handling HTTP requests and mapping them to the appropriate service methods. They manage the flow of data between the model and the view, ensuring that user inputs are processed and the correct responses are generated.
WebController
Class
WebController
The WebController
The showCreateAccForm
// 4. Create an account
@GetMapping("/createacc")
public String showCreateAccForm(CreateAccountForm createAccForm,
Model model)
{
model.addAttribute(ACCOUNT_TYPES, AccountType.values());
return CREATE_ACCOUNT_FORM;
}
Handling Form Submissions
The processCreateAcc
The processCreateAcc
@PostMapping("/createacc")
public String processCreateAcc(@Valid CreateAccountForm createAccForm,
BindingResult bindingResult, Model model)
throws JsonProcessingException
{
if (bindingResult.hasErrors())
{
model.addAttribute(ACCOUNT_TYPES, AccountType.values());
return CREATE_ACCOUNT_FORM;
}
CreateAccountJson transferjson = new CreateAccountJson(createAccForm);
// Serialise the object to JSON
log.info("{}", transferjson);
String jsonString = new ObjectMapper().writeValueAsString(transferjson);
log.info(jsonString);
WebClient client = WebClient
.create(ConnectionInfo.getAddressAndPort() + "/creacc/insert");
try
Customer Services Interface Endpoints
The Customer Services Interface includes several endpoints for handling different operations related to customer and account management.
/enqacct
The /enqacct
The showAcctForm
@GetMapping("/enqacct")
public String showAcctForm(AccountEnquiryForm accountEnquiryForm)
{
// String relates to the page template found in
// /src/main/resources/templates
return ACCOUNT_ENQUIRY_FORM;
}
/createacc
The /createacc
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human