Commit 6b2d759a authored by Antonio.Suerte's avatar Antonio.Suerte

BI API Enhancement for User Balance Interface

parent e15eef5a
...@@ -10,7 +10,25 @@ trait UserBalances{ ...@@ -10,7 +10,25 @@ trait UserBalances{
$sys = $holder -> getSource(); $sys = $holder -> getSource();
if($sys instanceof System){ if($sys instanceof System){
$account = $sys -> getRowData($sys -> getAccountCommon($holder -> userAccount), NO_COUNT); $holder -> userAccount = str_replace(""", "\"", $holder -> userAccount);
$accountBalanceData = [];
if($sys -> checkJSONString($holder -> userAccount)){
$holder -> userAccount = json_decode($holder -> userAccount);
foreach($holder -> userAccount as $value){
$accountBalanceData["balanceData"][] = $this -> fetchUserBalanceData($sys, $value);
}
}else
$accountBalanceData["balanceData"][] = $this -> fetchUserBalanceData($sys, $holder -> userAccount);
echo json_encode($accountBalanceData);
}
}
private function fetchUserBalanceData(System $sys, String $userAccount){
$account = $sys -> getRowData($sys -> getAccountCommon($userAccount), NO_COUNT);
$balances = $sys -> accessSelect('SELECT_USER_BALANCES', $balances = $sys -> accessSelect('SELECT_USER_BALANCES',
[$sys -> getColumnData($account, PARAM_USER_ACCOUNT)]); [$sys -> getColumnData($account, PARAM_USER_ACCOUNT)]);
...@@ -30,7 +48,6 @@ trait UserBalances{ ...@@ -30,7 +48,6 @@ trait UserBalances{
"user_balances" => $balances "user_balances" => $balances
]; ];
echo json_encode($result); return $result;
}
} }
} }
\ No newline at end of file
...@@ -50,7 +50,8 @@ trait ValidationExpression { ...@@ -50,7 +50,8 @@ trait ValidationExpression {
], ],
[ [
"notvalid" => !$holder -> open && $holder -> view == "userBalance" "notvalid" => !$holder -> open && $holder -> view == "userBalance"
&& count($sys -> getAccountCommon($holder -> userAccount)) === 0, && count($sys -> getAccountCommon($holder -> userAccount)) === 0
&& !$sys -> checkJSONString(str_replace(""", "\"", $holder -> userAccount)),
"message" => "[User Balance Result]: Account No. doesn't exist [{$holder -> userAccount}]", "message" => "[User Balance Result]: Account No. doesn't exist [{$holder -> userAccount}]",
"code" => 8 "code" => 8
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment