From 3a6eb3b9cb875e96cfefa0ae1fd0b098dfcf5232 Mon Sep 17 00:00:00 2001 From: Ross Trottier Date: Thu, 9 May 2024 13:01:13 -0600 Subject: [PATCH] Provision Failure Alerts --- rest-api/provisioner_rest_api_extensions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rest-api/provisioner_rest_api_extensions.php b/rest-api/provisioner_rest_api_extensions.php index c8255c5..3680ddd 100644 --- a/rest-api/provisioner_rest_api_extensions.php +++ b/rest-api/provisioner_rest_api_extensions.php @@ -19,14 +19,17 @@ function federated_update_provision_status_failed_subscriptions($request){ $subscription_id = $request['subscription_id']; $error_message = $request['error_message']; - $subscription = wcs_get_subscription($subscription_id); update_field('provision_status', 'provision_failed', $subscription_id); update_field('error_message', $error_message, $subscription_id); - $output = array(); + $email_message = 'Provision failed for subscription #: ' . $subscription_id . '. Error message: ' . $error_message; + wp_mail('support@federated.computer', 'ALERT: Provision Failed', $email_message); + + $output = array(); $output['message'] = 'Marked as failed'; $output['success'] = true; + return $output; }