Skip to main content

Introduction to Account Enquiry

Introduction to Account Enquiry

The Account Enquiry feature in the CICS Bank Sample Application allows users to view detailed information about a specific bank account. This feature is accessible through the Customer Services Interface and involves several components including forms, JSON classes, and controllers.

Account Enquiries in Customer Services Interface

To enquire about an account, navigate to the landing page and click on 'View account details'. This action will direct you to the account enquiry form where you can input the account number.


AccountEnquiryForm Class

The AccountEnquiryForm class captures the account number for which details are being requested. It includes methods to get and set the account number, and to convert the form data to a string representation.

public class AccountEnquiryForm
{



@NotNull
@Size(max = 8)
private String acctNumber;


public AccountEnquiryForm()
{

}


public AccountEnquiryForm(@NotNull @Size(max = 8) String acctNumber)
{
this.acctNumber = acctNumber;
}

AccountEnquiryJson Class

The AccountEnquiryJson class structures the JSON response for an account enquiry. It includes a nested InqaccJson object that holds detailed account information.


The field inqaccCommarea is an instance of InqaccJson and is annotated with @JsonProperty to map the JSON property INQACC_COMMAREA.

	@JsonProperty("INQACC_COMMAREA")
private InqaccJson inqaccCommarea;


The constructor initializes inqaccCommarea with a new instance of InqaccJson.

	public AccountEnquiryJson()
{
inqaccCommarea = new InqaccJson();
}


The toString method provides a string representation of the AccountEnquiryJson object, including the inqaccCommarea field.

	@Override
public String toString()
{
return "AccountEnquiryJson [INQACC_COMMAREA="
+ inqaccCommarea.toString() + "]";
}


The toPrettyString method formats the account enquiry details into a human-readable string, using various utility methods for formatting.

	public String toPrettyString()
{
InqaccJson acctInfo = inqaccCommarea;
String output = "";
output += "Account Number: "
+ OutputFormatUtils.leadingZeroes(8, acctInfo.getInqaccAccno())
+ "\n" + "Customer Number: "
+ OutputFormatUtils.leadingZeroes(10,
acctInfo.getInqaccCustno())
+ "\n" + "Account Type: " + acctInfo.getInqaccAccType() + "\n"
+ "Available Balance: "
+ String.format(FLOAT_FORMAT,
acctInfo.getInqaccAvailableBalance())
+ "\n" + "Actual Balance: "
+ String.format(FLOAT_FORMAT, acctInfo.getInqaccActualBalance())
+ "\n" + "Interest Rate: "
+ String.format(FLOAT_FORMAT, acctInfo.getInqaccInterestRate())
+ "\n" + "Overdraft: " + acctInfo.getInqaccOverdraft() + "\n"
+ "Account Opened: "
+ OutputFormatUtils.date(acctInfo.getInqaccOpened()) + "\n"
+ "Next Statement Date: "

WebController Usage

The WebController class handles the HTTP GET and POST requests for account enquiries. It uses the AccountEnquiryForm to capture user input and process the enquiry.


The showAcctForm method handles the HTTP GET request to display the account enquiry form.

	@GetMapping("/enqacct")
public String showAcctForm(AccountEnquiryForm accountEnquiryForm)
{
// String relates to the page template found in
// /src/main/resources/templates
return ACCOUNT_ENQUIRY_FORM;
}


The returnAcct method handles the HTTP POST request to process the submitted account enquiry form.

	@PostMapping("/enqacct")
public String returnAcct(@Valid AccountEnquiryForm accountEnquiryForm,

 

This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human