From 712bce54bed5ff217573cc41c716780f41471c7c Mon Sep 17 00:00:00 2001 From: Smirf123 Date: Tue, 17 Nov 2020 13:06:49 -0600 Subject: [PATCH 1/2] Added Order Paid and Order Pending notifications This adds new hooks for order pending and order paid notices. --- .../hooks/WHMCS-Discord-Notifications.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/includes/hooks/WHMCS-Discord-Notifications.php b/includes/hooks/WHMCS-Discord-Notifications.php index 1325f15..247aa5c 100644 --- a/includes/hooks/WHMCS-Discord-Notifications.php +++ b/includes/hooks/WHMCS-Discord-Notifications.php @@ -58,6 +58,8 @@ $invoiceRefunded = false; // Invoice Refunded Notification $invoiceLateFee = false; // Invoice Late Fee Notification // Order Notifications +$pendingOrder = true; // Order Set to Pending Notification +$orderPaid = true; // Order Paid Notification $orderAccepted = false; // Order Accepted Notification $orderCancelled = false; // Order Cancelled Notification $orderCancelledRefunded = false; // Order Cancelled & Refunded Notification @@ -238,6 +240,52 @@ if($orderFraud === true): }); endif; +if($orderPaid === true): + add_hook('OrderPaid', 1, function($vars) { + $dataPacket = array( + 'content' => $GLOBALS['discordGroupID'], + 'username' => $GLOBALS['companyName'], + 'avatar_url' => $GLOBALS['discordWebHookAvatar'], + 'embeds' => array( + array( + 'title' => 'Order ' . $vars['orderid'] . ' Has Been Paid', + 'url' => $GLOBALS['whmcsAdminURL'] . 'orders.php?action=view&id=' . $vars['orderid'], + 'timestamp' => date(DateTime::ISO8601), + 'description' => '', + 'color' => $GLOBALS['discordColor'], + 'author' => array( + 'name' => 'Order Has been Paid' + ) + ) + ) + ); + processNotification($dataPacket); + }); +endif; + +if($pendingOrder === true): + add_hook('PendingOrder', 1, function($vars) { + $dataPacket = array( + 'content' => $GLOBALS['discordGroupID'], + 'username' => $GLOBALS['companyName'], + 'avatar_url' => $GLOBALS['discordWebHookAvatar'], + 'embeds' => array( + array( + 'title' => 'Order ' . $vars['orderid'] . ' Has Been Set to Pending', + 'url' => $GLOBALS['whmcsAdminURL'] . 'orders.php?action=view&id=' . $vars['orderid'], + 'timestamp' => date(DateTime::ISO8601), + 'description' => '', + 'color' => $GLOBALS['discordColor'], + 'author' => array( + 'name' => 'Order Was Marked as Pending' + ) + ) + ) + ); + processNotification($dataPacket); + }); +endif; + if($networkIssueAdd === true): add_hook('NetworkIssueAdd', 1, function($vars) { $dataPacket = array( From 9bcb7e8e252933a04f1a9fc6db1d9fb4db96aaab Mon Sep 17 00:00:00 2001 From: Smirf123 Date: Sun, 22 Nov 2020 12:41:38 -0600 Subject: [PATCH 2/2] Changed config --- includes/hooks/WHMCS-Discord-Notifications.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/hooks/WHMCS-Discord-Notifications.php b/includes/hooks/WHMCS-Discord-Notifications.php index 247aa5c..01e06c9 100644 --- a/includes/hooks/WHMCS-Discord-Notifications.php +++ b/includes/hooks/WHMCS-Discord-Notifications.php @@ -58,8 +58,8 @@ $invoiceRefunded = false; // Invoice Refunded Notification $invoiceLateFee = false; // Invoice Late Fee Notification // Order Notifications -$pendingOrder = true; // Order Set to Pending Notification -$orderPaid = true; // Order Paid Notification +$pendingOrder = false; // Order Set to Pending Notification +$orderPaid = false; // Order Paid Notification $orderAccepted = false; // Order Accepted Notification $orderCancelled = false; // Order Cancelled Notification $orderCancelledRefunded = false; // Order Cancelled & Refunded Notification