mirror of
https://github.com/itflow-org/itflow
synced 2026-07-24 17:30:43 +00:00
Cleanup Expense Code in post blocks and remove single use function since stripe payments get reconciled during nightly cron
This commit is contained in:
@@ -375,8 +375,6 @@ if (isset($_POST['add_payment_stripe'])) {
|
||||
$public_key = escapeSql($row['payment_provider_public_key']);
|
||||
$private_key = escapeSql($row['payment_provider_private_key']);
|
||||
$account_id = intval($row['payment_provider_account']);
|
||||
$expense_category_id = intval($row['payment_provider_expense_category']);
|
||||
$expense_vendor_id = intval($row['payment_provider_expense_vendor']);
|
||||
$payment_provider_client = escapeSql($row['payment_provider_client']);
|
||||
$saved_payment_method = escapeSql($row['saved_payment_provider_method']);
|
||||
$saved_payment_description = escapeSql($row['saved_payment_description']);
|
||||
@@ -410,7 +408,6 @@ if (isset($_POST['add_payment_stripe'])) {
|
||||
'off_session' => true,
|
||||
'confirm' => true,
|
||||
'description' => $pi_description,
|
||||
'expand' => ['latest_charge.balance_transaction'],
|
||||
'metadata' => [
|
||||
'itflow_client_id' => $client_id,
|
||||
'itflow_client_name' => $client_name,
|
||||
@@ -487,18 +484,6 @@ if (isset($_POST['add_payment_stripe'])) {
|
||||
$extended_log_desc = '(DEV MODE)';
|
||||
}
|
||||
|
||||
// Create actual Stripe gateway fee as an expense (if configured)
|
||||
if ($expense_vendor_id > 0 && $expense_category_id > 0) {
|
||||
$stripe_fee = getStripeGatewayFee($payment_intent);
|
||||
if ($stripe_fee) {
|
||||
$gateway_fee = floatval($stripe_fee['fee']);
|
||||
$gateway_fee_currency = escapeSql($stripe_fee['currency']);
|
||||
mysqli_query($mysqli,"INSERT INTO expenses SET expense_date = '$pi_date', expense_amount = $gateway_fee, expense_currency_code = '$gateway_fee_currency', expense_account_id = $account_id, expense_vendor_id = $expense_vendor_id, expense_client_id = $client_id, expense_category_id = $expense_category_id, expense_description = 'Stripe fee for Invoice $invoice_prefix$invoice_number payment of $balance_to_pay', expense_reference = 'Stripe - $pi_id $extended_log_desc'");
|
||||
} else {
|
||||
logApp("Stripe", "warning", "Balance transaction unavailable for $pi_id - fee expense not recorded for invoice ID $invoice_id");
|
||||
}
|
||||
}
|
||||
|
||||
// Notify/log
|
||||
appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number automatically paid", "/agent/invoice.php?invoice_id=$invoice_id", $client_id);
|
||||
logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id);
|
||||
|
||||
Reference in New Issue
Block a user