I will give you two files and anwswer in short and precise
Assistant
Of course! Please provide the files or the information they contain, and I'll help you as best as I can.
User
public void calcAvailBalWithoutLimits(BalanceComputationWrapper balanceComputationWrapper)throws FinderException, SCBApplicationException {
code
out = LogWriter.getInstance("BCU","calcAvailBalWithoutLimits");
out.println("Entering into calcAvailBalWithoutLimits");
BigDecimal forwardDr = BigDecimal.ZERO;
BigDecimal forwardCr = BigDecimal.ZERO;
BigDecimal earmarkedDr = BigDecimal.ZERO;
BigDecimal twoInOneLmt = BigDecimal.ZERO;
try {
if (balanceComputationWrapper.availableBalanceWithoutLimits == null) {
if (balanceComputationWrapper.balanceWrapper == null) {
BalanceComputationHelper.getInstance(useRRConnection).getAccountBalanceDetails(balanceComputationWrapper);
}
balanceComputationWrapper.includeForwardDebit = BusinessInfo.getInstance().getIncludeForwardDr();
balanceComputationWrapper.includeForwardCredit = BusinessInfo.getInstance().getIncludeForwardCr();
balanceComputationWrapper.includeEarmarkDebit = BusinessInfo.getInstance().getIncludeEarmarkDr();
// Check the validity of the data prior to the calculation
if (balanceComputationWrapper.balanceWrapper.forwardDr.signum() < 0) {
throw new IllegalArgumentException("Forward Debit cannot be Negative");
}
if (balanceComputationWrapper.balanceWrapper.earmarkedDr.signum() < 0) {
//Changes done for IA Doc 00859
//throw new IllegalArgumentException("Earmarked Debit cannot be negative");
balanceComputationWrapper.balanceWrapper.earmarkedDr=BigDecimal.ZERO;
}
// Assign Default values based on current values and the flags
if (balanceComputationWrapper.balanceWrapper.ledgerBalance == null) {
balanceComputationWrapper.balanceWrapper.ledgerBalance = BigDecimal.ZERO;
}
//add unposted staging ledgerbalance, frwdcr, fwrddr to febal ledger balance - 1548750
out.println("balanceComputationWrapper.accountno/unpostedBalance/unpostedForwardCredit/unpostedForwardDebit in BCU::"+balanceComputationWrapper.accountNo+"/"+balanceComputationWrapper.unpostedBalance
+"/"+balanceComputationWrapper.unpostedForwardCredit+"/"+balanceComputationWrapper.unpostedForwardDebit);
//1229831 - STARTS - SG UAT Issue - Uncleared Effects
//added unposted frwdr transactions - 1584265
forwardDr = (balanceComputationWrapper.includeForwardDebit == 'N') ? forwardDr : balanceComputationWrapper.balanceWrapper.forwardDr.add(balanceComputationWrapper.unpostedForwardDebit) ;
forwardDr = (forwardDr.signum()<0) ? BigDecimal.ZERO:forwardDr;
/*if (balanceComputationWrapper.balanceWrapper.forwardDr == null || balanceComputationWrapper.includeForwardDebit == 'N') {
balanceComputationWrapper.balanceWrapper.forwardDr = BigDecimal.ZERO;
}*/
/*forwardCr = (balanceComputationWrapper.includeForwardCredit == 'N') ? forwardCr : balanceComputationWrapper.balanceWrapper.forwardCr;
forwardCr = (forwardCr.signum()<0) ? BigDecimal.ZERO:forwardCr;*/
forwardCr = (balanceComputationWrapper.includeForwardCredit == 'N') ? forwardCr : balanceComputationWrapper.balanceWrapper.forwardCr.add(balanceComputationWrapper.unpostedForwardCredit);
forwardCr = (forwardCr.signum()<0) ? BigDecimal.ZERO:forwardCr;
/*if (balanceComputationWrapper.balanceWrapper.forwardCr == null || balanceComputationWrapper.balanceWrapper.forwardCr.signum() < 0 || balanceComputationWrapper.includeForwardCredit == 'N') {
balanceComputationWrapper.balanceWrapper.forwardCr = BigDecimal.ZERO;
}*/
/*earmarkedDr = (balanceComputationWrapper.includeEarmarkDebit == 'N')?earmarkedDr:balanceComputationWrapper.balanceWrapper.earmarkedDr;
earmarkedDr = (earmarkedDr.signum()<0) ? BigDecimal.ZERO:earmarkedDr;*/
earmarkedDr = (balanceComputationWrapper.includeEarmarkDebit == 'N')?earmarkedDr:balanceComputationWrapper.balanceWrapper.earmarkedDr;
earmarkedDr = (earmarkedDr.signum()<0) ? BigDecimal.ZERO:earmarkedDr;
/*if (balanceComputationWrapper.balanceWrapper.earmarkedDr == null || balanceComputationWrapper.includeEarmarkDebit == 'N') {
balanceComputationWrapper.balanceWrapper.earmarkedDr = BigDecimal.ZERO;
}*/
}
//changed for FL phase2 - adding unposted values
balanceComputationWrapper.availableBalanceWithoutLimits = (balanceComputationWrapper.balanceWrapper.ledgerBalance.
add(balanceComputationWrapper.unpostedBalance
.add(balanceComputationWrapper.unpostedForwardCredit)
.subtract(balanceComputationWrapper.unpostedForwardDebit)))
.subtract(forwardCr).add(forwardDr).subtract(earmarkedDr);
out.println("availableBalanceWithoutLimits/bcw.bw.fwdCr/fwdCr/bcw.bw.fwdDr/fwdDr/bcw.bw.ermkDr :"+ balanceComputationWrapper.availableBalanceWithoutLimits+"/"+ balanceComputationWrapper.balanceWrapper.forwardCr+"/"+forwardCr+"/"+ balanceComputationWrapper.balanceWrapper.forwardDr+"/"+forwardDr+"/"+balanceComputationWrapper.balanceWrapper.earmarkedDr);
//1229831 - ENDS - SG UAT Issue - Uncleared Effects
//Added by Jagadish for IN 2-in-1
if (balanceComputationWrapper.balanceFromIndicator == 'B') {
if (balanceComputationWrapper.balanceWrapper.eodCrAmount != null) {
balanceComputationWrapper.availableBalanceWithoutLimits = balanceComputationWrapper.availableBalanceWithoutLimits.add(balanceComputationWrapper.balanceWrapper.eodCrAmount);
}
if (balanceComputationWrapper.balanceWrapper.eodDrAmount != null) {
balanceComputationWrapper.availableBalanceWithoutLimits = balanceComputationWrapper.availableBalanceWithoutLimits.subtract(balanceComputationWrapper.balanceWrapper.eodDrAmount);
}
if (balanceComputationWrapper.balanceWrapper.onlineDebitAmt != null) {
balanceComputationWrapper.availableBalanceWithoutLimits = balanceComputationWrapper.availableBalanceWithoutLimits.subtract(balanceComputationWrapper.balanceWrapper.onlineDebitAmt);
}
}
if (balanceComputationWrapper.balanceFromIndicator == 'F') {
if (balanceComputationWrapper.balanceWrapper.eodDebitAmt != null) {
balanceComputationWrapper.availableBalanceWithoutLimits = balanceComputationWrapper.availableBalanceWithoutLimits.subtract(balanceComputationWrapper.balanceWrapper.eodDebitAmt);
}
}
balanceComputationWrapper.availableBalanceWithOutTwoInOneLimit = balanceComputationWrapper.availableBalanceWithoutLimits;
balanceComputationWrapper.balanceWrapper.availableBalanceWithOutTwoInOneLimit = balanceComputationWrapper.availableBalanceWithOutTwoInOneLimit;
if (includeTwoInOne) {
twoInOneLmt = balanceComputationWrapper.balanceWrapper.twoInOneBalance != null ? balanceComputationWrapper.balanceWrapper.twoInOneBalance : BigDecimal.ZERO;
twoInOneLmt = (twoInOneLmt.signum() < 0) ? BigDecimal.ZERO : twoInOneLmt;
balanceComputationWrapper.availableBalanceWithoutLimits = balanceComputationWrapper.availableBalanceWithoutLimits.add(twoInOneLmt);
}
//Ends here
Assistant
The provided Java method calcAvailBalWithoutLimits calculates the available balance without limits for a given BalanceComputationWrapper object. Here's a concise summary of its functionality:
Initialization: Initializes variables for forward debits, forward credits, earmarked debits, and a two-in-one limit, all set to zero initially.
Data Retrieval: If availableBalanceWithoutLimits is null, it retrieves account balance details using BalanceComputationHelper if balanceWrapper is also null.
Flags and Validations:
Retrieves flags for including forward debits, forward credits, and earmarked debits.
Validates that forward debits and earmarked debits are non-negative, setting earmarked debits to zero if negative.
Balance Calculations:
Computes forward debits and credits, adjusting for unposted transactions and ensuring non-negative values.
Calculates the available balance by adjusting the ledger balance with forward credits, forward debits, earmarked debits, and unposted values.
Adjustments for Balance Indicators:
Adjusts the available balance based on end-of-day credit and debit amounts, and online debit amounts, depending on the balanceFromIndicator.
Two-in-One Limit:
If applicable, adds the two-in-one limit to the available balance, ensuring it's non-negative.
Logging: Outputs logs for debugging and tracking the computation process.
Overall, the method ensures accurate computation of available balances by considering various balance components and conditions.
User
okay a little bit technical with proper names
Assistant
Certainly! Here's a more technical breakdown of the calcAvailBalWithoutLimits method with proper terminology:
Initialization:
Initializes BigDecimal variables (forwardDr, forwardCr, earmarkedDr, twoInOneLmt) to zero. These are used to store intermediate balance components.
Data Retrieval:
Checks if availableBalanceWithoutLimits in balanceComputationWrapper is null. If so, it retrieves account balance details using BalanceComputationHelper if balanceWrapper is also null.
Configuration Flags:
Retrieves flags from BusinessInfo to determine whether to include forward debits (includeForwardDebit), forward credits (includeForwardCredit), and earmarked debits (includeEarmarkDebit) in the calculation.
Validation:
Ensures forwardDr in balanceWrapper is non-negative. Throws an IllegalArgumentException if negative.
Ensures earmarkedDr is non-negative, resetting it to zero if negative.
Balance Calculation:
Computes forwardDr and forwardCr by adding unposted forward debits and credits respectively, based on the inclusion flags. Ensures non-negative values.
Computes earmarkedDr based on its inclusion flag, ensuring it's non-negative.
Calculates availableBalanceWithoutLimits by adjusting the ledgerBalance with unposted balances, forward credits, forward debits, and earmarked debits.
Balance Indicator Adjustments:
If balanceFromIndicator is 'B', adjusts the balance with end-of-day credit (eodCrAmount) and debit (eodDrAmount) amounts, and online debit amounts (onlineDebitAmt).
If balanceFromIndicator is 'F', adjusts the balance with end-of-day debit amounts (eodDebitAmt).
Two-in-One Limit:
If includeTwoInOne is true, adds twoInOneBalance to the available balance, ensuring it's non-negative.
Logging:
Uses LogWriter to output detailed logs for tracking the balance computation process, including intermediate values and final results.
This method ensures the accurate computation of available balances by considering various balance components, inclusion flags, and adjusting for specific conditions like unposted transactions and two-in-one limits.
User
show it in structure visually good
Assistant
To visually structure the calcAvailBalWithoutLimits method, I'll outline the flow and key components in a hierarchical format. This layout will help you understand the logical sequence and dependencies within the method.
This structure provides a clear visual representation of the method's logic, showing how it processes balance data, applies conditions, and computes the final available balance without limits.
User
i meant use variable names and all
Assistant
Certainly! Here's a structured breakdown of the calcAvailBalWithoutLimits method using the actual variable names and reflecting the logic flow:
code
User
balanceFromIndicator = 'F'
Assistant
In the context of the calcAvailBalWithoutLimits method, when balanceFromIndicator is set to 'F', it indicates a specific way of adjusting the available balance. Here's how the method handles this scenario:
Handling balanceFromIndicator = 'F'
Condition Check:
The method checks if balanceFromIndicator is equal to 'F'.
Adjustment for End-of-Day Debit Amount:
If balanceFromIndicator is 'F', the method further checks if balanceComputationWrapper.balanceWrapper.eodDebitAmt is not null.
If it is not null, the method subtracts eodDebitAmt from balanceComputationWrapper.availableBalanceWithoutLimits.
This adjustment is specific to the condition where the balance is being calculated from a particular perspective (indicated by 'F'), which might represent a "final" or "financial" balance state, depending on the business logic context. Here’s how this part is structured in the method:
java
if (balanceComputationWrapper.balanceFromIndicator == 'F') {
if (balanceComputationWrapper.balanceWrapper.eodDebitAmt != null) {
balanceComputationWrapper.availableBalanceWithoutLimits =
balanceComputationWrapper.availableBalanceWithoutLimits.subtract(
balanceComputationWrapper.balanceWrapper.eodDebitAmt);
}
}
Visual Structure
Here's how this fits into the overall structure:
code
calcAvailBalWithoutLimits(BalanceComputationWrapper balanceComputationWrapper)
├── ... (other parts of the method)
│
├── Balance Indicator Adjustments
│ ├── If balanceFromIndicator == 'B'
│ │ └── ... (B-specific adjustments)
│ └── If balanceFromIndicator == 'F'
│ └── If balanceComputationWrapper.balanceWrapper.eodDebitAmt != null
│ └── availableBalanceWithoutLimits -= eodDebitAmt
│
└── ... (remaining parts of the method)
In summary, when balanceFromIndicator is 'F', the method adjusts the available balance by subtracting any end-of-day debit amounts, reflecting specific business rules associated with this indicator.
User
show all
Assistant
Certainly! Here's a complete breakdown of the calcAvailBalWithoutLimits method, including all relevant parts and focusing on the handling of balanceFromIndicator, among other key operations:
java
User
I meant the structure you made previously
Assistant
Certainly! Here's the structured breakdown of the calcAvailBalWithoutLimits method using the actual variable names, including how it handles balanceFromIndicator and other key operations:
Sure! Here's a plain language explanation of the balance calculation section:
Forward Debit Calculation:
If the flag to include forward debits is set to 'N', keep forwardDr as zero.
Otherwise, calculate forwardDr by adding the posted forward debit (forwardDr) and any unposted forward debit transactions.
Ensure that forwardDr is not negative; if it is, set it to zero.
Forward Credit Calculation:
If the flag to include forward credits is set to 'N', keep forwardCr as zero.
Otherwise, calculate forwardCr by adding the posted forward credit (forwardCr) and any unposted forward credit transactions.
Ensure that forwardCr is not negative; if it is, set it to zero.
Earmarked Debit Calculation:
If the flag to include earmarked debits is set to 'N', keep earmarkedDr as zero.
Otherwise, use the earmarked debit value as is.
Ensure that earmarkedDr is not negative; if it is, set it to zero.
Available Balance Calculation:
Start with the ledger balance.
Add any unposted balance and unposted forward credits.
Subtract unposted forward debits, forward credits, and earmarked debits.
Add the forward debits.
This process calculates the available balance by adjusting the ledger balance with various posted and unposted transactions, while ensuring all components are non-negative.
Certainly! Here's a summarized and visually structured version of the calcAvailBalWithoutLimits method:
code
calcAvailBalWithoutLimits(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Variables
│ ├── Set all balance components (forwardDr, forwardCr, earmarkedDr, twoInOneLmt) to zero
│
├── Data Retrieval
│ ├── Check if availableBalanceWithoutLimits is null
│ │ └── Retrieve account balance details if balanceWrapper is also null
│
├── Configuration Flags
│ ├── Retrieve flags for including forward debits/credits and earmarked debits
│
├── Validation
│ ├── Ensure forwardDr is non-negative; throw exception if negative
│ ├── Set earmarkedDr to zero if negative
│
├── Balance Calculation
│ ├── Calculate forwardDr and forwardCr, adjusting for unposted transactions
│ ├── Ensure forwardDr and forwardCr are non-negative
│ ├── Calculate earmarkedDr based on inclusion flag
│ ├── Compute availableBalanceWithoutLimits by adjusting ledgerBalance with:
│ │ ├── Unposted balances and transactions
│ │ ├── Forward debits/credits
│ │ └── Earmarked debits
│
├── Balance Indicator Adjustments
│ ├── If balanceFromIndicator is 'B'
│ │ ├── Adjust available balance with eodCrAmount, eodDrAmount, and onlineDebitAmt
│ └── If balanceFromIndicator is 'F'
│ └── Adjust available balance with eodDebitAmt
│
├── Two-in-One Limit Adjustment
│ ├── If includeTwoInOne is true
│ │ ├── Calculate twoInOneLmt
│ │ └── Add twoInOneLmt to availableBalanceWithoutLimits
│
└── Logging
└── Log the intermediate and final calculated balance values
Summary:
Initialization: Set initial balance components to zero.
Data Retrieval: Fetch account details if balances need calculation.
Configuration Flags: Determine which components to include in calculations.
Validation: Ensure all debits are non-negative.
Balance Calculation: Adjust ledger balance with various transactions and components.
Balance Indicator Adjustments: Modify balance based on specific indicators ('B' or 'F').
Two-in-One Limit Adjustment: Optionally add a two-in-one limit to the balance.
Logging: Record the process for debugging and verification.
This visual structure simplifies the understanding of the method's flow and logic.
User
no no exact behaviuor like adding sbrtarating
Assistant
Certainly! Here's a structured breakdown of the calcAvailBalWithoutLimits method, focusing on the exact operations like adding and subtracting:
code
calcAvailBalWithoutLimits(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Variables
│ ├── forwardDr = BigDecimal.ZERO
│ ├── forwardCr = BigDecimal.ZERO
│ ├── earmarkedDr = BigDecimal.ZERO
│ └── twoInOneLmt = BigDecimal.ZERO
│
├── Data Retrieval
│ ├── If availableBalanceWithoutLimits is null
│ │ ├── If balanceWrapper is null
│ │ │ └── Retrieve account balance details
│
├── Configuration Flags
│ ├── Set flags for including forward debits/credits and earmarked debits
│
├── Validation
│ ├── Check forwardDr; throw exception if negative
│ ├── Set earmarkedDr to zero if negative
│
├── Balance Calculation
│ ├── Calculate forwardDr
│ │ ├── Add unpostedForwardDebit if included
│ │ └── Ensure non-negative
│ ├── Calculate forwardCr
│ │ ├── Add unpostedForwardCredit if included
│ │ └── Ensure non-negative
│ ├── Calculate earmarkedDr
│ │ └── Ensure non-negative
│ └── Compute availableBalanceWithoutLimits
│ ├── Start with ledgerBalance
│ ├── Add unpostedBalance
│ ├── Add unpostedForwardCredit
│ ├── Subtract unpostedForwardDebit
│ ├── Subtract forwardCr
│ ├── Add forwardDr
│ └── Subtract earmarkedDr
│
├── Balance Indicator Adjustments
│ ├── If balanceFromIndicator == 'B'
│ │ ├── Add eodCrAmount if not null
│ │ ├── Subtract eodDrAmount if not null
│ │ └── Subtract onlineDebitAmt if not null
│ └── If balanceFromIndicator == 'F'
│ └── Subtract eodDebitAmt if not null
│
├── Two-in-One Limit Adjustment
│ ├── If includeTwoInOne is true
│ │ ├── Calculate twoInOneLmt
│ │ └── Add twoInOneLmt to availableBalanceWithoutLimits
│
└── Logging
└── Log intermediate and final balance values
User
i wont understand as you havent use variable names
Assistant
Certainly! Let's use the actual variable names to show the operations of addition and subtraction within the method:
code
User
use variable name but plain english
Assistant
Certainly! Here's a plain English explanation of the method's operations using the actual variable names:
Method Breakdown
Initialize Variables:
Start with forwardDr, forwardCr, earmarkedDr, and twoInOneLmt, all set to zero.
Data Retrieval:
If availableBalanceWithoutLimits is not yet calculated:
Check if balanceWrapper is missing. If so, fetch account balance details using BalanceComputationHelper.
Configuration Flags:
Set flags to determine if forward debits (includeForwardDebit), forward credits (includeForwardCredit), and earmarked debits (includeEarmarkDebit) should be included in calculations.
Validation:
If forwardDr (forward debit) is negative, throw an error.
If earmarkedDr (earmarked debit) is negative, set it to zero.
Balance Calculation:
Forward Debit Calculation:
If including forward debits, add unpostedForwardDebit to forwardDr.
Ensure forwardDr is non-negative.
Forward Credit Calculation:
If including forward credits, add unpostedForwardCredit to forwardCr.
Ensure forwardCr is non-negative.
Earmarked Debit Calculation:
If including earmarked debits, use the value from earmarkedDr.
Ensure earmarkedDr is non-negative.
Compute Available Balance:
Start with ledgerBalance.
Add unpostedBalance and unpostedForwardCredit.
Subtract unpostedForwardDebit, forwardCr, and earmarkedDr.
Add forwardDr.
Balance Indicator Adjustments:
If balanceFromIndicator is 'B':
Add eodCrAmount if it exists.
Subtract eodDrAmount and onlineDebitAmt if they exist.
If balanceFromIndicator is 'F':
Subtract eodDebitAmt if it exists.
Two-in-One Limit Adjustment:
If includeTwoInOne is true:
Use twoInOneBalance if it exists, otherwise zero.
Ensure twoInOneLmt is non-negative.
Add twoInOneLmt to availableBalanceWithoutLimits.
Logging:
Log the intermediate and final values of the balance for debugging purposes.
This explanation uses the actual variable names while describing the operations in simple terms, making it easier to follow how the method calculates the available balance.
User
show visually
Assistant
Certainly! Here's a visual representation of the method's logic, using the actual variable names and described in plain English:
code
calcAvailBalWithoutLimits(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Variables
│ ├── Set forwardDr = 0
│ ├── Set forwardCr = 0
│ ├── Set earmarkedDr = 0
│ └── Set twoInOneLmt = 0
│
├── Data Retrieval
│ ├── If availableBalanceWithoutLimits is not calculated
│ │ └── If balanceWrapper is missing
│ │ └── Fetch account balance details
│
├── Configuration Flags
│ ├── Set includeForwardDebit flag
│ ├── Set includeForwardCredit flag
│ └── Set includeEarmarkDebit flag
│
├── Validation
│ ├── If forwardDr is negative
│ │ └── Throw error
│ └── If earmarkedDr is negative
│ └── Set earmarkedDr = 0
│
├── Balance Calculation
│ ├── Forward Debit Calculation
│ │ ├── If including forward debits
│ │ │ └── Add unpostedForwardDebit to forwardDr
│ │ └── Ensure forwardDr is non-negative
│ ├── Forward Credit Calculation
│ │ ├── If including forward credits
│ │ │ └── Add unpostedForwardCredit to forwardCr
│ │ └── Ensure forwardCr is non-negative
│ ├── Earmarked Debit Calculation
│ │ ├── If including earmarked debits
│ │ │ └── Use earmarkedDr from balanceWrapper
│ │ └── Ensure earmarkedDr is non-negative
│ └── Compute Available Balance
│ ├── Start with ledgerBalance
│ ├── Add unpostedBalance
│ ├── Add unpostedForwardCredit
│ ├── Subtract unpostedForwardDebit
│ ├── Subtract forwardCr
│ ├── Add forwardDr
│ └── Subtract earmarkedDr
│
├── Balance Indicator Adjustments
│ ├── If balanceFromIndicator is 'B'
│ │ ├── Add eodCrAmount if exists
│ │ ├── Subtract eodDrAmount if exists
│ │ └── Subtract onlineDebitAmt if exists
│ └── If balanceFromIndicator is 'F'
│ └── Subtract eodDebitAmt if exists
│
├── Two-in-One Limit Adjustment
│ ├── If includeTwoInOne is true
│ │ ├── Use twoInOneBalance if exists, otherwise 0
│ │ ├── Ensure twoInOneLmt is non-negative
│ │ └── Add twoInOneLmt to availableBalanceWithoutLimits
│
└── Logging
└── Log intermediate and final balance values
Certainly! Here's a visual structure of the getAccountcreditSharedBalance method using the actual variable names to illustrate its flow and logic:
code
getAccountcreditSharedBalance(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Logging
│ └── Log entry into the method
│
├── System Wrapper Initialization
│ ├── If sysWrap is null
│ │ ├── Retrieve SystemCache instance
│ │ └── Set sysWrap from SystemCache
│
├── Pool Reference Number Retrieval
│ ├── If balanceComputationWrapper is not null
│ │ └── If poolRefNo is null
│ │ └── Retrieve pool reference number for credit balance sharing
│
├── Account Level Credit Sharing
│ ├── Retrieve duplicateRecord flag
│ ├── If accountLevelCreditSharingCap is true
│ │ └── And (accountNo is not null)
│ │ └── And (not a duplicate record or innerLimitWrapper is null)
│ │ └── Calculate available balance with corporate limit lien
│
├── Credit Sharing with Pool Reference
│ ├── If poolRefNo is not null
│ │ ├── If withLimitFlag is 'Y'
│ │ │ ├── Log start of wealth OD balance computation
│ │ │ ├── If creditsharingWrapper is null
│ │ │ │ └── Retrieve credit sharing details with limit
│ │ │ ├── If creditsharingWrapper is not null
│ │ │ │ ├── Check facility expiry status
│ │ │ │ │ ├── Determine argDate based on balanceFromIndicator
│ │ │ │ │ ├── Compare facilityExpiryDate with argDate
│ │ │ │ │ └── Set facilityExpiryStatus to expired or active
│ │ │ │ ├── Calculate clear balance for each credit sharing detail
│ │ │ │ └── Compute wealth OD balance
│ │ │ └── Log end of wealth OD balance computation
│ │ └── Else (without limit flag)
│ │ ├── If accountLevelCreditSharingCap is false
│ │ │ ├── Calculate net pool balance in pool
│ │ │ └── Calculate available shared balance in pool
│ │ └── Else
│ │ ├── Log else part of accountLevelCreditSharingCap
│ │ ├── Calculate net pool balance with child credit cap
│ │ └── Calculate available shared balance in pool CN
│
├── No Pool Reference Handling
│ ├── If poolRefNo is null
│ │ └── Set availableBalanceWithCreditBalanceShared to availableBalanceWithoutLimits
│
└── Final Logging
└── Log end of method with availableBalanceWithCreditBalanceShared
User
okay what arer the function calls major not wrapper funtion
Assistant
In the getAccountcreditSharedBalance method, the major function calls (excluding simple wrapper or getter/setter operations) are as follows:
This function is called to calculate the available balance considering corporate limit liens if the account level credit sharing cap is enabled and certain conditions are met.
This function calculates the available net pool balance within a pool when account-level credit sharing is not capped.
calcAvailSharedBalanceInPoolNew(balanceComputationWrapper) or calcAvailSharedBalanceInPool(balanceComputationWrapper):
These functions calculate the available shared balance in a pool, with the choice between them depending on whether CBR (Credit Balance Reporting) is enabled.
:
User
use method names alwasy and if poosible say the logic in english
Assistant
Certainly! Here's a breakdown of the major method calls within getAccountcreditSharedBalance, along with a plain English explanation of their logic:
Logic: This method retrieves the pool reference number needed for handling credit balance sharing if it's not already present in the balanceComputationWrapper.
Logic: This method calculates the available balance while considering any corporate limit liens. It's used when account-level credit sharing is enabled and certain conditions are met, such as when there are no duplicate records.
Logic: This method fetches the details of credit sharing arrangements that have limits, which are necessary for calculating shared balances when limits are involved.
Logic: This method compares the expiry date of a credit facility with a given date (argDate) to determine whether the facility is expired or still active.
Logic: This method applies specific rules to compute the wealth overdraft balance, incorporating various factors and conditions defined in the business logic.
Logic: This method calculates the net available balance in a pool of accounts, used when account-level credit sharing is not capped.
:
User
show structure wise
Assistant
Certainly! Here's a structured breakdown of the getAccountcreditSharedBalance method, focusing on the major method calls and their logic in plain English:
code
User
out = LogWriter.getInstance("BalanceComputationUtility_vh","calcAvailSharedBalanceInPoolNew");
java.util.HashMap convertAmountHash = null;
String baseCurr = null;
BigDecimal availableCreditBalanceToBeShared = null;
BigDecimal addAvailablebalancewithUtilCapNew = null;
try {
// Commented as part Tranch1 FS 12001609_All_FSD_eBBS_Unity_Hair Cut Formula Change_1.2.docx
/if(!balanceComputationWrapper.creditsharingWrapper.poolCurrCode.equalsIgnoreCase(balanceComputationWrapper.currencyCode)){
baseCurr=BalanceComputationHelper.getInstance(useRRConnection).strBaseCurrency;
convertAmountHash = RatesCalculationUtility.convertAtMidRate(balanceComputationWrapper.creditsharingWrapper.poolCurrCode,balanceComputationWrapper.currencyCode,balanceComputationWrapper.netPoolBalance, 'S',baseCurr);
String convertedAmt = (convertAmountHash.get("CONVERTEDAMOUNT") != null) ? (convertAmountHash.get("CONVERTEDAMOUNT")).toString(): "0.00";
balanceComputationWrapper.netPoolBalance = new BigDecimal(convertedAmt);
}/
out.println("Net Pool Balance in Account currency :"+balanceComputationWrapper.netPoolBalance+"AccountNo:"+balanceComputationWrapper.accountNo+"currencycode:"+balanceComputationWrapper.currencyCode);
for(int i=0; i<balanceComputationWrapper.creditsharingWrapper.creditBalanceSharingDetailWrapper.length; i++) {
code
Assistant
Here's a structured breakdown of the calcAvailSharedBalanceInPoolNew method, focusing on its logic and operations in plain English, using the actual variable names:
code
calcAvailSharedBalanceInPoolNew(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Logging
│ └── Log entry into the method
│
├── Currency Conversion (Commented Out)
│ ├── Check if pool currency differs from account currency
│ │ └── Convert net pool balance to account currency using mid-rate
│ └── Log net pool balance in account currency
│
├── Iterate Over Credit Balance Sharing Details
│ ├── For each creditBalanceSharingDetailWrapper in creditsharingWrapper
│ │ ├── Check if account and currency codes match
│ │ │ └── Initialize addAvailablebalancewithUtilCapNew to zero
│ │ └── Log details of the current credit balance sharing detail
│ │
│ ├── Determine Available Credit Balance to be Shared
│ │ ├── Set availableCreditBalanceToBeShared to netPoolBalance
│ │ ├── Check if netPoolBalance is positive
│ │ │ └── Based on utilisationCapOn:
│ │ │ ├── If 'A' (Absolute):
│ │ │ │ ├── Add accountAvailableBalance and utilisationCap
│ │ │ │ └── Set availableCreditBalanceToBeShared to the minimum of netPoolBalance and this sum
│ │ │ └── If 'P' (Percentage):
│ │ │ ├── Calculate cap as a percentage of netPoolBalance
│ │ │ ├── Add accountAvailableBalance and this calculated cap
│ │ │ └── Set availableCreditBalanceToBeShared to the minimum of netPoolBalance and this sum
│ │ └── Log the calculated availableCreditBalanceToBeShared
│
├── Finalize Shared Balance
│ ├── Set availableBalanceWithCreditBalanceShared in balanceComputationWrapper
│ └── Log the final available balance for the account
User
what are the main funtions being called other than wrapper
Assistant
In the calcAvailSharedBalanceInPoolNew method, the main functions being called, excluding simple wrapper or getter/setter operations, are:
Purpose: Initializes the logging instance for recording the method's operations and debugging information.
out.println(...):
Purpose: Logs various messages throughout the method to provide information about the current state and values of variables. This is used extensively for debugging and tracking the flow of execution.
Purpose: Converts the net pool balance from the pool currency to the account currency using a mid-rate conversion. Although this call is currently commented out, it indicates a previous requirement for currency conversion in the logic.
BigDecimal.min(...):
Purpose: Compares two BigDecimal values and returns the smaller one. This is used to ensure that the available credit balance to be shared does not exceed the net pool balance or the calculated cap.
These functions are key to the method's operation, handling logging, potential currency conversion, and balance calculations. The main computational logic is implemented directly within the method, particularly in determining the available credit balance to be shared based on utilization caps.
User
//KEYSTONEHK-360576 - Start
private static final String SELECT_REL_BASED_NEWFUND = "EBQRY06026SY";
private static final String SELECT_DAYWISE_NEWFUNDBALANCE_SUM = "EBQRY06027SY";
private static final String SELECT_HOLIDAY_LIST = "EBQRY06028SY";
//KEYSTONEHK-360576 - End
code
Assistant
The NewFundUtility class includes a constructor and a method validateNewFundDeposit. Here's a structured breakdown of the validateNewFundDeposit method, focusing on the main function calls and their logic in plain English:
NewFundUtility Constructor
Initialization:
Initializes logging for the utility.
Sets up various entity homes using DAO factories to interact with different data entities related to accounts, relationships, and new fund promotions.
validateNewFundDeposit Method
code
validateNewFundDeposit(MMKDealsWrapper mMKDealsWrapper, Vector errVector, List<String> newFundErrorCodeList)
├── Initialize Logging
│ └── Log entry into the method
│
├── Initial Setup
│ ├── Initialize variables for account and relationship entities
│ ├── Check if newFundErrorCodeList is null; initialize if necessary
│
├── Retrieve Account and Relationship Information
│ ├── Find account using accountMasterEntityHome
│ ├── Get primary relationship from account
│ ├── Find relationship using relEntityHome
│ ├── Retrieve account relationship opening dates
│ └── Determine customer type (ETB or NTB)
│
├── Promotion Category Validation
│ ├── Retrieve system date
│ ├── Find promotion category using newFundPromotionCategoryEntityHome
│ ├── Validate start and end dates of promotion category
│ │ ├── If start date is in the future, add error and return false
│ │ └── If end date is in the past, add error and return false
│ ├── Check if total available quota is exceeded
│ ├── Validate customer eligibility for promotion category
│ │ └── If not eligible, add error and return false
│
├── Benefit Mapping Validation
│ ├── Retrieve benefit mapping details based on deal type
│ ├── Iterate over benefit mappings
│ │ ├── Check customer eligibility for deal type
│ │ ├── Validate segment code and channel ID
│ │ ├── Check total available new fund against deal amount
│ │ │ ├── If sufficient, return true
│ │ │ └── If insufficient, add error and return false
│ │ └── Handle cases for different fund types
│
├── Exception Handling
│ ├── Catch FinderException
│ │ └── Log and return false for mapping issues
│ └── Catch general Exception
│ └── Log error
│
├── Final Validation
│ ├── Check if segment code is repeated
│ │ ├── If true, return true
│ │ └── Else, return false
│
└── Logging
└── Log method end
This structured representation uses the actual variable names from the code to show the logical flow and dependencies within the method, helping to understand how the available balance is calculated.
Initialization: Initializes necessary variables for balance calculations.
Data Retrieval: Retrieves account balance details if needed.
Configuration Flags: Sets flags to determine inclusion of forward and earmarked debits/credits.
Validation: Ensures debits are non-negative.
Balance Calculation: Computes the available balance, adjusting for forward debits/credits, earmarked debits, and unposted transactions.
Balance Indicator Adjustments: Modifies the balance based on the balanceFromIndicator ('B' or 'F').
Two-in-One Limit Adjustment: Optionally adjusts the balance with a two-in-one limit.
Logging: Logs the intermediate and final balance values for debugging purposes.
This detailed breakdown provides a comprehensive view of the method's operations, including how it handles different balance indicators and calculates the available balance without limits.
This visual representation outlines the method's flow, using actual variable names to show how it processes balance data, applies conditions, and computes the available balance without limits. Each section highlights key operations and checks within the method.
summaraise similarly visually
Summary of Operations:
Addition:
Add unposted balances and forward credits to the ledger balance.
Add forward debit if included.
Add two-in-one limit if applicable.
Add end-of-day credit amount if balance indicator is 'B'.
Subtraction:
Subtract unposted forward debits.
Subtract forward credits.
Subtract earmarked debits.
Subtract end-of-day debit amounts and online debit amounts based on balance indicator.
This representation captures the specific arithmetic operations (addition and subtraction) performed throughout the method.
Subtract balanceWrapper.eodDrAmount and onlineDebitAmt if balance indicator is 'B'.
Subtract balanceWrapper.eodDebitAmt if balance indicator is 'F'.
This structured breakdown uses actual variable names to clearly show the arithmetic operations performed in the method.
This visual structure outlines each step in the method, showing how it processes balance data, applies conditions, and computes the available balance using the actual variable names. Each section describes the logic in simple terms, making it easier to understand the flow of operations.
out = LogWriter.getInstance("BalanaceComputaionUtility", "getAccountcreditSharedBalance");
out.println("enter into the getAccountcreditSharedBalance :");
try {
if(sysWrap==null){
cache = SystemCache.getInstance();
sysWrap = (SystemWrapper) cache.getSystemWrapper();
scb.util.LogWriter.getInstance().println("Inside getAccountcreditSharedBalance: sysWrap null check:"+sysWrap);
}
if (balanceComputationWrapper != null
&& balanceComputationWrapper.poolRefNo == null) {
getPoolRefNoForCreditBalSharedFacility(balanceComputationWrapper);
}
out.println("enter into the calcAvailBalWithCorpLimitLien accountLevelCreditSharingCap :"+accountLevelCreditSharingCap);
String isDuplicateRecord = getBPPValue("duplicateRecord");
if (accountLevelCreditSharingCap && balanceComputationWrapper != null
&& balanceComputationWrapper.accountNo != null && (!isDuplicateRecord.equals("Y") || balanceComputationWrapper.innerLimitWrapper == null && isDuplicateRecord.equals("Y"))) {
out.println("enter into the calcAvailBalWithCorpLimitLien:");
calcAvailBalWithCorpLimitLien(balanceComputationWrapper);
}
if(balanceComputationWrapper.poolRefNo!=null){
//out.println(" Credit shared balacne wrapper :"+balanceComputationWrapper.creditsharingWrapper);
if (balanceComputationWrapper.withLimitFlag == 'Y') {
out.println("Started computing wealth od balance for poolref#: "+ balanceComputationWrapper.poolRefNo);
if (balanceComputationWrapper.creditsharingWrapper == null) {
balanceComputationWrapper.creditsharingWrapper = BalanceComputationHelper
.getInstance(useRRConnection)
.getCreditSharingWithLimitPoolDetails(balanceComputationWrapper);
}
if(balanceComputationWrapper.creditsharingWrapper!=null) {
if(balanceComputationWrapper.facilityExpiryStatus == BusinessProcessConstants.FACILITY_DEFAULT_STATUS) {
Date argDate=null;
if(balanceComputationWrapper.balanceFromIndicator == 'B' && balanceComputationWrapper.bebalDate != null){
argDate= balanceComputationWrapper.bebalDate;
}
else{
argDate=sysWrap.systemDate;
}
scb.util.LogWriter.getInstance().println("Inside getAccountcreditSharedBalance: argDate:"+argDate);
if ((balanceComputationWrapper.creditsharingWrapper.facilityExpiryDate != null)
&& (DateUtility.compare(
balanceComputationWrapper.creditsharingWrapper.facilityExpiryDate,
argDate) < 0)) {
balanceComputationWrapper.facilityExpiryStatus = BusinessProcessConstants.FACILITY_EXPIRED;
} else {
balanceComputationWrapper.facilityExpiryStatus = BusinessProcessConstants.FACILITY_ACTIVE;
}
}
//Calculate clear balance
for (CreditBalanceSharingDetailWrapper creditBalanceSharingDetailWrapper : balanceComputationWrapper.creditsharingWrapper.creditBalanceSharingDetailWrapper) {
creditBalanceSharingDetailWrapper.accountAvailableBalance = calculateWithOutLimitForCreditSharePoll(
creditBalanceSharingDetailWrapper);
}
WealthODBalanceComputationRule.getInstance(useRRConnection).compute(balanceComputationWrapper);
}
out.println("Finished computing wealth od balance for poolref#: "+ balanceComputationWrapper.poolRefNo);
} else
{
if (!accountLevelCreditSharingCap) {
calcAvailNetPoolBalanceInPool(balanceComputationWrapper);
if (balanceComputationWrapper.creditsharingWrapper != null
&& balanceComputationWrapper.currencyCode != null
&& balanceComputationWrapper.accountNo != null) {
if (isCBREnabled()) {
calcAvailSharedBalanceInPoolNew(balanceComputationWrapper);
} else {
calcAvailSharedBalanceInPool(balanceComputationWrapper);
}
}
} else {
out.println("else part of accountLevelCreditSharingCap getAccountcreditSharedBalance");
out.println(" Credit shared balacne wrapper :"
+ balanceComputationWrapper.creditsharingWrapper);
calcAvailNetPoolBalanceInPoolWithChildCreditCap(balanceComputationWrapper);
if (balanceComputationWrapper.creditsharingWrapper != null
&& balanceComputationWrapper.currencyCode != null
&& balanceComputationWrapper.accountNo != null) {
calcAvailSharedBalanceInPoolCN(balanceComputationWrapper);
}
}
}
}else{
balanceComputationWrapper.availableBalanceWithCreditBalanceShared = balanceComputationWrapper.availableBalanceWithoutLimits;
}
out.println("end of getAccountcreditSharedBalance :"+balanceComputationWrapper.availableBalanceWithCreditBalanceShared);
show visually
Summary:
Initialization: Sets up logging and initializes system wrapper if needed.
Pool Reference: Retrieves pool reference number if not already set.
Account Level Credit Sharing: Checks conditions and calculates balance with corporate limit lien if applicable.
Credit Sharing with Pool Reference:
If withLimitFlag is 'Y', logs and calculates wealth OD balance.
If withLimitFlag is not 'Y', calculates shared balance based on account level credit sharing cap.
No Pool Reference Handling: Sets available balance without limits if no pool reference.
Logging: Logs the process and final balance values.
This visual structure provides a clear overview of the method's logic and operations, using actual variable names to make it easier to follow.
This function calculates the available shared balance in a pool using a specific method for CN (possibly China or a specific business rule context).
These function calls represent the core operations that the method performs, focusing on retrieving necessary data and calculating various balances based on specific business rules and conditions.
Logic: This method calculates the available shared balance in a pool using a new approach, typically when a specific reporting feature (CBR) is enabled.
Logic: This method calculates the available shared balance in a pool using a specific method tailored for a particular region or business context (e.g., CN for China).
These methods work together to handle various aspects of credit balance sharing, considering different conditions and rules to compute the necessary balances accurately.
getAccountcreditSharedBalance(BalanceComputationWrapper balanceComputationWrapper)
├── Initialize Logging
│ └── Log entry into the method
│
├── System Wrapper Initialization
│ ├── If sysWrap is null
│ │ ├── Retrieve SystemCache instance
│ │ └── Set sysWrap from SystemCache
│
├── Pool Reference Number Retrieval
│ ├── If balanceComputationWrapper is not null
│ │ └── If poolRefNo is null
│ │ └── Call getPoolRefNoForCreditBalSharedFacility
│ │ └── Retrieve pool reference number for credit balance sharing
│
├── Account Level Credit Sharing
│ ├── Retrieve duplicateRecord flag
│ ├── If accountLevelCreditSharingCap is true
│ │ └── And (accountNo is not null)
│ │ └── And (not a duplicate record or innerLimitWrapper is null)
│ │ └── Call calcAvailBalWithCorpLimitLien
│ │ └── Calculate available balance with corporate limit lien
│
├── Credit Sharing with Pool Reference
│ ├── If poolRefNo is not null
│ │ ├── If withLimitFlag is 'Y'
│ │ │ ├── Log start of wealth OD balance computation
│ │ │ ├── If creditsharingWrapper is null
│ │ │ │ └── Call getCreditSharingWithLimitPoolDetails
│ │ │ │ └── Retrieve credit sharing details with limits
│ │ │ ├── If creditsharingWrapper is not null
│ │ │ │ ├── Determine argDate based on balanceFromIndicator
│ │ │ │ ├── Call DateUtility.compare
│ │ │ │ │ └── Compare facility expiry date with argDate
│ │ │ │ ├── Set facilityExpiryStatus to expired or active
│ │ │ │ ├── For each creditBalanceSharingDetailWrapper
│ │ │ │ │ └── Call calculateWithOutLimitForCreditSharePoll
│ │ │ │ │ └── Calculate balance without limits for credit share
│ │ │ │ └── Call WealthODBalanceComputationRule.compute
│ │ │ │ └── Compute wealth overdraft balance
│ │ │ └── Log end of wealth OD balance computation
│ │ └── Else (without limit flag)
│ │ ├── If accountLevelCreditSharingCap is false
│ │ │ ├── Call calcAvailNetPoolBalanceInPool
│ │ │ │ └── Calculate net pool balance
│ │ │ └── If CBR is enabled
│ │ │ └── Call calcAvailSharedBalanceInPoolNew
│ │ │ └── Calculate shared balance with new method
│ │ │ └── Else
│ │ │ └── Call calcAvailSharedBalanceInPool
│ │ │ └── Calculate shared balance with standard method
│ │ └── Else
│ │ ├── Log else part of accountLevelCreditSharingCap
│ │ ├── Call calcAvailNetPoolBalanceInPoolWithChildCreditCap
│ │ │ └── Calculate net pool balance with child credit cap
│ │ └── Call calcAvailSharedBalanceInPoolCN
│ │ └── Calculate shared balance with CN method
│
├── No Pool Reference Handling
│ ├── If poolRefNo is null
│ │ └── Set availableBalanceWithCreditBalanceShared to availableBalanceWithoutLimits
│
└── Final Logging
└── Log end of method with availableBalanceWithCreditBalanceShared
Summary:
Initialization: Set up logging and system wrapper.
Pool Reference: Retrieve pool reference number if needed.
Account Level Credit Sharing: Check conditions and calculate balance with corporate limit lien.
Credit Sharing with Pool Reference:
If withLimitFlag is 'Y', log and calculate wealth OD balance.
If withLimitFlag is not 'Y', calculate shared balance based on account level credit sharing cap and CBR status.
No Pool Reference Handling: Use available balance without limits if no pool reference.
Logging: Log the process and final balance values.
This structured breakdown provides a clear overview of the method's logic and operations, focusing on the major function calls and their purpose.
Logging: Starts by logging the entry into the method.
Currency Conversion: (Currently commented out) Converts the net pool balance to the account currency if they differ.
Iterate Over Details: For each credit balance sharing detail:
Checks if the account number and currency match.
Logs relevant details.
Determine Shared Balance:
Sets the initial shared balance to the net pool balance.
If the balance is positive, adjusts based on the utilisation cap:
Absolute Cap ('A'): Adds a fixed utilisation cap to the available balance.
Percentage Cap ('P'): Calculates a cap as a percentage of the net pool balance and adds it to the available balance.
Takes the minimum of the net pool balance and the adjusted balance.
Logs the shared balance after adjustments.
Finalize Balance: Sets the final available balance with credit balance sharing in the wrapper and logs it.
This structured breakdown provides a clear overview of the method's operations and decision points, focusing on how it calculates the available credit balance to be shared.
public NewFundUtility() {
try {
out = LogWriter.getInstance("NewFundUtility", "validateNewFundDealBooking");
statisticalGroupLinkEntityHome = (StatisticalGroupLinkEntityHome)StatisticalGroupLinkDAOFactory
.getDAOInstance("StatisticalGroupLinkEntity");
accountMasterEntityHome = (AccountMasterEntityHome) AccountMasterDAOFactory
.getDAOInstance("AccountMasterEntity");
newFundTrackingEntityHome = (NewFundTrackingEntityHome) NewFundTrackingDAOFactory
.getDAOInstance("NewFundTrackingEntity");
subsidiaryAccountEntityHome = (SubsidiaryAccountEntityHome) SubsidiaryAccountDAOFactory
.getDAOInstance("SubsidiaryAccountEntity");
newFundParameterEntityHome = (NewFundParameterEntityHome) NewFundParameterDAOFactory
.getDAOInstance("NewFundParameterEntity");
relEntityHome = (RelationshipEntityHome)RelationshipDAOFactory.getDAOInstance("RelationshipEntity");
newFundsBenefitMappingEntityHome = (NewFundsBenefitMappingEntityHome) NewFundsBenefitMappingDAOFactory
.getDAOInstance("NewFundsBenefitMappingEntity");
newFundPromotionCategoryEntityHome = (NewFundPromotionCategoryEntityHome) NewFundPromotionCategoryDAOFactory
.getDAOInstance("NewFundPromotionCategoryEntity");
newFundPrmCustLinkageEntityHome = (NewFundPrmCustLinkageEntityHome) NewFundPrmCustLinkageDAOFactory
.getDAOInstance("NewFundPrmCustLinkageEntity");
} catch (Exception exception) {
out.printErrorMessage(exception);
}
}
public boolean validateNewFundDeposit(MMKDealsWrapper mMKDealsWrapper, Vector errVector,
List<String> newFundErrorCodeList) throws SCBApplicationException {
out.println("NewFundUtility - validateNewFundDeposit method start");
NewFundsBenefitMappingWrapper[] newFundsBenefitMappingWrapperArray = null;
AccountMasterEntity accountMasterEntity = null;
boolean isSegmentCodeRepeat = false;
BigDecimal totalAvailableNewFund = BigDecimal.ZERO;
String relationshipNo = null;
RelationshipEntity relationshipEntity = null;
if (newFundErrorCodeList == null) { // API purpose
newFundErrorCodeList = new ArrayList<>();
}
try {
out.println("Deal Type Value ...." + mMKDealsWrapper.mmkDealType);
accountMasterEntity = accountMasterEntityHome.findByPrimaryKey(new AccountMasterEntityKey(mMKDealsWrapper.customerTCID));
AccountMasterWrapper accountMasterWrapper = (AccountMasterWrapper) accountMasterEntity.getWrapper();
//Customer ETB or NTB
relationshipNo = accountMasterWrapper.getPrimaryRelationship();
relationshipEntity = relEntityHome.findByPrimaryKey(new RelationshipEntityKey(relationshipNo));
RelationshipWrapper relWrapper = (RelationshipWrapper)relationshipEntity.getWrapper();
Map<String, Date> accountRelOpenDateMap = newFundsBenefitMappingEntityHome.getAccountRelOpenDateMap(relWrapper.relationshipNo);
String customerType = getCustomerType(accountRelOpenDateMap);
out.println("validateNewFundDeposit - customer type=" +customerType);
try {
//KEYSTONEHK-279389 - Start
SystemWrapper systemWrapper = (SystemWrapper) StaticDataCache.getInstance().getSystemWrapper();
out.println("validateNewFundDeposit - mMKDealsWrapper.dealCurrencyCode//mMKDealsWrapper.mmkDealType="
+mMKDealsWrapper.dealCurrencyCode+"//"+mMKDealsWrapper.mmkDealType);
NewFundPromotionCategoryWrapper newFundPromotionCategoryWrapper = newFundPromotionCategoryEntityHome.
findByPromotionCategoryAll(mMKDealsWrapper.dealCurrencyCode,mMKDealsWrapper.mmkDealType);
if(newFundPromotionCategoryWrapper != null){
out.println("newFundPromotionCategoryWrapper.startDate//systemWrapper.systemDate="
+newFundPromotionCategoryWrapper.startDate+"//"+systemWrapper.systemDate);
out.println("newFundPromotionCategoryWrapper.endDate//systemWrapper.systemDate="
+newFundPromotionCategoryWrapper.endDate+"//"+systemWrapper.systemDate);
out.println("newFundPromotionCategoryWrapper.promotionalCategory="+newFundPromotionCategoryWrapper.promotionalCategory);
if(newFundPromotionCategoryWrapper.startDate != null
&& newFundPromotionCategoryWrapper.startDate.compareTo(systemWrapper.systemDate) > 0 ) {
out.println("Given Deal Type is Mapped with NewFund Promotion and StartDate is greater than CurrentDate");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_PROMOCAT_STARTDATE_CODE,
EBBSBusinessProcessConstants.ERR_PROMOCAT_STARTDATE_CODE_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_PROMOCAT_STARTDATE_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList NFPROMOCAT startDate=" + newFundErrorCodeList);
return false; // Reject Deal creation
}
if(newFundPromotionCategoryWrapper.endDate != null
&& newFundPromotionCategoryWrapper.endDate.compareTo(systemWrapper.systemDate) < 0) {
out.println("Given Deal Type is Mapped with NewFund Promotion and already Expired");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_PROMOCAT_ENDDATE_CODE,
EBBSBusinessProcessConstants.ERR_PROMOCAT_ENDDATE_CODE_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_PROMOCAT_ENDDATE_CODE); // API
out.println("return false; // Reject Deal creationNewFundUtility - newFundErrorCodeList NFPROMOCAT endDate=" + newFundErrorCodeList);
return false; // Reject Deal creation
}
out.println("newFundPromotionCategoryWrapper.totalAvailableQuota.... "+newFundPromotionCategoryWrapper.totalAvailableQuota);
out.println("newFundPromotionCategoryWrapper.totalQuotaUsed.... "+newFundPromotionCategoryWrapper.totalQuotaUsed);
if (newFundPromotionCategoryWrapper.totalAvailableQuota !=null && newFundPromotionCategoryWrapper.totalQuotaUsed !=null){
BigDecimal quotaLeft=new BigDecimal(0);
out.println("Quota..value is..."+newFundPromotionCategoryWrapper.totalAvailableQuota+"//"+newFundPromotionCategoryWrapper.totalQuotaUsed);
quotaLeft = newFundPromotionCategoryWrapper.totalAvailableQuota.subtract(newFundPromotionCategoryWrapper.totalQuotaUsed) ;
if (quotaLeft.compareTo(mMKDealsWrapper.dealAmount) <= 0 ){
out.println("return false; // Quota Check ");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,"DEP1342","Quota Already Utilised"));
return false; // Reject Deal creation
}
}else{
out.println("Quota..value is...Else");
}
if(newFundPromotionCategoryWrapper.promotionalCategory == 'T') {
try {
out.println("relWrapper.relationshipNo//mMKDealsWrapper.dealCurrencyCode"
+"//newFundPromotionCategoryWrapper.promoCode="
+relWrapper.relationshipNo+"//"
+mMKDealsWrapper.dealCurrencyCode+"//"
+newFundPromotionCategoryWrapper.promoCode);
NewFundPrmCustLinkageEntity newFundPrmCustLinkageEntity = newFundPrmCustLinkageEntityHome
.findByPrimaryKey(new NewFundPrmCustLinkageEntityKey(
relWrapper.relationshipNo.trim(),mMKDealsWrapper.dealCurrencyCode,
newFundPromotionCategoryWrapper.promoCode));
} catch (FinderException finderException) {
out.println("The customer is not eligible for given Deal Type");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_CODE,
EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList NFPROMOCAT Tar=" + newFundErrorCodeList);
return false; // Reject Deal creation
}
}
}
} catch (FinderException finderException) {
out.println("DealType and CustomerType Combination No Records in"
+ " NewFundPromotionCategory - finderException="+finderException);
}
//KEYSTONEHK-279389 - End
//mmkDealType Check in NewFundsBenefitMapping NFBNFTMP Table
newFundsBenefitMappingWrapperArray = newFundsBenefitMappingEntityHome.getDetailsBasedOnDealType(mMKDealsWrapper.mmkDealType);
out.println("newFundsBenefitMappingWrapperArray.length=" + newFundsBenefitMappingWrapperArray.length);
out.println("mMKDealsWrapper.dealAmount="+mMKDealsWrapper.dealAmount);
if (newFundsBenefitMappingWrapperArray != null && newFundsBenefitMappingWrapperArray.length > 0) {
for (int i = 0; i < newFundsBenefitMappingWrapperArray.length; i++) {
out.println("Fund Type Value ...." + newFundsBenefitMappingWrapperArray[i].fundType + "//"
+ "Channel ID Value ...." + newFundsBenefitMappingWrapperArray[i].channelId + "//"
+ "Segment Code Value ...." + newFundsBenefitMappingWrapperArray[i].segmentCode);
out.println("Channel Id from mMKDealsWrapper.channelID ...................." + mMKDealsWrapper.channelID);
if (((newFundsBenefitMappingWrapperArray[i].customerType == 'N' && customerType.equalsIgnoreCase("ETB")) ||
(newFundsBenefitMappingWrapperArray[i].customerType == 'E' && customerType.equalsIgnoreCase("NTB"))) ) { // Existing FundType
out.println("Given Customer is not eligible for New Fund Deal Type - If Condition");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_REJECT_DEAL_CODE,EBBSBusinessProcessConstants.ERR_REJECT_DEAL_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_REJECT_DEAL_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used
} else if ((newFundsBenefitMappingWrapperArray[i].customerType == 'E' && customerType.equalsIgnoreCase("ETB")) &&
(mMKDealsWrapper.dealAmount != null && mMKDealsWrapper.dealAmount.compareTo(BigDecimal.ZERO) != 0) ) { // Existing FundType
out.println("Given Deal Type Belong to Customer Type - NTB");
if (!isSegmentCodeRepeat && accountMasterWrapper.segmentCode.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].segmentCode) &&
mMKDealsWrapper.channelID != null && mMKDealsWrapper.channelID.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].channelId)) {
isSegmentCodeRepeat = true;
newFundPromotionCategoryWrapper = newFundPromotionCategoryEntityHome
.findByPromotionCategory(mMKDealsWrapper.mmkDealType,newFundsBenefitMappingWrapperArray[i].fundType,'\u0000');
out.println("newFundPromotionCategoryWrapper="+newFundPromotionCategoryWrapper);
out.println("Inside ETB - else if condition");
if (newFundPromotionCategoryWrapper!=null) {
out.println("validateNewFundDeposit Existing FundType- newFundPromotionCategoryWrapper.currencyCode="
+newFundPromotionCategoryWrapper.currencyCode+"//"+
"newFundPromotionCategoryWrapper.mMKDealType="+newFundPromotionCategoryWrapper.mMKDealType+"//"+
"newFundPromotionCategoryWrapper.totalQuotaUsed="+newFundPromotionCategoryWrapper.totalQuotaUsed +"//"+
"newFundPromotionCategoryWrapper.makerDetail="+newFundPromotionCategoryWrapper.makerDetail +"//"+
"newFundPromotionCategoryWrapper.checkerDetail="+newFundPromotionCategoryWrapper.checkerDetail +"//"+
"newFundPromotionCategoryWrapper.statusFlag="+newFundPromotionCategoryWrapper.statusFlag);
if (newFundsBenefitMappingWrapperArray[i].fundType == 'N'){
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
newFundPromotionCategoryWrapper.totalQuotaUsed = mMKDealsWrapper.dealAmount; // totalQuotaUsed
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ETB... ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking ETB..");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList ETB..=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
}else{
//createDepositEventAction(mMKDealsWrapper); //Deal Type tagged to promotion category
mMKDealsWrapper.isNFTrackingRequired =false;
return true; // track the quota used
}
}else{
if(newFundsBenefitMappingWrapperArray[i].fundType == 'N') {
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
out.println("CustomerType-ETB and FundType-N // No NewFund Promotion Category "
+"totalAvailableNewFund//mMKDealsWrapper.dealAmount="+ totalAvailableNewFund +"//"+mMKDealsWrapper.dealAmount);
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
} else {
return false; // don't track the quota used and reject deposit create
}
}
}
} else if ( ((newFundsBenefitMappingWrapperArray[i].customerType == 'N' || newFundsBenefitMappingWrapperArray[i].customerType == 'Z')
&& customerType.equalsIgnoreCase("NTB"))
&& (mMKDealsWrapper.dealAmount != null && mMKDealsWrapper.dealAmount.compareTo(BigDecimal.ZERO) != 0) ) { //New FundType
out.println("Given Deal Type Belong to Customer Type - NTB");
if (!isSegmentCodeRepeat && accountMasterWrapper.segmentCode.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].segmentCode) &&
mMKDealsWrapper.channelID != null && mMKDealsWrapper.channelID.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].channelId)) {
isSegmentCodeRepeat = true;
newFundPromotionCategoryWrapper = newFundPromotionCategoryEntityHome
.findByPromotionCategory(mMKDealsWrapper.mmkDealType,newFundsBenefitMappingWrapperArray[i].fundType,'\u0000');
out.println("newFundPromotionCategoryWrapper="+newFundPromotionCategoryWrapper);
if (newFundPromotionCategoryWrapper != null) {
out.println("validateNewFundDeposit New FundType- newFundPromotionCategoryWrapper.currencyCode="
+newFundPromotionCategoryWrapper.currencyCode+"//"+
"newFundPromotionCategoryWrapper.mMKDealType="+newFundPromotionCategoryWrapper.mMKDealType+"//"+
"newFundPromotionCategoryWrapper.totalQuotaUsed="+newFundPromotionCategoryWrapper.totalQuotaUsed +"//"+
"newFundPromotionCategoryWrapper.makerDetail="+newFundPromotionCategoryWrapper.makerDetail +"//"+
"newFundPromotionCategoryWrapper.checkerDetail="+newFundPromotionCategoryWrapper.checkerDetail +"//"+
"newFundPromotionCategoryWrapper.statusFlag="+newFundPromotionCategoryWrapper.statusFlag);
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
out.println("totalAvailableNewFund=//mMKDealsWrapper.dealAmount="+totalAvailableNewFund +"//"+mMKDealsWrapper.dealAmount);
if (newFundsBenefitMappingWrapperArray[i].fundType == 'E'){
out.println("Inside Fund Type Is E...");
mMKDealsWrapper.isNFTrackingRequired =false;
return true; // track the quota used
}
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
newFundPromotionCategoryWrapper.totalQuotaUsed = mMKDealsWrapper.dealAmount; // totalQuotaUsed
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
} else {
if(newFundsBenefitMappingWrapperArray[i].fundType == 'N') {
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
out.println("CustomerType-ETB and FundType-N // No NewFund Promotion Category "
+"totalAvailableNewFund//mMKDealsWrapper.dealAmount="+ totalAvailableNewFund +"//"+mMKDealsWrapper.dealAmount);
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
} else {
return false; // don't track the quota used and reject deposit create
}
}
}
} else if ( ((newFundsBenefitMappingWrapperArray[i].customerType == 'E' || newFundsBenefitMappingWrapperArray[i].customerType == 'Z')
&& (customerType.equalsIgnoreCase("ETB") && newFundsBenefitMappingWrapperArray[i].fundType =='N' ))
&& (mMKDealsWrapper.dealAmount != null && mMKDealsWrapper.dealAmount.compareTo(BigDecimal.ZERO) != 0) ) {
out.println("Given Deal Type Belong to Customer Type - NTB");
if (!isSegmentCodeRepeat && accountMasterWrapper.segmentCode.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].segmentCode) &&
mMKDealsWrapper.channelID != null && mMKDealsWrapper.channelID.equalsIgnoreCase(newFundsBenefitMappingWrapperArray[i].channelId)) {
isSegmentCodeRepeat = true;
newFundPromotionCategoryWrapper = newFundPromotionCategoryEntityHome
.findByPromotionCategory(mMKDealsWrapper.mmkDealType,newFundsBenefitMappingWrapperArray[i].fundType,'\u0000');
out.println("newFundPromotionCategoryWrapper="+newFundPromotionCategoryWrapper);
if (newFundPromotionCategoryWrapper != null) {
out.println("validateNewFundDeposit New FundType- newFundPromotionCategoryWrapper.currencyCode="
+newFundPromotionCategoryWrapper.currencyCode+"//"+
"newFundPromotionCategoryWrapper.mMKDealType="+newFundPromotionCategoryWrapper.mMKDealType+"//"+
"newFundPromotionCategoryWrapper.totalQuotaUsed="+newFundPromotionCategoryWrapper.totalQuotaUsed +"//"+
"newFundPromotionCategoryWrapper.makerDetail="+newFundPromotionCategoryWrapper.makerDetail +"//"+
"newFundPromotionCategoryWrapper.checkerDetail="+newFundPromotionCategoryWrapper.checkerDetail +"//"+
"newFundPromotionCategoryWrapper.statusFlag="+newFundPromotionCategoryWrapper.statusFlag);
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
out.println("CustomerType-ETB and FundType-N // NewFund Promotion Category "
+ "totalAvailableNewFund//mMKDealsWrapper.dealAmount="+totalAvailableNewFund +"//"+mMKDealsWrapper.dealAmount);
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
newFundPromotionCategoryWrapper.totalQuotaUsed = mMKDealsWrapper.dealAmount; // totalQuotaUsed
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
} else {
if(newFundsBenefitMappingWrapperArray[i].fundType == 'N') {
totalAvailableNewFund = getTotalAvailableNewFund(accountMasterWrapper, mMKDealsWrapper,null);
out.println("CustomerType-ETB and FundType-N // No NewFund Promotion Category "
+"totalAvailableNewFund//mMKDealsWrapper.dealAmount="+ totalAvailableNewFund +"//"+mMKDealsWrapper.dealAmount);
if (totalAvailableNewFund != null && mMKDealsWrapper.dealAmount.compareTo(totalAvailableNewFund) <= 0) {
out.println("Total Available NewFund is Greater than or Equal to Deal Amount, Eligible for Deposit Booking ");
return true; // track the newfund entry and totalQuotaUsed
} else {
out.println("Total Available NewFund is Less than Deal Amount, Not Eligible for Deposit Booking");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE,EBBSBusinessProcessConstants.ERR_NEWFUND_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_AVL_NEWFUND_CODE); // API
out.println("NewFundUtility - newFundErrorCodeList=" + newFundErrorCodeList);
return false; // don't track the quota used and reject deposit create
}
}else {
return false; // don't track the quota used and reject deposit create
}
}
}
}else if ( ((newFundsBenefitMappingWrapperArray[i].customerType == 'E' || newFundsBenefitMappingWrapperArray[i].customerType == 'Z')
&& (customerType.equalsIgnoreCase("NTB") ))
&& (mMKDealsWrapper.dealAmount != null && mMKDealsWrapper.dealAmount.compareTo(BigDecimal.ZERO) != 0)) {
out.println("The customer is not eligible for given Deal Type...E/Z/NTB...");
errVector.addElement(new ErrorObject(EBBSBusinessProcessConstants.ERR,
EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_CODE,
EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_DESCRIPTION)); // Screen
newFundErrorCodeList.add(EBBSBusinessProcessConstants.ERR_PROMOCAT_TAR_CODE); // API
return false; // Reject Deal creation
}
}
}
else {
return false; // don't track the quota used//newfundUtilized and create deposit
}
} catch (FinderException finderException) {
out.println("mMKDealsWrapper.mmkDealType is=" +mMKDealsWrapper.mmkDealType+ " not mapped with newFundsBenefitMapping ");
out.printErrorMessage(finderException);
return false; // don't track the quota used//newFundUtiized and create deposit
} catch (Exception exception) {
out.println("Common validateNewFundDeposit exception");
out.printErrorMessage(exception);
}
out.println("NewFundUtility - validateNewFundDeposit method End");
if (isSegmentCodeRepeat){
out.println("Inside...isSegmentCodeRepeat");
return true;
}else{
out.println("Inside...isSegmentCodeRepeat else");
return false;
}
}
Key Function Calls and Logic:
Entity Retrieval:
Uses accountMasterEntityHome.findByPrimaryKey to get account details.
Uses relEntityHome.findByPrimaryKey to retrieve relationship details.
Promotion Category Validation:
Uses newFundPromotionCategoryEntityHome.findByPromotionCategoryAll to find promotion categories.
Checks the promotion start and end dates against the current system date to validate eligibility.
Validates customer eligibility for promotions using newFundPrmCustLinkageEntityHome.findByPrimaryKey.
Benefit Mapping Validation:
Uses newFundsBenefitMappingEntityHome.getDetailsBasedOnDealType to retrieve benefit mappings.
Validates the deal type and customer eligibility against these mappings.
Compares total available new fund against the deal amount using getTotalAvailableNewFund.
Error Handling:
Adds error messages to errVector and newFundErrorCodeList based on different validation failures.
This structured breakdown provides a clear overview of the method's operations, focusing on the main function calls and their purpose within the validation process.