public function __construct($dsn_or_Driver, $driver_options = array()) { if (is_object($dsn_or_Driver)) { $this->_driver = $dsn_or_Driver; } else { $this->_driver = QuickBooks_Driver_Factory::create($dsn_or_Driver, $driver_options); } }
/** * * * @param string $dsn_or_conn * @param array $options * @return QuickBooks_Driver */ public static function getInstance($dsn_or_conn = null, $options = array(), $hooks = array(), $log_level = null) { static $instance = null; if (is_null($instance)) { //$instance = QuickBooks_Utilities::driverFactory($dsn_or_conn, $options, $hooks, $log_level); $instance = QuickBooks_Driver_Factory::create($dsn_or_conn, $options, $hooks, $log_level); } return $instance; }
/** * * * @param string $consumer_key The OAuth consumer key Intuit gives you * @param string $consumer_secret The OAuth consumer secret Intuit gives you * @param string $this_url The URL of your QuickBooks_IntuitAnywhere class instance * @param string $that_url The URL the user should be sent to after authenticated */ public function __construct($dsn, $encryption_key, $consumer_key, $consumer_secret, $this_url = null, $that_url = null) { $this->_driver = QuickBooks_Driver_Factory::create($dsn); $this->_key = $encryption_key; $this->_this_url = $this_url; $this->_that_url = $that_url; $this->_consumer_key = $consumer_key; $this->_consumer_secret = $consumer_secret; $this->_debug = false; }
/** * Create a new QuickBooks queue instance * * @param mixed $dsn_or_conn A DSN-style connection string (i.e.: mysq://root:pass@locahost/database) or a database connection (if you wish to re-use an existing database connection) * @param array $config Configuration array for the driver */ public function __construct($dsn_or_conn, $user = null, $config = array()) { //$this->_driver = QuickBooks_Utilities::driverFactory($dsn_or_conn, $config); $this->_driver = QuickBooks_Driver_Factory::create($dsn_or_conn, $config); // No default username was provided, fetch the default from the driver if (!$user) { $user = $this->_driver->authDefault(); } // Set the default username $this->_user = $user; }
public function __construct($dsn = null, $encryption_key = null, $config = array(), $log_level = QUICKBOOKS_LOG_NORMAL) { // Are we in sandbox mode? $this->_sandbox = false; // Use a test gateway? $this->_test = false; // Use debug mode? $this->_debug = false; // Mask sensitive data in the logs (tickets, credit card numbers, etc.) $this->_masking = true; // Parse returned IDS responses into objects? $this->_ids_parser = true; // What version of IDS to use $this->_ids_version = QuickBooks_IPP_IDS::VERSION_3; // Driver class for logging $this->_driver = null; if ($dsn) { $this->_driver = QuickBooks_Driver_Factory::create($dsn, $config, $log_level); $this->_driver->setLogLevel($log_level); } $this->_cookies = array(); $this->_certificate = null; $this->_errcode = QuickBooks_IPP::OK; $this->_errtext = ''; $this->_errdetail = ''; $this->_last_request = null; $this->_last_response = null; $this->_last_debug = array(); $this->_authmode = QuickBooks_IPP::AUTHMODE_FEDERATED; $this->_authuser = null; $this->_authcred = null; $this->_authsign = null; $this->_authkey = null; // Encryption key (used for database storage) $this->_key = $encryption_key; // Default to QuickBooks desktop //$this->flavor(QuickBooks_IPP_IDS::FLAVOR_DESKTOP); }
/** * Create and return an instance of the iterator * * FoxyCart uses a database instance class to cache data received from the * FoxyCart data feeds, so we also create a database instance class and * send that to the iterator. * * @param string $integrator_dsn_or_conn * @param array $integrator_options * @return QuickBooks_Integrator_* */ protected function _integratorFactory($integrator_dsn_or_conn, $integrator_options, $API) { $Driver = QuickBooks_Driver_Factory::create($integrator_dsn_or_conn, $integrator_options); return new QuickBooks_Integrator_Foxycart($Driver, $integrator_options, $API); }
/** * Create a new QuickBooks_API object instance * * @param string $api_driver_dsn A DSN-style connection string to the driver class (i.e.: mysql://root:password@locahost/database) * @param string $user The username of the QuickBooks user using this API class * @param string $source_type A constant, one of: QUICKBOOKS_API_SOURCE_WEB, QUICKBOOKS_API_SOURCE_SQL, etc. * @param string $source_dsn The source DSN-style connection string * @param array $api_options * @param array $source_options * @param array $driver_options * @param array $callback_options */ public function __construct($api_driver_dsn, $user, $source_type, $source_dsn, $api_options = array(), $source_options = array(), $driver_options = array(), $callback_options = array()) { $this->_user = $user; if (empty($source_options['qbxml_version']) and !empty($api_options['qbxml_version'])) { $source_options['qbxml_version'] = $api_options['qbxml_version']; } if (empty($source_options['qbxml_onerror']) and !empty($api_options['qbxml_onerror'])) { $source_options['qbxml_onerror'] = $api_options['qbxml_onerror']; } $this->_config = $this->_defaults($api_options); // @TODO We need a better way of setting the logging level... $hooks = array(); $log_level = QUICKBOOKS_LOG_DEVELOP; $this->_driver = null; if ($api_driver_dsn) { $this->_driver = QuickBooks_Driver_Factory::create($api_driver_dsn, $driver_options, $hooks, $log_level); } $this->_source = $this->_sourceFactory($this->_driver, $user, $source_type, $source_dsn, $source_options); // Masking of sensitive data $this->_masking = true; }
/** * Create an instance of a driver class from a DSN connection string *or* a connection resource * * You can actually pass in *either* a DSN-style connection string OR an already connected database resource * - mysql://user:pass@localhost:port/database * - $var (Resource ID #XYZ, valid MySQL connection resource) * * @param mixed $dsn_or_conn A DSN-style connection string or a PHP resource * @param array $config An array of configuration options for the driver * @param array $hooks An array mapping hooks to user-defined hook functions to call * @param integer $log_level * @return object A class instance, a child class of QuickBooks_Driver */ public static function driverFactory($dsn_or_conn, $config = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL) { return QuickBooks_Driver_Factory::create($dsn_or_conn, $config, $hooks, $log_level); }
public function __construct($dsn, $config = array()) { $this->_driver = QuickBooks_Driver_Factory::create($dsn, $config); }
/** * * * */ public function __construct($dsn, $certificate, $application_login = null, $connection_ticket = null) { $this->_test = false; $this->_debug = false; // Mask credit card numbers $this->_masking = true; if ($dsn) { // @TODO Figure out a better way to set the logging level $driver_options = array(); $driver_hooks = array(); $driver_loglevel = QUICKBOOKS_LOG_DEVELOP; $this->_driver = QuickBooks_Driver_Factory::create($dsn, $driver_options, $driver_hooks, $driver_loglevel); } if ($application_login) { $this->_application_login = $application_login; } else { if ($this->_driver) { } } if ($connection_ticket) { $this->_ticket_connection = $connection_ticket; } else { if ($this->_driver) { //$this->_ticket_connection = $this->_driver-> } } $this->_certificate = $certificate; $this->_errnum = QuickBooks_MerchantService::ERROR_OK; $this->_errmsg = ''; $this->_warnnum = QuickBooks_MerchantService::ERROR_OK; $this->_warnmsg = ''; }
<?php require_once '../QuickBooks.php'; error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); $cart_unitofmeasure = null; $cart_weight = 2.5; $cart_quantity = 1; $cart_weight = 5.0; $cart_quantity = 2; $Driver = QuickBooks_Driver_Factory::create('mysql://*****:*****@localhost/quickbooks_foxycart'); $API = new QuickBooks_API('mysql://*****:*****@localhost/quickbooks_foxycart', 'test.consolibyte.com', QUICKBOOKS_API_SOURCE_WEB); $Integrator = new QuickBooks_Integrator_Foxycart($Driver, array(), $API); $arr_qb_unitofmeasure_names = $Integrator->_listUnitOfMeasureMap(); //print_r($arr_qb_unitofmeasure_names); $choice = QuickBooks_Integrator::_guessQuickBooksUnitOfMeasure($cart_unitofmeasure, $cart_weight, $cart_quantity, $arr_qb_unitofmeasure_names); print 'CHOICE: ' . $choice; print "\n\n";
public function __construct($private_key, $dsn = null, $callback = null, $config = array()) { $this->_key = $private_key; $this->_driver = null; if ($dsn) { // @todo Logging $this->_driver = QuickBooks_Driver_Factory::create($dsn); } $this->_log = ''; $this->_errnum = QuickBooks_IPP_Federator::ERROR_OK; $this->_errmsg = ''; $this->_callback = $callback; $this->_config = $this->_defaults($config); }