MIFOSX-1256 Charges dropdown to display only matching currency for savings/FD/RD.

This commit is contained in:
Chandrika
2015-04-07 11:25:55 -04:00
parent b1a429e3a2
commit 8e7ae0ac03
8 changed files with 26 additions and 12 deletions
@@ -77,7 +77,7 @@ public interface ChargeReadPlatformService {
* @param feeChargesOnly
* @return
*/
Collection<ChargeData> retrieveSavingsApplicableCharges(boolean feeChargesOnly);
Collection<ChargeData> retrieveSavingsProductApplicableCharges(boolean feeChargesOnly);
/**
* Returns all penalties applicable for savings
@@ -93,5 +93,8 @@ public interface ChargeReadPlatformService {
* @return
*/
Collection<ChargeData> retrieveSavingsProductCharges(Long savingsProductId);
/** Retrieve savings account charges **/
Collection<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsId);
}
@@ -309,7 +309,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
}
@Override
public Collection<ChargeData> retrieveSavingsApplicableCharges(final boolean feeChargesOnly) {
public Collection<ChargeData> retrieveSavingsProductApplicableCharges(final boolean feeChargesOnly) {
final ChargeMapper rm = new ChargeMapper();
String sql = "select " + rm.chargeSchema()
@@ -345,5 +345,17 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
return this.jdbcTemplate.query(sql, rm, new Object[] { savingsProductId });
}
@Override
public Collection<ChargeData> retrieveSavingsAccountApplicableCharges(Long savingsAccountId) {
final ChargeMapper rm = new ChargeMapper();
String sql = "select " + rm.chargeSchema() + " join m_savings_account sa on sa.currency_code = c.currency_code"
+ " where c.is_deleted=0 and c.is_active=1 and c.charge_applies_to_enum=? " + " and sa.account_no = ?";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue(), savingsAccountId });
}
}
@@ -268,7 +268,7 @@ public class FixedDepositProductsApiResource {
// charges
final boolean feeChargesOnly = true;
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
chargeOptions = CollectionUtils.isEmpty(chargeOptions) ? null : chargeOptions;
Collection<ChargeData> penaltyOptions = this.chargeReadPlatformService.retrieveSavingsApplicablePenalties();
@@ -264,7 +264,7 @@ public class RecurringDepositProductsApiResource {
// charges
final boolean feeChargesOnly = true;
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
chargeOptions = CollectionUtils.isEmpty(chargeOptions) ? null : chargeOptions;
Collection<ChargeData> penaltyOptions = this.chargeReadPlatformService.retrieveSavingsApplicablePenalties();
@@ -100,12 +100,11 @@ public class SavingsAccountChargesApiResource {
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveTemplate(@Context final UriInfo uriInfo) {
public String retrieveTemplate(@PathParam("savingsAccountId") final Long savingsAccountId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME);
final boolean feeChargesOnly = false;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsAccountApplicableCharges(savingsAccountId);
final SavingsAccountChargeData savingsAccountChargeTemplate = SavingsAccountChargeData.template(chargeOptions);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
@@ -237,7 +237,7 @@ public class SavingsProductsApiResource {
// charges
final boolean feeChargesOnly = true;
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
chargeOptions = CollectionUtils.isEmpty(chargeOptions) ? null : chargeOptions;
Collection<ChargeData> penaltyOptions = this.chargeReadPlatformService.retrieveSavingsApplicablePenalties();
@@ -358,7 +358,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
final Collection<SavingsAccountChargeData> charges = fromChargesToSavingsCharges(productCharges);
final boolean feeChargesOnly = false;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
Collection<StaffData> fieldOfficerOptions = null;
@@ -434,7 +434,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
final Collection<SavingsAccountChargeData> charges = null;
final boolean feeChargesOnly = true;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
if (depositAccountType.isFixedDeposit()) {
@@ -520,7 +520,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
final Collection<SavingsAccountChargeData> charges = fromChargesToSavingsCharges(productCharges);
final boolean feeChargesOnly = false;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
Collection<StaffData> fieldOfficerOptions = null;
@@ -578,7 +578,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
final Collection<SavingsAccountChargeData> charges = null;
final boolean feeChargesOnly = true;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsApplicableCharges(feeChargesOnly);
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly);
template = SavingsAccountData.withTemplateOptions(template, productOptions, fieldOfficerOptions,
interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions,