Merge pull request #1013 from lingalamadhukar/MIFOSX-1411
MIFOSX-1411 Fix for RD Withdrawal template
This commit is contained in:
+18
-8
@@ -84,15 +84,25 @@ public class RecurringDepositAccountTransactionsApiResource {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME);
|
||||
|
||||
SavingsAccountTransactionData savingsAccount = null;
|
||||
/***
|
||||
* Check @Param commandParam value for deposit or withdrawal
|
||||
*/
|
||||
if (!(is(commandParam, "deposit") || is(commandParam, "withdrawal"))) { throw new UnrecognizedQueryParamException("command",
|
||||
commandParam, new Object[] { "deposit", "withdrawal" }); }
|
||||
|
||||
if (is(commandParam, "deposit")) {
|
||||
savingsAccount = this.depositAccountReadPlatformService
|
||||
.retrieveRecurringAccountDepositTransactionTemplate(recurringDepositAccountId);
|
||||
} else if (is(commandParam, "withdrawal")) {
|
||||
//
|
||||
} else {
|
||||
throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "deposit", "withdrawal" });
|
||||
/***
|
||||
* By default get the deposit template for deposits and withdrawal
|
||||
* transactions
|
||||
*/
|
||||
SavingsAccountTransactionData savingsAccount = this.depositAccountReadPlatformService
|
||||
.retrieveRecurringAccountDepositTransactionTemplate(recurringDepositAccountId);
|
||||
|
||||
/***
|
||||
* Update transaction date and transaction type if transaction type is
|
||||
* withdrawal
|
||||
*/
|
||||
if (is(commandParam, "withdrawal")) {
|
||||
savingsAccount = SavingsAccountTransactionData.withWithDrawalTransactionDetails(savingsAccount);
|
||||
}
|
||||
|
||||
final Collection<CodeValueData> paymentTypeOptions = this.codeValueReadPlatformService
|
||||
|
||||
+17
@@ -10,9 +10,12 @@ import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.infrastructure.codes.data.CodeValueData;
|
||||
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.portfolio.account.data.AccountTransferData;
|
||||
import org.mifosplatform.portfolio.paymentdetail.data.PaymentDetailData;
|
||||
import org.mifosplatform.portfolio.savings.SavingsAccountTransactionType;
|
||||
import org.mifosplatform.portfolio.savings.service.SavingsEnumerations;
|
||||
|
||||
/**
|
||||
* Immutable data object representing a savings account transaction.
|
||||
@@ -83,4 +86,18 @@ public class SavingsAccountTransactionData {
|
||||
this.transfer = transfer;
|
||||
this.paymentTypeOptions = paymentTypeOptions;
|
||||
}
|
||||
|
||||
public static SavingsAccountTransactionData withWithDrawalTransactionDetails(final SavingsAccountTransactionData savingsAccountTransactionData) {
|
||||
|
||||
final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
|
||||
final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations
|
||||
.transactionType(SavingsAccountTransactionType.WITHDRAWAL.getValue());
|
||||
|
||||
return new SavingsAccountTransactionData(savingsAccountTransactionData.id, transactionType,
|
||||
savingsAccountTransactionData.paymentDetailData, savingsAccountTransactionData.accountId,
|
||||
savingsAccountTransactionData.accountNo, currentDate, savingsAccountTransactionData.currency,
|
||||
savingsAccountTransactionData.runningBalance, savingsAccountTransactionData.runningBalance,
|
||||
savingsAccountTransactionData.reversed, savingsAccountTransactionData.transfer,
|
||||
savingsAccountTransactionData.paymentTypeOptions);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1333,6 +1333,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
||||
.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMultiplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("sa.account_balance_derived as runningBalance, ");
|
||||
sqlBuilder
|
||||
.append("mss.duedate as duedate, (mss.deposit_amount - ifnull(mss.deposit_amount_completed_derived,0)) as dueamount ");
|
||||
sqlBuilder.append("from m_savings_account sa ");
|
||||
@@ -1365,7 +1366,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
||||
.transactionType(SavingsAccountTransactionType.DEPOSIT.getValue());
|
||||
final PaymentDetailData paymentDetailData = null;
|
||||
final AccountTransferData transfer = null;
|
||||
final BigDecimal runningBalance = null;
|
||||
final BigDecimal runningBalance = JdbcSupport.getBigDecimalDefaultToNullIfZero(rs, "runningBalance");;
|
||||
return SavingsAccountTransactionData.create(savingsId, transactionType, paymentDetailData, savingsId, accountNo, duedate,
|
||||
currency, dueamount, runningBalance, false, transfer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user