diff --git a/client/post.php b/client/post.php
index 1f07af2c..36009343 100644
--- a/client/post.php
+++ b/client/post.php
@@ -597,10 +597,22 @@ if (isset($_GET['stripe_save_card'])) {
// Get some card/payment method details for the email/logging
$payment_method_details = $stripe->paymentMethods->retrieve($payment_method);
- $card_info = sanitizeInput($payment_method_details->card->display_brand) . " " . sanitizeInput($payment_method_details->card->last4);
+ $card_type = sanitizeInput($payment_method_details->card->brand);
+ $last4 = sanitizeInput($payment_method_details->card->last4);
+ $expiry_month = sanitizeInput($payment_method_details->card->exp_month);
+ $expiry_year = sanitizeInput($payment_method_details->card->exp_year);
+
+ // Format the payment details string (Visa - 4324 | Exp 12/25)
+ $stripe_pm_details = "$card_type - $last4 | Exp $expiry_month/$expiry_year";
+
+ // Save the formatted payment details into stripe_pm_details
+ $update_query = "
+ UPDATE client_stripe
+ SET stripe_pm_details = '$stripe_pm_details'
+ WHERE client_id = $session_client_id LIMIT 1";
+ mysqli_query($mysqli, $update_query);
// Send email confirmation
-
// Company Details & Settings
$sql_settings = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
$row = mysqli_fetch_array($sql_settings);
@@ -617,7 +629,7 @@ if (isset($_GET['stripe_save_card'])) {
if (!empty($config_smtp_host)) {
$subject = "Payment method saved";
- $body = "Hello $session_contact_name,
We’re writing to confirm that your payment details have been securely stored with Stripe, our trusted payment processor.
By agreeing to save your payment information, you have authorized us to automatically bill your card ($card_info) for any future invoices. The payment details you’ve provided are securely stored with Stripe and will be used solely for invoices. We do not have access to your full card details.
You may update or remove your payment information at any time using the portal.
Thank you for your business!
--
$company_name - Billing Department
$config_invoice_from_email
$company_phone";
+ $body = "Hello $session_contact_name,
We’re writing to confirm that your payment details have been securely stored with Stripe, our trusted payment processor.
By agreeing to save your payment information, you have authorized us to automatically bill your card ($stripe_pm_details) for any future invoices. The payment details you’ve provided are securely stored with Stripe and will be used solely for invoices. We do not have access to your full card details.
You may update or remove your payment information at any time using the portal.
Thank you for your business!
--
$company_name - Billing Department
$config_invoice_from_email
$company_phone";
$data = [
[
@@ -635,12 +647,11 @@ if (isset($_GET['stripe_save_card'])) {
}
// Logging
- logAction("Stripe", "Update", "$session_contact_name saved payment method ($card_info) for future automatic payments (PM: $payment_method)", $session_client_id, $session_client_id);
+ logAction("Stripe", "Update", "$session_contact_name saved payment method ($stripe_pm_details) for future automatic payments (PM: $payment_method)", $session_client_id, $session_client_id);
// Redirect
$_SESSION['alert_message'] = "Payment method saved - thank you";
header('Location: autopay.php');
-
}
if (isset($_GET['stripe_remove_pm'])) {
diff --git a/database_updates.php b/database_updates.php
index 3a7a593e..614b15d6 100644
--- a/database_updates.php
+++ b/database_updates.php
@@ -3457,10 +3457,16 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.3'");
}
- // if (CURRENT_DATABASE_VERSION == '2.1.3') {
- // // Insert queries here required to update to DB version 2.1.4
+ if (CURRENT_DATABASE_VERSION == '2.1.3') {
+ mysqli_query($mysqli, "ALTER TABLE `client_stripe` ADD `stripe_pm_details` VARCHAR(200) DEFAULT NULL AFTER `stripe_pm`");
+
+ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.4'");
+ }
+
+ // if (CURRENT_DATABASE_VERSION == '2.1.4') {
+ // // Insert queries here required to update to DB version 2.1.5
// // Then, update the database to the next sequential version
- // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.4'");
+ // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.5'");
// }
} else {
diff --git a/includes/database_version.php b/includes/database_version.php
index 66ba4bf3..72a223bb 100644
--- a/includes/database_version.php
+++ b/includes/database_version.php
@@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
-DEFINE("LATEST_DATABASE_VERSION", "2.1.3");
+DEFINE("LATEST_DATABASE_VERSION", "2.1.4");