FINERACT-174
This commit is contained in:
+23
@@ -103,6 +103,29 @@ public class ProductToGLAccountMappingHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createOrmergeProductToAccountMappingChanges(final JsonElement element, final String paramName, final Long productId,
|
||||||
|
final int accountTypeId, final Map<String, Object> changes,
|
||||||
|
final GLAccountType expectedAccountType, final PortfolioProductType portfolioProductType) {
|
||||||
|
final Long accountId = this.fromApiJsonHelper.extractLongNamed(paramName, element);
|
||||||
|
|
||||||
|
// get the existing product
|
||||||
|
if (accountId != null) {
|
||||||
|
final ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(productId,
|
||||||
|
portfolioProductType.getValue(), accountTypeId);
|
||||||
|
if(accountMapping == null) {
|
||||||
|
final GLAccount glAccount = getAccountByIdAndType(paramName, expectedAccountType, accountId);
|
||||||
|
changes.put(paramName, accountId);
|
||||||
|
ProductToGLAccountMapping newAccountMapping = new ProductToGLAccountMapping(glAccount, productId,
|
||||||
|
portfolioProductType.getValue(), accountTypeId) ;
|
||||||
|
this.accountMappingRepository.save(newAccountMapping);
|
||||||
|
}else if (accountMapping.getGlAccount().getId() != accountId) {
|
||||||
|
final GLAccount glAccount = getAccountByIdAndType(paramName, expectedAccountType, accountId);
|
||||||
|
changes.put(paramName, accountId);
|
||||||
|
accountMapping.setGlAccount(glAccount);
|
||||||
|
this.accountMappingRepository.save(accountMapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Saves the payment type to Fund source mappings for a particular
|
* Saves the payment type to Fund source mappings for a particular
|
||||||
* product/product type (also populates the changes array if passed in)
|
* product/product type (also populates the changes array if passed in)
|
||||||
|
|||||||
+8
-2
@@ -98,6 +98,12 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
|||||||
GLAccountType.LIABILITY, PortfolioProductType.SAVING);
|
GLAccountType.LIABILITY, PortfolioProductType.SAVING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createOrmergeSavingsToLiabilityAccountMappingChanges(final JsonElement element, final String paramName, final Long productId,
|
||||||
|
final int accountTypeId, final Map<String, Object> changes) {
|
||||||
|
createOrmergeProductToAccountMappingChanges(element, paramName, productId, accountTypeId, changes,
|
||||||
|
GLAccountType.LIABILITY, PortfolioProductType.SAVING);
|
||||||
|
}
|
||||||
|
|
||||||
/*** Abstractions for payments channel related to savings products ***/
|
/*** Abstractions for payments channel related to savings products ***/
|
||||||
|
|
||||||
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||||
@@ -222,9 +228,9 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
|||||||
mergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
mergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue(),
|
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue(),
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.toString(), changes);
|
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.toString(), changes);
|
||||||
mergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(),
|
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(),
|
||||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.toString(), changes);
|
changes);
|
||||||
break;
|
break;
|
||||||
case ACCRUAL_PERIODIC:
|
case ACCRUAL_PERIODIC:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user