/**
  * @link http://docs.whmcs.com/API:Get_Credits	
  * @param clientid - The Client ID you wish to obtain the results for
  * @return json
  */
 public function getcredits()
 {
     $clientid = isset($_GET['clientid']) ? $_GET['clientid'] : 'null';
     $email = isset($_GET['email']) ? $_GET['email'] : 'null';
     if ($clientid == 'null' && $email != 'null') {
         $clientid = Helper::clientid($email);
         $_GET['clientid'] = $clientid;
     } elseif ($clientid == 'null' && $email == 'null') {
         $result['result'] = 'error';
         $result['message'] = 'Silakan masukan email / clientid';
         return json_encode($result);
     } else {
         $clientid = $clientid;
     }
     if (\Config::get('whmcs.useApiKey') == true) {
         $getkey = Helper::api_key();
         if ($getkey != 'null') {
             $cek = Helper::cek($getkey);
             if ($cek != 0) {
                 $action = "getcredits";
                 $datas = WhmcsBase::init($action, Helper::get());
                 $result = json_encode($datas);
                 return $result;
             } else {
                 $result['result'] = 'error';
                 $result['message'] = 'Api key belum terdaftar';
                 return json_encode($result);
             }
         } else {
             $result['result'] = 'error';
             $result['message'] = 'Your API key is missing';
             return json_encode($result);
         }
     } else {
         $action = "getcredits";
         $datas = WhmcsBase::init($action, Helper::get());
         $result = json_encode($datas);
         return $result;
     }
 }
Пример #2
0
 /**
  * @link http://docs.whmcs.com/API:Order_Fraud_Check
  * @param pid - can be used to just retrieve the details of a specific product ID
  * @param gid - can be passed to just retrieve products in a specific group
  * @param module - can be passed to just retrieve products assigned to a specific module
  * @return json
  */
 public function getproducts()
 {
     if (\Config::get('whmcs.useApiKey') == true) {
         $getkey = Helper::api_key();
         if ($getkey != 'null') {
             $cek = Helper::cek($getkey);
             if ($cek != 0) {
                 $action = "getproducts";
                 $datas = WhmcsBase::init($action, Helper::get());
                 $result = json_encode($datas);
                 return $result;
             } else {
                 $result['result'] = 'error';
                 $result['message'] = 'Api key belum terdaftar';
                 return json_encode($result);
             }
         } else {
             $result['result'] = 'error';
             $result['message'] = 'Your API key is missing';
             return json_encode($result);
         }
     } else {
         $action = "getproducts";
         $datas = WhmcsBase::init($action, Helper::get());
         $result = json_encode($datas);
         return $result;
     }
 }