Provision Failure Alerts

This commit is contained in:
Ross Trottier 2024-05-09 13:01:13 -06:00
parent 638d5a97e9
commit 3a6eb3b9cb

View File

@ -19,14 +19,17 @@ function federated_update_provision_status_failed_subscriptions($request){
$subscription_id = $request['subscription_id']; $subscription_id = $request['subscription_id'];
$error_message = $request['error_message']; $error_message = $request['error_message'];
$subscription = wcs_get_subscription($subscription_id);
update_field('provision_status', 'provision_failed', $subscription_id); update_field('provision_status', 'provision_failed', $subscription_id);
update_field('error_message', $error_message, $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['message'] = 'Marked as failed';
$output['success'] = true; $output['success'] = true;
return $output; return $output;
} }