update description field for office transactions

This commit is contained in:
John Woodlock
2012-07-27 13:41:48 +10:00
parent aba29ae88c
commit ef12c864ab
2 changed files with 5 additions and 4 deletions
@@ -54,21 +54,22 @@ public class OfficeTransaction extends AbstractAuditableCustom<AppUser, Long> {
this.transactionDate = null; this.transactionDate = null;
} }
public static OfficeTransaction create(Office fromOffice, Office toOffice, LocalDate transactionLocalDate, Money amount) { public static OfficeTransaction create(Office fromOffice, Office toOffice, LocalDate transactionLocalDate, Money amount, String description) {
Date transactionDate = null; Date transactionDate = null;
if (transactionLocalDate != null) { if (transactionLocalDate != null) {
transactionDate = transactionLocalDate.toDate(); transactionDate = transactionLocalDate.toDate();
} }
return new OfficeTransaction(fromOffice, toOffice, transactionDate, amount); return new OfficeTransaction(fromOffice, toOffice, transactionDate, amount, description);
} }
private OfficeTransaction(final Office fromOffice,final Office toOffice, final Date transactionDate, final Money amount) { private OfficeTransaction(final Office fromOffice,final Office toOffice, final Date transactionDate, final Money amount, String description) {
this.from = fromOffice; this.from = fromOffice;
this.to = toOffice; this.to = toOffice;
this.transactionDate = transactionDate; this.transactionDate = transactionDate;
this.currency = amount.getCurrency(); this.currency = amount.getCurrency();
this.transactionAmount = amount.getAmount(); this.transactionAmount = amount.getAmount();
this.description = description;
} }
} }
@@ -131,7 +131,7 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
MonetaryCurrency currency = new MonetaryCurrency(appCurrency.getCode(), appCurrency.getDecimalPlaces()); MonetaryCurrency currency = new MonetaryCurrency(appCurrency.getCode(), appCurrency.getDecimalPlaces());
Money amount = Money.of(currency, command.getTransactionAmount()); Money amount = Money.of(currency, command.getTransactionAmount());
OfficeTransaction entity = OfficeTransaction.create(fromOffice, toOffice, command.getTransactionDate(), amount); OfficeTransaction entity = OfficeTransaction.create(fromOffice, toOffice, command.getTransactionDate(), amount, command.getDescription());
this.officeMonetaryTransferRepository.save(entity); this.officeMonetaryTransferRepository.save(entity);