diff --git a/admin_settings_online_payment_clients.php b/admin_settings_online_payment_clients.php new file mode 100644 index 00000000..4a6bc8c9 --- /dev/null +++ b/admin_settings_online_payment_clients.php @@ -0,0 +1,51 @@ + + +
+
+

Online Payment - Client info

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
ClientStripe Customer IDStripe Payment ID
+ +
+ +
+ + CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.5'"); } - // if (CURRENT_DATABASE_VERSION == '1.7.5') { - // // Insert queries here required to update to DB version 1.7.6 + if (CURRENT_DATABASE_VERSION == '1.7.5') { + mysqli_query($mysqli, "CREATE TABLE `client_stripe` (`client_id` INT(11) NOT NULL, `stripe_id` VARCHAR(255) NOT NULL, `stripe_pm` varchar(255) NULL) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; "); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.6'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.7.6') { + // // Insert queries here required to update to DB version 1.7.7 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.6'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.7'"); // } } else { diff --git a/database_version.php b/database_version.php index 589a6c56..61ca815b 100644 --- a/database_version.php +++ b/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "1.7.5"); +DEFINE("LATEST_DATABASE_VERSION", "1.7.6"); diff --git a/db.sql b/db.sql index 664915d8..6001fb86 100644 --- a/db.sql +++ b/db.sql @@ -342,6 +342,17 @@ CREATE TABLE `client_notes` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `client_stripe` +-- + +DROP TABLE IF EXISTS `client_stripe`; +CREATE TABLE IF NOT EXISTS `client_stripe` ( + `client_id` int(11) NOT NULL, + `stripe_id` varchar(255) NOT NULL, + `stripe_pm` varchar(255) NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `client_tags` -- diff --git a/guest/guest_pay_invoice_stripe.php b/guest/guest_pay_invoice_stripe.php index c9ca5478..2b3065bb 100644 --- a/guest/guest_pay_invoice_stripe.php +++ b/guest/guest_pay_invoice_stripe.php @@ -279,7 +279,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent // Add Payment to History mysqli_query($mysqli, "INSERT INTO payments SET payment_date = '$pi_date', payment_amount = $pi_amount_paid, payment_currency_code = '$pi_currency', payment_account_id = $config_stripe_account, payment_method = 'Stripe', payment_reference = 'Stripe - $pi_id', payment_invoice_id = $invoice_id"); - mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Payment added - $ip - $os - $browser', history_invoice_id = $invoice_id"); + mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Online Payment added (client) - $ip - $os - $browser', history_invoice_id = $invoice_id"); // Notify appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number has been paid by $client_name - $ip - $os - $browser", "invoice.php?invoice_id=$invoice_id", $pi_client_id); @@ -313,7 +313,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent if (!empty($config_smtp_host)) { $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, '0', $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "Hello $contact_name,

We have received online payment for the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; $data = [ [ @@ -330,7 +330,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent // Email the internal notification address too if (!empty($config_invoice_paid_notification_email)) { $subject = "Payment Received - $client_name - Invoice $invoice_prefix$invoice_number"; - $body = "Hello,

This is a notification that an invoice has been paid in ITFlow. Below is a copy of the receipt sent to the client:-

--------

Hello $contact_name,

We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, '0', $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "Hello,

This is a notification that an invoice has been paid in ITFlow. Below is a copy of the receipt sent to the client:-

--------

Hello $contact_name,

We have received online payment for the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; $data[] = [ 'from' => $config_invoice_from_email, diff --git a/invoice.php b/invoice.php index 8da83360..10e34ca3 100644 --- a/invoice.php +++ b/invoice.php @@ -145,6 +145,17 @@ if (isset($_GET['invoice_id'])) { $json_products = json_encode($products); } + // Payment with saved card (auto-pay) + if ($config_stripe_enable) { + $stripe_client_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1")); + if ($stripe_client_details) { + $stripe_id = sanitizeInput($stripe_client_details['stripe_id']); + $stripe_pm = sanitizeInput($stripe_client_details['stripe_pm']); + } + } + + + ?>