Skip to main content

Overview of UpdateAccountJson

Overview of UpdateAccountJson

The UpdateAccountJson class represents the JSON structure for updating account information. It contains a field updacc, which is an instance of UpdaccJson, representing the account details to be updated. This class includes a constructor that initializes the updacc field using data from an UpdateAccountForm object. Additionally, it provides getter and setter methods for the updacc field, and methods to return string representations of the object.


Constructor

The UpdateAccountJson constructor initializes the updacc field using data from an UpdateAccountForm object. This ensures that the account details are correctly populated when an instance of UpdateAccountJson is created.

	public UpdateAccountJson(UpdateAccountForm updateAccountForm)
{
updacc = new UpdaccJson(updateAccountForm.getCustNumber(),
updateAccountForm.getAcctNumber(),
updateAccountForm.getAcctType(),
updateAccountForm.getAcctInterestRateFloat(),
updateAccountForm.getAcctOpenedDate(),
updateAccountForm.getAcctOverdraftInt(),
updateAccountForm.getAcctLastStatementDate(),
updateAccountForm.getAcctNextStatementDate(),
updateAccountForm.getAcctAvailableBalance(),
updateAccountForm.getAcctActualBalance());
}

Main Functions

The UpdateAccountJson class includes several main functions that retrieve various account details. These functions are essential for accessing the specific attributes of the account that need to be updated.


getCustNumber

The getCustNumber function retrieves the customer number associated with the account.

	public String getCustNumber()
{
return custNumber;
}


getAcctNumber

The getAcctNumber function retrieves the account number.

	public int getAcctNumber()
{
return acctNumber;
}


getAcctType

The getAcctType function retrieves the type of the account.

	public AccountType getAcctType()
{
return acctType;
}


getAcctOverdraftInt

The getAcctOverdraftInt function retrieves the overdraft limit of the account as an integer.

	public int getAcctOverdraftInt()
{
return Integer.parseInt(acctOverdraft);
}


getAcctAvailableBalance

The getAcctAvailableBalance function retrieves the available balance of the account.

	public float getAcctAvailableBalance()
{
return acctAvailableBalance;
}


getAcctActualBalance

The getAcctActualBalance function retrieves the actual balance of the account.

	public float getAcctActualBalance()
{
return acctActualBalance;
}


toString

The toString function returns a string representation of the UpdateAccountForm object.

	@Override
public String toString()
{
return "UpdateAccountForm [acctActualBalance=" + acctActualBalance
+ ", acctAvailableBalance=" + acctAvailableBalance
+ ", acctInterestRate=" + acctInterestRate
+ ", acctLastStatementDate=" + acctLastStatementDate
+ ", acctNextStatementDate=" + acctNextStatementDate
+ ", acctNumber=" + acctNumber + ", acctOpenedDate="
+ acctOpenedDate + ", acctOverdraft=" + acctOverdraft
+ ", acctType=" + acctType + ", custNumber=" + custNumber + "]";
}


toPrettyString

The toPrettyString function formats the account information into a human-readable string. This method is useful for displaying account details in a more readable format.

	public String toPrettyString()
{
UpdaccJson accInfo = updacc;
String output = "";
output += "Account Number: "
+ OutputFormatUtils.leadingZeroes(8, accInfo.getCommAccno())
+ "\n" + "Sort Code: " + accInfo.getCommSortcode() + "\n"
+ "Account Type: " + accInfo.getCommAccountType() + "\n"
+ "Customer Number: "
+ OutputFormatUtils.leadingZeroes(10, accInfo.getCommCustNo())
+ "\n" + "Interest Rate: "
+ String.format(FLOAT_FORMAT, accInfo.getCommInterestRate())
+ "\n" + "Overdraft Limit: " + accInfo.getCommOverdraft() + "\n"
+ "Available Balance: "
+ String.format(FLOAT_FORMAT, accInfo.getCommAvailableBalance())
+ "\n" + "Actual Balance: "
+ String.format(FLOAT_FORMAT, accInfo.getCommActualBalance())
+ "\n" + "Account Opened: "
+ OutputFormatUtils.date(accInfo.getCommOpened()) + "\n"
+ "Last Statement Date: "
+ OutputFormatUtils.date(accInfo.getCommLastStatementDate())

How to Use UpdateAccountJson

To amend account information, click on 'Update account details' from the landing page. The account can then be updated using the 'Update' button on the account. After clicking submit, the page will reload, and you will need to enter the account number again to view the amended record.

 

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