Breaking News

Monday, February 9, 2009

Banking Industry - Default Account Marking Business Process

Card Default Account Marking Business Process

This is for those who had problems understanding a generic default account marking business process. I had a problem understanding the same, so I came up with a visual that helped a lot.

Business rules:
Rule 1:
At any time only 1 account can be marked as "O"
Rule 2:
If there is a "O" type account in one category then no "Y" type account is required in that category
Rule 3:
If there is a "Y" type account in one category then all other accounts should be of "N" type.



Following is the simple code for the above flow.

private void ApplyRulesEx(DataTable dtAtmCards)
{
//Pseudo:
//STEP 1: Demark old account status to N
//STEP 2: Mark the new account status to O or Y
// 

bool bStatus = false;

try
{
string strRequestCategory = m_strCategory;//"10";//
string strRequestAccountNumber = m_strAccountNumber;//"0949011001576";//
string strRequestMarkAs = m_strFlagToBeMarked; //"Overall Default";// //mark as O, overall default

for (int nRowNumber = 0; nRowNumber < dtAtmCards.Rows.Count; nRowNumber++) 
{ 
//1. Parse through each db record, get the status and category 
//2. if dbCategory = requestCategory) then mark all O and Y's as N 
//3. Else, its a different category, so mark all O as Y. 
// make it default for that type only 
//4. Send 

string dbAccountStatus = dtAtmCards.Rows[nRowNumber]["Default_Account"].ToString(); 
if (dbAccountStatus.Equals("")) dbAccountStatus = "Non Default"; 
string dbAccountNumber = dtAtmCards.Rows[nRowNumber]["Account_No"].ToString(); 
string dbAccountCategory = dtAtmCards.Rows[nRowNumber]["Account_Type"].ToString(); 

if (dbAccountCategory == strRequestCategory) 
{ 
if (dbAccountNumber == strRequestAccountNumber) 
{ 
//the request account status change is same as the current overall default account. 
//Lets change that directly. Only one call to phoenix. 
//this means, that the requested account number and category is same as 
//the db account number and category, so, no need to send any "N" statuses, 
//lets do nothing. and break; 

CLogger.getInstance().Log("Try marking account: [" + dbAccountNumber + ":" + dbAccountCategory + "] as: [" + strRequestMarkAs + "]", System.Diagnostics.TraceLevel.Info); 
bStatus = MarkAs(strRequestMarkAs, dbAccountCategory, dbAccountNumber); 
} 

else 
{ 
//2. if dbCategory = requestCategory) then mark all O and Y's as N 
//means, the requested category is same as the this account's category, 
//so this means if the current db status is overall or yes, 
//we need to make it N 

if (dbAccountStatus == AccountStatuses.Overall || dbAccountStatus == AccountStatuses.Yes) 
{ 
//Make it "N", which means No. 
CLogger.getInstance().Log("Try marking account: [" + dbAccountNumber + ":" + dbAccountCategory + "] as: [" + AccountStatuses.No.ToString().Substring(0, 1).ToString() + "]", System.Diagnostics.TraceLevel.Info); 
bStatus = MarkAs(AccountStatuses.No.ToString().Substring(0, 1), dbAccountCategory, dbAccountNumber); 
} 
} 
} 
else 
{ 
//3. else, its a different category, so mark all O as Y. 
// make it default for that type only 
if (dbAccountStatus == AccountStatuses.Overall) 
{ 
//Change any overall status from Overall to Yes, send Y. Static/hardcoded. 
//TODO: Put Y in app.config for ready change. 
CLogger.getInstance().Log("Try marking account: [" + dbAccountNumber + ":" + dbAccountCategory + "] as: [" + "Y" + "]", System.Diagnostics.TraceLevel.Info); 
bStatus = MarkAs("Y", dbAccountCategory, dbAccountNumber); 
} 
} 
} 
} 
catch (Exception exc) 
{ 
CLogger.getInstance().Error("CAccountHandler", "ApplyRules", exc.Message); 
} 
} 

Hope this helps.

No comments:

Post a Comment

Designed By Published.. Blogger Templates