From 9bd924dc672a6ddbe07a02fb15c7c1116ec52641 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 28 Jan 2024 14:54:28 -0500 Subject: [PATCH] Only create a Stripe Expense if client pays fee is off, a stripe expense vendor and expense category is selected in settings --- guest_pay_invoice_stripe.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index c89d0b3a..244e088d 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -279,7 +279,10 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent if ($config_stripe_client_pays_fees == 1) { // Calculate the amount to charge the client $balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee); - } else { + } + + // Check to see if Expense Fields are configured and client pays fee is off then create expense + if ($config_stripe_client_pays_fees == 0 && $config_stripe_expense_vendor > 0 && $config_stripe_expense_category > 0) { $balance_before_fees = $balance_to_pay; // Calculate the amount to charge the client $balance_to_not_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);