function S_A_add_daily_interest($account_id)
{
    $constraints = S_A_Co_D_get();
    $interest_rate = $constraints['rate_of_interest_per_day'];
    $get = S_A_C_A_D_get($account_id);
    $current_amount = $get['current_amount'];
    $interest_amount = $current_amount * $interest_rate / 100;
    $current_amount = $current_amount + $interest_amount;
    $operation1 = S_A_C_A_D_set_current_amount($account_id, $current_amount);
    check_operation($operation1);
    if ($operation1) {
        return true;
    } else {
        return false;
    }
}
Example #2
0
function S_A_deposit($account_id, $amount_deposited, $deposit_time, $deposit_date, $deposit_method)
{
    $get_status = S_A_A_I_D_get_status($account_id);
    if ($get_status['status'] == "OPEN") {
        $deposit_id = S_A_generate_deposit_id($account_id);
        $operation1 = S_A_D_D_add($account_id, $deposit_id, $deposit_method, $amount_deposited, $deposit_time, $deposit_date);
        $get = S_A_C_A_D_get($account_id);
        $current_amount = $get['current_amount'];
        $current_amount = $current_amount + $amount_deposited;
        $operation2 = S_A_C_A_D_set_current_amount($account_id, $current_amount);
        $get = S_A_N_T_D_get($account_id);
        $number_deposits = $get['number_deposits'];
        $number_deposits = $number_deposits + "1";
        $operation3 = S_A_N_T_D_set_number_deposits($account_id, $number_deposits);
        $get = S_A_D_W_T_D_get($account_id);
        $total_withdrawal_today = $get['total_withdrawal_today'];
        $operation4 = S_A_D_W_T_D_set_total_withdrawal_today($account_id, $total_withdrawal_today);
        if ($operation1 && $operation2 && $operation3 && $operation4) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}