├── README.md ├── SECURITY.md └── WN_AutoAcceptOrders.php /README.md: -------------------------------------------------------------------------------- 1 | #For integration with your WHMCS, visit https://whmcsninja.com/ or email us at : whmcsninja@gmail.com 2 | # WHMCS-Auto-Accept-Orders 3 | This WHMCS Hook will auto accept orders. There is no need to manually accept them anymore ! No more “pending” orders… 4 | You dont have to do any modification or add anything anywhere in the hook file . its like plug and play code . 5 | 6 | 7 | Installation 8 | 9 | Installation of this hook is quite simple . Download the Zip file 10 | Upload it to the includes/hooks directory of your whmcs and you are done 11 | 12 | 13 | Done:) ! 14 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | wHMCS Version | Supported | 9 | | ------------- | ------------------ | 10 | | 8.1.x | :white_check_mark: | 11 | | < 7.0 | :x: | 12 | 13 | ## Reporting a Vulnerability 14 | 15 | In case You have any issue you can contact on our portal at https://whmcsninja.com/. 16 | You can also Reach out us on skype at rakeshthakurpro0306 17 | -------------------------------------------------------------------------------- /WN_AutoAcceptOrders.php: -------------------------------------------------------------------------------- 1 | join('tblproducts', 'tblhosting.packageid', '=', 'tblproducts.id') 25 | ->join('tblorders', 'tblhosting.orderid', '=', 'tblorders.id') 26 | ->where('tblhosting.id',$ServiceID) 27 | ->select('tblproducts.autosetup as productAutosetup','tblorders.id as orderid','tblhosting.firstpaymentamount as productAmount','tblhosting.id as serviceId') 28 | ->get(); 29 | 30 | $isinvoicedata = Capsule::table('tblorders')->where('id',$GData[0]->orderid)->get(); 31 | if($isinvoicedata) 32 | { 33 | $isinvoice = $isinvoicedata[0]->invoiceid; 34 | if($isinvoice) 35 | { 36 | if($GData[0]->productAutosetup == "payment") 37 | { 38 | $InvoiceStatus = Capsule::table('tblorders') 39 | ->join('tblinvoices', 'tblorders.invoiceid', '=', 'tblinvoices.id') 40 | ->where('tblorders.id',$GData[0]->orderid) 41 | ->select('tblinvoices.status') 42 | ->get(); 43 | if($GData[0]->productAmount != "0.00") 44 | { 45 | if($InvoiceStatus[0]->status == 'Paid') 46 | { 47 | MakeAcceptOrder($GData[0]->orderid,$GData[0]->serviceId); 48 | } 49 | } 50 | 51 | } 52 | } 53 | else 54 | { 55 | if($GData[0]->productAutosetup == "order") 56 | { 57 | MakeAcceptOrder($GData[0]->orderid,$GData[0]->serviceId); 58 | } 59 | 60 | if($GData[0]->productAutosetup == "payment") 61 | { 62 | $InvoiceStatus = Capsule::table('tblorders') 63 | ->join('tblinvoices', 'tblorders.invoiceid', '=', 'tblinvoices.id') 64 | ->where('tblorders.id',$GData[0]->orderid) 65 | ->select('tblinvoices.status') 66 | ->get(); 67 | if($GData[0]->productAmount != "0.00") 68 | { 69 | if($InvoiceStatus[0]->status == 'Paid') 70 | { 71 | MakeAcceptOrder($GData[0]->orderid,$GData[0]->serviceId); 72 | } 73 | } 74 | 75 | } 76 | } 77 | } 78 | 79 | 80 | 81 | } 82 | 83 | }); 84 | 85 | 86 | add_hook('InvoicePaid', 1, function($vars) { 87 | $InvoiceID = $vars['invoiceid']; 88 | $GData = Capsule::table('tblorders') 89 | ->join('tblhosting', 'tblorders.id', '=', 'tblhosting.orderid') 90 | ->join('tblproducts', 'tblhosting.packageid', '=', 'tblproducts.id') 91 | ->where('tblorders.invoiceid',$InvoiceID) 92 | ->select('tblproducts.autosetup as productAutosetup','tblorders.id as orderid','tblhosting.firstpaymentamount as productAmount','tblhosting.id as serviceId') 93 | ->get(); 94 | 95 | if($GData[0]->productAutosetup == "order") 96 | { 97 | MakeAcceptOrder($GData[0]->orderid,$GData[0]->serviceId); 98 | } 99 | 100 | if($GData[0]->productAutosetup == "payment") 101 | { 102 | MakeAcceptOrder($GData[0]->orderid,$GData[0]->serviceId); 103 | } 104 | // Perform hook code here... 105 | }); 106 | 107 | function MakeAcceptOrder($OrderID = "",$ServiceID = "") 108 | { 109 | $command = 'AcceptOrder'; 110 | $postData = array( 111 | 'orderid' => $OrderID, 112 | 'autosetup' => '1', 113 | 'sendemail' => '1', 114 | ); 115 | $admin = Capsule::table('tbladmins') 116 | ->where('roleid', '=', 1) 117 | ->get(); 118 | $adminUsername = $admin[0]->username; 119 | 120 | $results = localAPI($command, $postData, $adminUsername); 121 | 122 | } 123 | 124 | 125 | ?> 126 | --------------------------------------------------------------------------------