Merge pull request #6 from Smirf123/master

Added Order Paid and Order Pending notifications
This commit is contained in:
William Phillips
2020-11-22 18:51:55 +00:00
committed by GitHub

View File

@@ -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(