Introduction to Processed Transactions
Introduction to Processed Transactions
Processed transactions refer to transactions that have been completed and recorded in the system. The ProcessedTransaction
ProcessedTransaction
Class
ProcessedTransaction
The ProcessedTransaction
The ProcessedTransaction
HBankDataAccess
public class ProcessedTransaction extends HBankDataAccess
{
Writing Transactions
The ProcessedTransaction
The writeDebit
public boolean writeDebit(String accountNumber, String sortcode,
BigDecimal amount2)
{
logger.entering(this.getClass().getName(), WRITE_DEBIT);
sortOutDateTimeTaskString();
openConnection();
logger.log(Level.FINE, () -> ABOUT_TO_INSERT + SQL_INSERT + ">");
try (PreparedStatement stmt = conn.prepareStatement(SQL_INSERT);)
{
stmt.setString(1, PROCTRAN.PROC_TRAN_VALID);
stmt.setString(2, sortcode);
stmt.setString(3,
String.format("%08d", Integer.parseInt(accountNumber)));
stmt.setString(4, dateString);
stmt.setString(5, timeString);
stmt.setString(6, taskRef);
stmt.setString(7, PROCTRAN.PROC_TY_DEBIT);
stmt.setString(8, "INTERNET WTHDRW");
The writeCredit
BigDecimal amount2)
{
logger.entering(this.getClass().getName(), WRITE_CREDIT, false);
sortOutDateTimeTaskString();
openConnection();
logger.log(Level.FINE, () -> ABOUT_TO_INSERT + SQL_INSERT + ">");
try (PreparedStatement stmt = conn.prepareStatement(SQL_INSERT);)
{
stmt.setString(1, PROCTRAN.PROC_TRAN_VALID);
stmt.setString(2, sortcode);
stmt.setString(3,
String.format("%08d", Integer.parseInt(accountNumber)));
stmt.setString(4, dateString);
stmt.setString(5, timeString);
stmt.setString(6, taskRef);
stmt.setString(7, PROCTRAN.PROC_TY_CREDIT);
stmt.setString(8, "INTERNET RECVED");
stmt.setBigDecimal(9, amount2);
stmt.executeUpdate();
The writeTransferLocal
public boolean writeTransferLocal(String sortCode2, String accountNumber2,
BigDecimal amount2, String targetAccountNumber2)
{
logger.entering(this.getClass().getName(), WRITE_TRANSFER_LOCAL);
sortOutDateTimeTaskString();
String transferDescription = "";
transferDescription = transferDescription
+ PROCTRAN.PROC_TRAN_DESC_XFR_FLAG;
transferDescription = transferDescription.concat(" ");
transferDescription = transferDescription
.concat(padSortCode(Integer.parseInt(sortCode2)));
transferDescription = transferDescription.concat(
padAccountNumber(Integer.parseInt(targetAccountNumber2)));
openConnection();
logger.log(Level.FINE, () -> ABOUT_TO_INSERT + SQL_INSERT + ">");
Retrieving Transactions
The ProcessedTransaction
The getProcessedTransactions
public ProcessedTransaction[] getProcessedTransactions(int sortCode,
Integer limit, Integer offset)
{
logger.entering(this.getClass().getName(), GET_PROCESSED_TRANSACTIONS);
ProcessedTransaction[] temp = new ProcessedTransaction[limit];
this.offset = offset.intValue();
this.limit = limit.intValue();
StringBuilder myStringBuilder = new StringBuilder();
for (int i = Integer.toString(sortCode).length(); i < SORT_CODE_LENGTH; i++)
{
myStringBuilder.append('0');
}
myStringBuilder.append(Integer.toString(sortCode));
String sortCodeString = myStringBuilder.toString();
openConnection();
Processing Transfer Records
The processTransferRecord
The processTransferRecord
private ProcessedTransaction processTransferRecord(
ProcessedTransaction processedTransaction)
{
// If we're a "Transfer between accounts" record, set flags
// appropriately
if (processedTransaction.getType().compareTo("TFR") == 0)
{
String targetSortcodeInRecord = processedTransaction
.getDescription().substring(26, 32);
String targetAccountInRecord = processedTransaction.getDescription()
.substring(32, 40);
processedTransaction.setTargetAccountNumber(targetAccountInRecord);
processedTransaction.setTargetSortcode(targetSortcodeInRecord);
processedTransaction.setTransfer(true);
}
return processedTransaction;
}
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human