FINERACT-1413 : charge-payment-narration
This commit is contained in:
+1
-1
@@ -67,6 +67,6 @@ public class SavingsAccountConstant extends SavingsApiConstants {
|
|||||||
feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName));
|
feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName));
|
||||||
|
|
||||||
protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
|
Arrays.asList(amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName, noteParamName));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-7
@@ -2708,8 +2708,8 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void payCharge(final SavingsAccountCharge savingsAccountCharge, final BigDecimal amountPaid, final LocalDate transactionDate,
|
public SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final BigDecimal amountPaid,
|
||||||
final DateTimeFormatter formatter, final AppUser user) {
|
final LocalDate transactionDate, final DateTimeFormatter formatter, final AppUser user) {
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||||
@@ -2797,16 +2797,16 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.payCharge(savingsAccountCharge, chargePaid, transactionDate, user);
|
return this.payCharge(savingsAccountCharge, chargePaid, transactionDate, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void payCharge(final SavingsAccountCharge savingsAccountCharge, final Money amountPaid, final LocalDate transactionDate,
|
public SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final Money amountPaid,
|
||||||
final AppUser user) {
|
final LocalDate transactionDate, final AppUser user) {
|
||||||
savingsAccountCharge.pay(getCurrency(), amountPaid);
|
savingsAccountCharge.pay(getCurrency(), amountPaid);
|
||||||
handlePayChargeTransactions(savingsAccountCharge, amountPaid, transactionDate, user);
|
return handlePayChargeTransactions(savingsAccountCharge, amountPaid, transactionDate, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handlePayChargeTransactions(SavingsAccountCharge savingsAccountCharge, Money transactionAmount,
|
private SavingsAccountTransaction handlePayChargeTransactions(SavingsAccountCharge savingsAccountCharge, Money transactionAmount,
|
||||||
final LocalDate transactionDate, final AppUser user) {
|
final LocalDate transactionDate, final AppUser user) {
|
||||||
SavingsAccountTransaction chargeTransaction = null;
|
SavingsAccountTransaction chargeTransaction = null;
|
||||||
|
|
||||||
@@ -2819,6 +2819,7 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleChargeTransactions(savingsAccountCharge, chargeTransaction);
|
handleChargeTransactions(savingsAccountCharge, chargeTransaction);
|
||||||
|
return chargeTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleWaiverChargeTransactions(SavingsAccountCharge savingsAccountCharge, Money transactionAmount, AppUser user) {
|
private void handleWaiverChargeTransactions(SavingsAccountCharge savingsAccountCharge, Money transactionAmount, AppUser user) {
|
||||||
|
|||||||
+15
-4
@@ -1232,7 +1232,14 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.payCharge(savingsAccountCharge, transactionDate, amountPaid, fmt, user);
|
SavingsAccountTransaction chargeTransaction = this.payCharge(savingsAccountCharge, transactionDate, amountPaid, fmt, user);
|
||||||
|
|
||||||
|
final String noteText = command.stringValueOfParameterNamed("note");
|
||||||
|
if (StringUtils.isNotBlank(noteText)) {
|
||||||
|
final Note note = Note.savingsTransactionNote(savingsAccountCharge.savingsAccount(), chargeTransaction, noteText);
|
||||||
|
this.noteRepository.save(note);
|
||||||
|
}
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
return new CommandProcessingResultBuilder() //
|
||||||
.withEntityId(savingsAccountCharge.getId()) //
|
.withEntityId(savingsAccountCharge.getId()) //
|
||||||
.withOfficeId(savingsAccountCharge.savingsAccount().officeId()) //
|
.withOfficeId(savingsAccountCharge.savingsAccount().officeId()) //
|
||||||
@@ -1261,8 +1268,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
private SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate,
|
||||||
final DateTimeFormatter formatter, final AppUser user) {
|
final BigDecimal amountPaid, final DateTimeFormatter formatter, final AppUser user) {
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -1274,7 +1281,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
final Set<Long> existingTransactionIds = new HashSet<>();
|
final Set<Long> existingTransactionIds = new HashSet<>();
|
||||||
final Set<Long> existingReversedTransactionIds = new HashSet<>();
|
final Set<Long> existingReversedTransactionIds = new HashSet<>();
|
||||||
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
|
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
|
||||||
account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter, user);
|
SavingsAccountTransaction chargeTransaction = account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter, user);
|
||||||
boolean isInterestTransfer = false;
|
boolean isInterestTransfer = false;
|
||||||
LocalDate postInterestOnDate = null;
|
LocalDate postInterestOnDate = null;
|
||||||
final MathContext mc = MathContext.DECIMAL64;
|
final MathContext mc = MathContext.DECIMAL64;
|
||||||
@@ -1296,9 +1303,13 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
account.validateAccountBalanceDoesNotBecomeNegative("." + SavingsAccountTransactionType.PAY_CHARGE.getCode(),
|
account.validateAccountBalanceDoesNotBecomeNegative("." + SavingsAccountTransactionType.PAY_CHARGE.getCode(),
|
||||||
depositAccountOnHoldTransactions);
|
depositAccountOnHoldTransactions);
|
||||||
|
|
||||||
|
saveTransactionToGenerateTransactionId(chargeTransaction);
|
||||||
|
|
||||||
this.savingAccountRepositoryWrapper.saveAndFlush(account);
|
this.savingAccountRepositoryWrapper.saveAndFlush(account);
|
||||||
|
|
||||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
|
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
|
||||||
|
|
||||||
|
return chargeTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateExistingTransactionsDetails(SavingsAccount account, Set<Long> existingTransactionIds,
|
private void updateExistingTransactionsDetails(SavingsAccount account, Set<Long> existingTransactionIds,
|
||||||
|
|||||||
Reference in New Issue
Block a user