mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
- Finish updating URLs from /portal to /client
- Add a basic Stripe management page to admin settings to remove cards/reset Stripe customer IDs
This commit is contained in:
54
post/admin/admin_settings_online_payment_clients.php
Normal file
54
post/admin/admin_settings_online_payment_clients.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||
|
||||
if (isset($_GET['stripe_remove_pm'])) {
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
if (!$config_stripe_enable) {
|
||||
$_SESSION['alert_message'] = "Stripe not enabled";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
$payment_method = sanitizeInput($_GET['pm']);
|
||||
|
||||
try {
|
||||
// Initialize stripe
|
||||
require_once 'vendor/stripe-php-10.5.0/init.php';
|
||||
$stripe = new \Stripe\StripeClient($config_stripe_secret);
|
||||
|
||||
// Detach PM
|
||||
$stripe->paymentMethods->detach($payment_method, []);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
error_log("Stripe payment error - encountered exception when removing payment method info for $payment_method: $error");
|
||||
logApp("Stripe", "error", "Exception removing payment method for $payment_method: $error");
|
||||
}
|
||||
|
||||
// Remove payment method from ITFlow
|
||||
mysqli_query($mysqli, "UPDATE client_stripe SET stripe_pm = NULL WHERE client_id = $client_id LIMIT 1");
|
||||
|
||||
// Logging & Redirect
|
||||
logAction("Stripe", "Update", "$session_name deleted saved Stripe payment method (PM: $payment_method)", $client_id);
|
||||
$_SESSION['alert_message'] = "Payment method removed";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['stripe_reset_customer'])) {
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
|
||||
// Delete the customer id and payment method id stored in ITFlow, allowing the client to set these up again
|
||||
mysqli_query($mysqli, "DELETE FROM client_stripe WHERE client_id = $client_id");
|
||||
|
||||
// Logging
|
||||
logAction("Stripe", "Delete", "$session_name reset Stripe settings for client", $client_id);
|
||||
|
||||
$_SESSION['alert_message'] = "Reset client Stripe settings";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
@@ -1757,7 +1757,6 @@ if (isset($_GET['close_ticket'])) {
|
||||
|
||||
// EMAIL
|
||||
$subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)";
|
||||
//$body = "Hello $contact_name,<br><br>Your ticket regarding \"$ticket_subject\" has been closed. <br><br> We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding \"$ticket_subject\" has been closed. <br><br> We hope the request/issue was resolved to your satisfaction, please provide your feedback <a href=\'https://$config_base_url/guest/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key\'>here</a>. <br>If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/client/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
|
||||
// Check email valid
|
||||
|
||||
Reference in New Issue
Block a user