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; } }
function S_A_withdrawal($account_id, $amount_withdrawn, $withdrawal_time, $withdrawal_date, $withdrawal_method, $transfer_to_account_id) { $get_status = S_A_A_I_D_get_status($account_id); if ($get_status['status'] == "OPEN") { $withdrawal_id = S_A_generate_withdrawal_id($account_id); $elegible_withdrawal_1 = false; $elegible_withdrawal_2 = false; $constraints = S_A_Co_D_get(); $get = S_A_C_A_D_get($account_id); $current_amount = $get['current_amount']; $current_amount = $current_amount - $amount_withdrawn; if ($current_amount >= $constraints['minimum_balance']) { $elegible_withdrawal_1 = true; } $get = S_A_D_W_T_D_get($account_id); $total_withdrawal_today = $get['total_withdrawal_today']; $number_withdrawal_today = $get['number_withdrawal_today']; $total_withdrawal_today = $total_withdrawal_today + $amount_withdrawn; $number_withdrawal_today = $number_withdrawal_today + 1; if ($number_withdrawal_today <= $constraints['maximum_number_withdrawals_per_day'] && $total_withdrawal_today <= $constraints['maximum_amount_withdrawn_per_day']) { $elegible_withdrawal_2 = true; } $get = S_A_N_T_D_get($account_id); $number_withdrawals = $get['number_withdrawals']; $number_withdrawals = $number_withdrawals + "1"; if ($elegible_withdrawal_1 && $elegible_withdrawal_2) { $operation1 = S_A_W_D_add($account_id, $withdrawal_id, $withdrawal_time, $withdrawal_date, $amount_withdrawn, $withdrawal_method, $transfer_to_account_id); $operation2 = S_A_C_A_D_set_current_amount($account_id, $current_amount); $operation3 = S_A_N_T_D_set_number_withdrawals($account_id, $number_withdrawals); $operation4 = S_A_D_W_T_D_set_number_withdrawals_today($account_id, $number_withdrawal_today); $operation5 = S_A_D_W_T_D_set_total_withdrawal_today($account_id, $total_withdrawal_today); if ($operation1 && $operation2 && $operation3 && $operation4 && $operation5) { return true; } else { return false; } } else { return false; } } else { return false; } }