Fix transaction logger implementation & remove unnecessary StringBuilder append

This commit is contained in:
Allink 2023-05-20 20:22:46 +01:00
parent 036ddf3e04
commit aadd5d57aa
No known key found for this signature in database

View File

@ -17,10 +17,9 @@ public class SimpleTransactionLogger implements TransactionLogger
boolean resultSuccess = result.isSuccessful(); boolean resultSuccess = result.isSuccessful();
String resultMessage = result.getMessage(); String resultMessage = result.getMessage();
Transaction transaction = completedTransaction.getTransaction(); EconomicEntity source = completedTransaction.getSource();
EconomicEntity source = transaction.getSource(); EconomicEntity destination = completedTransaction.getDestination();
EconomicEntity destination = transaction.getDestination(); long transactionAmount = completedTransaction.getBalance();
long transactionAmount = transaction.getBalance();
transactionLoggingStatementBuilder.append(resultSuccess ? "Successful" : "Unsuccessful") transactionLoggingStatementBuilder.append(resultSuccess ? "Successful" : "Unsuccessful")
.append(" (") .append(" (")
@ -30,8 +29,7 @@ public class SimpleTransactionLogger implements TransactionLogger
.append(source.getName()) .append(source.getName())
.append(" ") .append(" ")
.append(destination.getName()) .append(destination.getName())
.append(" where the volume of currency transferred was ") .append(" where the volume of currency transferred was $")
.append("$")
.append(transactionAmount) .append(transactionAmount)
.append("."); .append(".");