mirror of https://github.com/itflow-org/itflow
Update guest_ajax.php with the new stripe vars
This commit is contained in:
parent
56c138fb12
commit
063d042378
|
|
@ -54,6 +54,8 @@ if (isset($_GET['stripe_create_pi'])) {
|
|||
$config_sql = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
||||
$config_row = mysqli_fetch_array($config_sql);
|
||||
$config_stripe_client_pays_fees = intval($config_row['config_stripe_client_pays_fees']);
|
||||
$config_stripe_percentage_fee = floatval($config_row['config_stripe_percentage_fee']);
|
||||
$config_stripe_flat_fee = floatval($config_row['config_stripe_flat_fee']);
|
||||
|
||||
// Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
||||
|
|
@ -63,11 +65,8 @@ if (isset($_GET['stripe_create_pi'])) {
|
|||
|
||||
// Check config to see if client pays fees is enabled
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
// Get fees from config
|
||||
$percentage_fee = 0.029; // Default Stripe fee
|
||||
$flat_fee = 0.30; // Default Stripe fee
|
||||
// Calculate the amount to charge the client
|
||||
$balance_to_pay = ($balance_to_pay + $flat_fee) / (1 - $percentage_fee);
|
||||
$balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
|
||||
}
|
||||
|
||||
$balance_to_pay = round($balance_to_pay, 2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue