From 2b192b3840ac344c456b98304ea400f0af90da15 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sat, 13 Jan 2024 16:12:11 +0100 Subject: Updated 46 files and deleted 19 files (automated) --- pages/api/money/accounts.php | 96 -------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 pages/api/money/accounts.php (limited to 'pages/api/money/accounts.php') diff --git a/pages/api/money/accounts.php b/pages/api/money/accounts.php deleted file mode 100644 index 9f85323..0000000 --- a/pages/api/money/accounts.php +++ /dev/null @@ -1,96 +0,0 @@ - 0, - "exchange_rate" => $rate, - "users" => [ - "cloudburst" => [ - "total" => 0, - "accounts" => [] - ], - "raindrops" => [ - "total" => 0, - "accounts" => [] - ] - ] -]; - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, $accounts), function ($a, $b) { - return $a + $b; -}); -$obj["total"] = [ - "gbp" => round($allAccounts, 2), - "eur" => round($allAccounts * (1 / $rate), 2) -]; - -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["cloudburst"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "cloudburst") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - - $obj["users"]["cloudburst"]["accounts"][] = $acc; - } -} -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["raindrops"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "raindrops") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = null; - - $obj["users"]["raindrops"]["accounts"][] = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT)); \ No newline at end of file -- cgit