FINERACT-1413 : charge-payment-narration
This commit is contained in:
+1
-1
@@ -67,6 +67,6 @@ public class SavingsAccountConstant extends SavingsApiConstants {
|
||||
feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void payCharge(final SavingsAccountCharge savingsAccountCharge, final BigDecimal amountPaid, final LocalDate transactionDate,
|
||||
final DateTimeFormatter formatter, final AppUser user) {
|
||||
public SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final BigDecimal amountPaid,
|
||||
final LocalDate transactionDate, final DateTimeFormatter formatter, final AppUser user) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
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,
|
||||
final AppUser user) {
|
||||
public SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final Money amountPaid,
|
||||
final LocalDate transactionDate, final AppUser user) {
|
||||
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) {
|
||||
SavingsAccountTransaction chargeTransaction = null;
|
||||
|
||||
@@ -2819,6 +2819,7 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
handleChargeTransactions(savingsAccountCharge, chargeTransaction);
|
||||
return chargeTransaction;
|
||||
}
|
||||
|
||||
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() //
|
||||
.withEntityId(savingsAccountCharge.getId()) //
|
||||
.withOfficeId(savingsAccountCharge.savingsAccount().officeId()) //
|
||||
@@ -1261,8 +1268,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
}
|
||||
|
||||
@Transactional
|
||||
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
||||
final DateTimeFormatter formatter, final AppUser user) {
|
||||
private SavingsAccountTransaction payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate,
|
||||
final BigDecimal amountPaid, final DateTimeFormatter formatter, final AppUser user) {
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -1274,7 +1281,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
final Set<Long> existingTransactionIds = new HashSet<>();
|
||||
final Set<Long> existingReversedTransactionIds = new HashSet<>();
|
||||
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
|
||||
account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter, user);
|
||||
SavingsAccountTransaction chargeTransaction = account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter, user);
|
||||
boolean isInterestTransfer = false;
|
||||
LocalDate postInterestOnDate = null;
|
||||
final MathContext mc = MathContext.DECIMAL64;
|
||||
@@ -1296,9 +1303,13 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
account.validateAccountBalanceDoesNotBecomeNegative("." + SavingsAccountTransactionType.PAY_CHARGE.getCode(),
|
||||
depositAccountOnHoldTransactions);
|
||||
|
||||
saveTransactionToGenerateTransactionId(chargeTransaction);
|
||||
|
||||
this.savingAccountRepositoryWrapper.saveAndFlush(account);
|
||||
|
||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
|
||||
|
||||
return chargeTransaction;
|
||||
}
|
||||
|
||||
private void updateExistingTransactionsDetails(SavingsAccount account, Set<Long> existingTransactionIds,
|
||||
|
||||
Reference in New Issue
Block a user