diff --git a/includes/hooks/WHMCS-Discord-Notifications.php b/includes/hooks/WHMCS-Discord-Notifications.php index 1325f15..01e06c9 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 = 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 @@ -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(