/**
  * Get current SMS credits
  * @return credits
  */
 public static function ws_get_credits()
 {
     $general_settings = get_option('ws_main_option');
     $account = new Mailin(self::sendinblue_api_url, $general_settings['access_key']);
     $account_info = $account->get_account();
     $account_data = array();
     foreach ($account_info['data'] as $key => $info) {
         if (isset($info['plan_type']) && isset($info['credits'])) {
             $account_data[$key]['plan_type'] = $info['plan_type'];
             $account_data[$key]['credits'] = $info['credits'];
         }
     }
     $sms_info = $account_data[1];
     $email_info = $account_data[0];
     return $sms_info['credits'];
 }
 /**
  * Get account info
  */
 static function update_account_info()
 {
     $access_key = SIB_Manager::$access_key;
     $mailin = new Mailin(SIB_Manager::sendinblue_api_url, $access_key);
     $response = $mailin->get_account();
     if (is_array($response) && $response['code'] == 'success') {
         $account_data = $response['data'];
         $count = count($account_data);
         SIB_Manager::$account_email = $account_data[$count - 1]['email'];
         SIB_Manager::$account_data = $account_data;
         SIB_Manager::$account_user_name = $account_data[$count - 1]['first_name'] . ' ' . $account_data[$count - 1]['last_name'];
         $account_settings = array('account_email' => SIB_Manager::$account_email, 'account_user_name' => SIB_Manager::$account_user_name, 'account_data' => SIB_Manager::$account_data);
         update_option(SIB_Manager::account_option_name, $account_settings);
     }
 }