Example #1
0
 /** 
  * Import (require_once) a bunch of PHP files from a particular PHP directory
  * 
  * @param string $dir
  * @return boolean
  */
 public static function import($dir, $autoload = true)
 {
     $dh = opendir(CHARGEOVERAPI_BASEDIR . $dir);
     if ($dh) {
         while (false !== ($file = readdir($dh))) {
             $tmp = explode('.', $file);
             if (end($tmp) == 'php' and !is_dir(CHARGEOVERAPI_BASEDIR . $dir . DIRECTORY_SEPARATOR . $file)) {
                 ChargeOverAPI_Loader::load($dir . DIRECTORY_SEPARATOR . $file, $autoload);
             }
         }
         return closedir($dh);
     }
     return false;
 }
<?php

define('CHARGEOVERAPI_BASEDIR', dirname(__FILE__));
require_once CHARGEOVERAPI_BASEDIR . '/ChargeOverAPI/Loader.php';
ChargeOverAPI_Loader::load('/ChargeOverAPI/Object.php');
ChargeOverAPI_Loader::load('/ChargeOverAPI/Aggregate.php');
ChargeOverAPI_Loader::load('/ChargeOverAPI/Bulk.php');
ChargeOverAPI_Loader::import('/ChargeOverAPI/Object/');
class ChargeOverAPI
{
    const ERROR_UNKNOWN = -1;
    const ERROR_RESPONSE = -2;
    const AUTHMODE_SIGNATURE_V1 = 'signature-v1';
    const AUTHMODE_HTTP_BASIC = 'http-basic';
    const METHOD_CREATE = 'create';
    const METHOD_MODIFY = 'modify';
    const METHOD_DELETE = 'delete';
    const METHOD_GET = 'get';
    const METHOD_FIND = 'find';
    const METHOD_ACTION = 'action';
    const METHOD_AGGREGATE = 'aggregate';
    const METHOD_BULK = 'bulk';
    const METHOD_CONFIG = 'config';
    const METHOD_CHARGEOVERJS = 'chargeoverjs';
    const STATUS_OK = 'OK';
    const STATUS_ERROR = 'Error';
    const FLAG_QUICKBOOKS = '_flag_quickbooks';
    const FLAG_EMAILS = '_flag_emails';
    const FLAG_WEBHOOKS = '_flag_webhooks';
    const FLAG_EVENTS = '_flag_events';
    protected $_url;